Use ffmpeg to convert videos to the correct format for HTML5 videos on a Linux shell.
When converting to MP4, you need to use h264 video codec and 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, Quicktime support, and no audio streaming.
ffmpeg -an -i input.mov -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 output2.mp4
For Firefox compatible ogg videos, ffmpeg2theora should be installed. The input file here is the output file of the previous ffmpeg conversion.
The following are the commands:
ffmpeg2theora -o video_out_file.ogv output.mp4
The above is the detailed content of ffmpeg settings to convert video to HTML5 mp4 and ogg formats. For more information, please follow other related articles on the PHP Chinese website!