FORUMS: list search recent posts

Re: Ideal FFMPEG commands for web videos and audios

COW Forums : FFmpeg

Respond to this post   •   Return to posts index   •   Read entire thread

stephen dixon
Re: Ideal FFMPEG commands for web videos and audios
on May 17, 2012 at 9:05:35 am

1. depends on what you are using to play the video. The bad news is that you will probably have to export to at least two formats, possibly three. There's some good info at and among others.

Don't bother with flv, Flash can play mp4 video. There are several good flash players that can be used with HTML as fallback and they'll all take an mp4 file. There are links on the Video For Everybody page I mentioned above. But the way things are, you'll need at least two of mp4, ogv and webm. Thanks to Google, Apple and Microsoft for making things so frikkin difficult.

Here's what I use to generate the above for web display:

h264/x264/mp4 whatever you want to call it
For h.264 I always use
-vcodec lbx264 -preset slow -profile main -crf 20 -acodec libfaac -ab 128k
Change the crf and ab settings to suit your idea of quality vs size (crf is inversely related to the quality 0 is best higher numbers mean worse quality / smaller file sizes). I use the main profile and slow preset because it seems to be most compatible with all the gadgets and gizmos that people play video on these days. It won't give you as much bang for your bit as using higher profiles and slower encodes but more people will actually be able to view it. And using the presets is way easier than hand rolling some arcane compression tweakage.

-vcodec libtheora -qscale 6 -acodec libvorbis -ab 128k
again adjust the quality till it suits you. Qscale is the quality setting in this case; low is bad / small high is good / large.

-vcodec libvpx -qscale 6 -acodec libvorbis -ab 128k
just like ogv. There aren't anywhere near as many knobs and buttons to twiddle with webm and ogv as there are with libx264.

ffmpeg is able to automatically recognise the format of the input video, so don't fret.
ffmpeg -i [your video] [encoding options as specified above] [your output video with appropriate extension - eg output.mp4, output.ogv or output.webm]
and that's all. Magick!

You might also want to add filters to do things like scale the video to an appropriate size, eg:
-vf scale="480:360" (scale to 480x360px)
-vf scale="480:-1" (scale to 480px wide and whatever height it needs to be to maintain the correct proportion).


Stephen Dixon
Editor, Animator, Motionographer
Museum Victoria

Posts IndexRead Thread 

Current Message Thread:

© 2019 All Rights Reserved