Tuesday, November 22, 2011

[rgtqevpm] ffmpeg to msmpeg4v2

Start with video file off my smartphone, portrait, h264 inside mp4. Goal: shrink it to a size small enough to be emailable, and natively plays on Microsoft Windows Media Player without having to download extra codecs.

Install libavcodec-extra-53 for ubuntu oneiric to get the libmp3lame audio encoder.

ffmpeg -i input.mp4 -vf scale=iw/2:ih/2,transpose=1 -vcodec msmpeg4v2 -acodec libmp3lame -qscale 20 -r 30.06 output.avi

Setting the rate correctly (-r 30.06, matching the input rate) was important, or otherwise the rate of the AVI container becomes 1000, and WMP fails to play it. But I still occasionally see a dropped frame; maybe it's not exactly 30.06?

The instructions for wmv2 didn't work enough to shrink the file. Not even "-q 31" seemed to significantly work.

For previewing the file
mplayer -really-quiet -vf pp=de -fs $file
was nice, which runs a deblocking filter.

No comments :