Video Conversion - mencoder + ffmpeg

This is just a quick post. I am working on creating a video for YouTube to show off the current state of my project (see my prior post). Several challenges came up during this process, this is how I handled them:

1) I needed a desktop recording program to record the emulator.
This was easy, I installed a program called "gtk-recordmydesktop" and was able to figure everything out with no instructions. On Linux (Ubuntu) this is in the package manager so it was as easy as "sudo apt-get install gtk-recordmydesktop"

2) The resulting video is a non-standard resolution and format, in this case my video file is out.ogv with 272 x 432 resolution. My video editor wants a dv file with 4:3 aspect ratio and YouTube wants 640 x 480 resolution. Getting this to the necessary aspect ratio / resultion / file type required re-encoding / padding / scaling with mencoder, and a transcode with ffmpeg.

I found this command to do a straight conversion:
mencoder out.ogv -ovc xvid -xvidencopts pass=1 -o output.avi

The file was not the correct aspect ratio however, to get that I add expand=-304:0:152:0 to pad the video:
mencoder out-2.ogv -vf expand=-304:0:152:0 -ovc xvid -xvidencopts pass=1 -o output-padded.avi

This is great, but I still need 640 x 480 resolution, so I add scale=640:480 and have the final result:
mencoder out-2.ogv -vf expand=-304:0:152:0,scale=640:480 -ovc xvid -xvidencopts pass=1 -o output-padded-scaled.avi

All thats left now is to convert to DV with ffmpeg:
ffmpeg -threads 2 -i output-padded-scaled.avi -s pal -r pal -aspect 4:3 -ac 2 -ar 48000 -y output-padded-scaled.dv

3) Now to get back to editing my video for YouTube!

Small addendum:
I used my cell phone to record the audio, which saves in AMR format, which is proprietary and not easy to convert. I managed to get it with the following commands:
amrnb-decoder Input.amr audio.sw
sox -r 8000 audio.sw audio.wav

I used references:


Post a Comment