James Crook, web geek ++

Video conversion: ogv to mp4

31 Aug 2011

HandBrake software screenshot

I sometimes record screencasts for clients (or just for fun) using recordmydesktop, a great, simple screen-and-voice recorder on Ubuntu.

It captures the screen and audio for a selected area and outputs it to an .ogv file. This file views fine on my own computer, but Windows users and others often have trouble with it, and it's also quite a large file size by default.

So I often convert my screencasts to .mp4 format and then put them on screencast.com. Screencast.com is great in that it lets me send private links to clients, even password-protected if I want, and it doesn't resize or reformat the videos that I put up. Screencast.com suggests using the mp4 format and with html5 handling getting better it seems good to me too.

Mencoder

I've always been a fan of mencoder for converting video. I used to convert the recordmydesktop .ogv files to .avi files using this script:

nice mencoder inputfile.ogv -ovc xvid -vf harddup -xvidencopts bitrate=800 -oac mp3lame -lameopts abr:br=92 -channels 1 -o outputfile.avi

or, using a negative bitrate creates an output file of that size using whatever bitrate is needed:

nice mencoder inputfile.ogv -ovc xvid -oac mp3lame -lameopts abr:br=92 -xvidencopts bitrate=-5000 -vf harddup -o outputfile.avi

I would put these scripts into a shell file and then run them as needed from the command line.

However, recently mencoder has had problems for me. It's dropping duplicate video frames even when I don't want it to, which causes the audio to get badly out of sync. It also doesn't seem to handle mp4 output formats well.

So I've been looking around for an alternative.

Handbrake

Handbrake is an Open Source, GUI video transcoder that runs on Windows, Mac and Linux.

It can rip DVDs (not copy-protected ones) and convert them to a variety of formats including mp4, and works with many other input video types including .ogv - so recordmydesktop screencasts are (theoretically) easy to handle.

To get it on Ubuntu you'll need to add the PPA.

However, while the interface looks nice and easy I found that for me the mp4 files created by Handbrake only contained a single still image, not moving video, although the audio played fine. I'm not sure if this is due to drivers on my system or a glitch in Handbrake, but it was enough to stop me using it.

Ffmpeg

Ffmpeg is another command-line tool.

To get ffmpeg to output successful mp4 files I had to build it following an excellent tutorial on ubuntuforums.org rather than use the default one available through the repositories.

Once I installed ffmpeg according to that tute I could use the following shell script to get a beautiful mp4 output file:

#!/bin/bash
# ogv to mp4

# 1-pass CRF encoding using ffmpeg
# Adjust -crf to change the quality. Lower numbers mean higher quality and a larger output file size. A sane range is 18 to 28.

ffmpeg -i "$1" -acodec libfaac -aq 80 -vcodec libx264 -preset slow -crf 25 -threads 0 "tmp-$2"

# qt-faststart makes playback work better on the web
qt-faststart "tmp-$2" "$2"
rm "tmp-$2"

If you copy and paste that into 'ogv2mp4.sh' you can run it with ./bin/ogv2mp4.sh inputfile.ogv outputfile.mp4

As a bonus this seems about 4x faster than the original mencoder solution. Nice.

Categories: 

Comments

31 Oct 2011

thanx for info, but there is a nice tool for video to mp4 format converting http://www.macvide.com/Macvide_iPod_Converter/, i usually use and enjoy it!)

29 Nov 2013

Video Converter is regarded to be the fastest and most reliable mkv to mp4 converter around with its superior and unique systems conversion would only take a few minutes. <a href="http://magnoconag.com/">asus laptops india price</a>

22 Jun 2014

Hi there friends, how is the whole thing, and what you wish for to say about this piece of writing, in my view its truly amazing
designed for me.

26 Jun 2014

If some one wants to be updated with latest technologies afterward he must be visit this site and be up to date
every day.

30 Jun 2014

Definitely believe that that you stated. Your favorite justification appeared to be
at the internet the simplest thing to consider of.

I say to you, I certainly get irked whilst other people think about issues that they plainly do not recognise about.

You managed to hit the nail upon the top and outlined out the entire thing
without having side effect , people can take a signal.
Will likely be again to get more. Thanks

16 Dec 2011

That's perfect! Resolved all my issues with ogv from Desktop Recorder.

15 Apr 2012

Great help that ffmpeg script! I was having massive dropped frames when mixing *.ogv (produced from screen recording with recordMyDesktop) on OpenShot video editor.
Now I convert the *.ogv to *.mp4 and the mixing goes on flawlessly.
Thanks once again!

25 Jul 2014

39Q[0-9]218

25 Jul 2014

Can I just say what a relief to discover someone who actually knows what they
are talking about on the internet. You certainly realize how to bring an issue to light
and make it important. More and more people need to read this and understand this side of the story.

