当前位置: 首页 > 工具软件 > Ogg Theora > 使用案例 >

html5 codecs,ffmpeg Settings for HTML5 codecs (h264/mp4, theora/ogg, vp8/webm)

潘修文
2023-12-01

This is just a quick tip for people encoding video for HTML5 (and using sweet HTML5 players like MediaElement.js). Go download a copy of ffmpeg, and if you’re on Windows, use this guide to set it up. Then use the following commands to create H.264, WebM, and Ogg videos, along with an image you can use as a poster.

REM mp4 (H.264 / ACC)

"c:\program files\ffmpeg\bin\ffmpeg.exe" -i %1 -b 1500k -vcodec libx264 -vpre slow -vpre baseline -g 30 -s 640x360 %1.mp4

REM webm (VP8 / Vorbis)

"c:\program files\ffmpeg\bin\ffmpeg.exe" -i %1 -b 1500k -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 -s 640x360 %1.webm

REM ogv (Theora / Vorbis)

"c:\program files\ffmpeg\bin\ffmpeg.exe" -i %1 -b 1500k -vcodec libtheora-acodec libvorbis -ab 160000 -g 30 -s 640x360 %1.ogv

REM jpeg (screenshot at 10 seconds)

"c:\program files\ffmpeg\bin\ffmpeg.exe" -i %1 -ss 00:10 -vframes 1 -r 1 -s 640x360 -f image2 %1.jpg

I save this as a batch file and then just drag and drop videos on it to get everything ready for HTML5.

 类似资料: