ffmpeg settings for converting to mp4 and ogg for HTML5 video


Convert videos to proper formats for HTML5 video on Linux shell using ffmpeg.

When converting to an MP4, you want to use the h264 video codec and the aac audio codec because IE11 and earlier only support this combination.  

ffmpeg -i input.mov -vcodec h264 -acodecaac -strict -2 output.mp4

In this example, input.mov is converted to output2.mp4 with maximum compatibility, with Quicktime support, and without an audio stream.

ffmpeg -an -i input.mov -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 output2.mp4

For Firefox compatible ogg video,  ffmpeg2theora should be installed.  Here the input file is output file from the ffmpeg conversion done before.  

Here’s the command,

ffmpeg2theora -o video_out_file.ogv output.mp4

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 20-Nov-2023

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements