[FFmpeg-user] Need help encoding a specific video for HTML5

Lou lou at lrcd.com
Thu Feb 14 21:13:04 CET 2013

On Thu, 14 Feb 2013 15:32:30 +0530
Antony Peiris <acct_reg at fireslug.com> wrote:

> ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers

0.10.2 is considered old here. Using ffmpeg from git head is usually
recommended for general users.
>    configuration:

Your configuration is blank meaning you will be unable to encode with
libx264, libvpx, and libvorbis. You will need to configure with:

--enable-gpl --enable-libvorbis --enable-libvpx --enable-libx264

...this does not include any external AAC encoding library that you may
want to use instead of the native FFmpeg AAC encoder (aac).

> I want to create a .mp4, .ogv and .webm suitable for playing on the web,
> and especially mobile devices running Apple iOS (iPad). I was 
> recommended the following command for the .mp4, but I need help with the 
> others as well:
> ffmpeg-y-i in.mov-filter:v scale=640:360  \
>         -c:v libx264-preset:v slow-profile:v baseline \
>         -x264opts level=3.0:vbv-maxrate=750:vbv-bufsize=3750:ref=1  \
>         -b:v 500k-r:v25/1  -force_fps-movflags faststart \
>         -c:a libfaac-b:a 80k-pass x out.mp4

Your command is missing some spaces between options. I don't think you
should force a frame size of 640x360: instead you can use 640:-1 to
allow ffmpeg to automatically select a height that will preserve
aspect. If the returned value is negative, then libx264 will complain
and you can use "scale=640:trunc(ow/a/2)*2" instead.

You probably don't need to change the frame rate from the original.

If you're targeting iPad (and iPhone 4 and later) then you can use main
profile, level 3.1 instead of baseline. For highest compatibility if
you are also supporting old iPhone and iPod touch you can use baseline
profile, level 3.0. See the "Preparing Media for Delivery to iOS-Based
Devices" section of:


It deals with live streaming, but I assume the "Preparing Media" section
should be the same or similar for progressive download or whatever.

> Is the above command the best solution for what I am trying to 
> accomplish (Apple iOS compatibility and mobile support)? Also, what 
> commands should I run for webm and ogv?

ffmpeg -i input -c:v libvpx -c:a libvorbis -q:a 3 output.webm

You should add your desired bitrate or quality for the video.

I see no reason to use Theora video and Vorbis audio in ogv if you're
going to supply VP8 video and Vorbis audio in webm.

Please do not reply to an existing message and make a new subject for
new questions. This is called "thread hijacking", and in clients that
support a threaded view your new question will be buried under older
stuff and therefore more likely to be ignored.

More information about the ffmpeg-user mailing list