It's surprising you are not more popular since you certainly have the
gift.

29 Jul 2014

Hello to every body, it's my first go to see of this blog;
this webpage includes remarkable and genuinely fine material in support
of readers.

15 Mar 2013

The above ffmpeg script is a little hard and complicated to me. I often type OGV Converter- Easily Convert OGV to AVI,MP4,WMV,MPEG,and FLV in Google to find the answer. If you want to get a quick solution, hope this can be helpful:
http://www.bigasoft.com/articles/ogv-converter-convert-ogv-to-avi-mp4-wm...

23 Jul 2014

Thanks for sharing your info. I really appreciate your efforts and I
will be waiting for your further write ups thanks once again.

17 Aug 2013

<script> alert(owned)</script>

17 Jul 2014

Bloxwich found American buyers were willing to
follow Warren Buffet's sage advice or suggestion regarding management
of your home country or, at most universities that is not an issue that's really important to your business.
Start changing your life. This success apart, there's a problem if your
short messages to people.

06 Oct 2013

Super cool and interesting post! You really got my brain goin on that one! I'm going to share it with all my friends in this particular chat room site I like to go to. The site is cool if you're wondering. It's super duper fun and cool just like your magnificient post. http://adult4sexchat.com

18 Apr 2014

I think ffmpeg to most people is just like Greek to them. Personally recommend a more easy-to-use and reliable way here: http://faasoft.com/articles/ogv-converter.html

16 Jul 2014

Thanks for finally writing about >Add new comment | JmsCrk <Liked it!

25 Jul 2014

I'm pretty pleased to uncover this great site. I wanted to thank you for your time just for this wonderful read!!
I definitely really liked every bit of it and i also have you saved as a favorite to look at new stuff on your website.

11 Jul 2014

Really a good article for know the real factors about video conversion.

22 Jul 2014

It's in reality a great and useful piece of information. I'm
glaad that yoou simply shared thhis useful ingormation wwith us.

Please stay us informed like this. Thank you for sharing.

11 Jul 2014

Really a good article for know the real factors about video conversion.

22 Jul 2014

A fascinating discussion is worth comment.
I do think that you should write more on this
topic, it might not be a taboo matter but typically folks don't talk about
these subjects. To the next! Kind regards!!

28 Jul 2014

The children from foreign orphanages often times had worse deprivation than children in their native country.
For birth parents who have a child they wish to find a
loving home for you have the choice of your involvement during the process.

Closely linked to this strategy is the technology strategy.

30 Jul 2014

I almost never write responses, but after reading some of the responses here Add new comment |
JmsCrk. I actually do have a few questions for you if you do not mind.

Could it be simply me or do a few of the remarks appear like they are written by brain dead individuals?
:-P And, if you are writing on additional online sites,
I would like to keep up with you. Could you list of every one of your social sites like your linkedin profile,
Facebook page or twitter feed?

11 Jul 2014

Really a good article for know the real factors about video conversion.

24 Jul 2014

Great beat ! I wish to apprentice while you amend your site, how
can i subscribe for a weblog site? The account helped me a acceptable
deal. I have been tiny bit acquainted of this your broadcast provided shiny clear concept

17 Jul 2014

I have used handbrake, it is a good software, but the shortage is the output format only have mp4, mkv. I love Firecoresoft Video Converter too.

18 Jul 2014

Wonderful website. A lot of helpful info here. I am sending
it to some pals ans also sharing in delicious.
And certainly, thanks in your sweat!

17 Jul 2014

I have used handbrake, it is a good software, but the shortage is the output format only have mp4, mkv. I love Firecoresoft Video Converter too.

17 Jul 2014

I have used handbrake, it is a good software, but the shortage is the output format only have mp4, mkv. I love Firecoresoft Video Converter too.

17 Jul 2014

I know this if off topic but I'm looking into starting my own weblog and was wondering what all is
required to get setup? I'm assuming having a blog like
yours would cost a pretty penny? I'm not very web savvy so I'm not
100% sure. Any recommendations or advice would be
greatly appreciated. Appreciate it

27 Jul 2014

Good day! I just wish to offer you a big thumbs up for your great info you've got right
here on this post. I am returning to your blog for more soon.

17 Jul 2014

I have used handbrake, it is a good software, but the shortage is the output format only have mp4, mkv. I love Firecoresoft Video Converter too.

17 Jul 2014

What's up colleagues, how is all, and what you would like to say concerning this post, in my
view its actually remarkable designed for me.

25 Jul 2014

wonderful points altogether, you just received a new reader.

What would you recommend in regards to your post that you made some days in the past?
Any certain?

Add new comment