ffmpeg设置转换为mp4和ogg为HTML5视频 [英] ffmpeg settings for converting to mp4 and ogg for HTML5 video

查看:443
本文介绍了ffmpeg设置转换为mp4和ogg为HTML5视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管所有的炒作,实际上HTML5视频标签有一个问题。为了使用它和它是跨浏览器兼容的,你必须包含多个格式的视频。要定位所有支持的浏览器,这些格式是mp4和ogg。



我正在搜索各种格式的最佳设置,但不幸的是找不到任何内容。我使用的是ffmpeg 0.6,它标有使用HTML5。我不是视频专家,所以我想知道是否有人可以为每种格式推荐体面的设置?

解决方案

我最终使用 ffmpeg ffmpeg2theora



WebKit兼容的h.264视频



我决定去ipod640预设,因为这意味着可以在iPhone或iPod touch上很好地观看视频。当然,您可以稍后更改设置,摆脱-vpre ipod640,更改分辨率或质量。无论如何,命令是:



ffmpeg -i video_source_file.ext -vcodec libx264 -vpre ipod640 -b 250k -bt 50k -acodec libfaac -ab 56k -ac 2 -s 480x320 video_out_file.mp4



将一些信息移动到文件的前面,以便视频可以在加载之前播放。 p>

qt-faststart video_out_file.mp4 video_out_file_quickstart.mp4



Firefox兼容Ogg视频



这取决于您是否安装了ffmpeg2theora。此外,我只测试了输入文件是以前的ffmpeg转换的输出文件。命令是:



ffmpeg2theora -o video_out_file.ogv video_out_file.mp4


Despite all the hype, in reality the HTML5 video tag has a bit of a problem. In order to use it and for it to be cross browser compatible, you have to include more than one format of the video. To target all supported browsers these formats are mp4 and ogg.

I was searching around for optimum settings for each format but unfortunately I couldn't find any. I'm using ffmpeg 0.6 which has the tagline "Works with HTML5". I'm no video expert so I was wondering if anyone could recommend decent settings for each format?

解决方案

I ended up using ffmpeg and ffmpeg2theora.

WebKit compatible h.264 video

I decided to go for the ipod640 preset because it means the video can be viewed nicely on an iPhone or iPod touch. Of course, you can change the settings around a bit, get rid of the '-vpre ipod640', change the resolution or quality. Anyway the command is:

ffmpeg -i video_source_file.ext -vcodec libx264 -vpre ipod640 -b 250k -bt 50k -acodec libfaac -ab 56k -ac 2 -s 480x320 video_out_file.mp4

move some information to the front of the file so the video can play before it loads

qt-faststart video_out_file.mp4 video_out_file_quickstart.mp4

Firefox compatible Ogg video

This depends on you having ffmpeg2theora installed. Also, I have only tested it with the input file being the output file from the previous ffmpeg conversion. The command is:

ffmpeg2theora -o video_out_file.ogv video_out_file.mp4

这篇关于ffmpeg设置转换为mp4和ogg为HTML5视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