在Android和IOS有什么H.264格式的负载? [英] What h.264 format loads on android AND IOS?

查看:257
本文介绍了在Android和IOS有什么H.264格式的负载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从理论上既iOS和Android将播放H.264文件,但我不能想出一个设置为en code他们,使他们的实际工作跨平台。是否有人知道如何连接code为Android和iOS使用一个文件?

Theoretically both IOS and ANDROID will play h.264 files, but I can't figure out a setting to encode them so they actually work cross platform. Does anybody know how to encode for both Android and IOS using one file?

P.S。我知道所有关于HTML5视频和后备来源,我只是不想EN code和举办新的视频为每一个下来的梭子鱼设备。

p.s. I know all about html5 video and the fallback sources, I just don't want to encode and host a new video for every device that comes down the pike.

推荐答案

下面是我们用来反code到MPEG-4 H.264在我们的生产环境FFmpeg的命令行。我们已经在多个Android设备,以及iOS的测试的输出。你可以使用这个为出发点,只调整像帧尺寸/帧频和qfactor。

Here's the ffmpeg command line we use to transcode to MPEG-4 h.264 in our production environment. We've tested the output on several Android devices, as well as iOS. You can use this as a starting point, just tweaking things like frame size/frame rate and qfactor.

ffmpeg -y 
-i #{input_file} 
-s 432x320 
-b 384k 
-vcodec libx264 
-flags +loop+mv4 
-cmp 256 
-partitions +parti4x4+parti8x8+partp4x4+partp8x8 
-subq 6 
-trellis 0 
-refs 5 
-bf 0 
-flags2 +mixed_refs 
-coder 0 
-me_range 16 
-g 250 
-keyint_min 25 
-sc_threshold 40 
-i_qfactor 0.71 
-qmin 10 -qmax 51 
-qdiff 4 
-acodec libfaac 
-ac 1 
-ar 16000 
-r 13 
-ab 32000 
-aspect 3:2 
#{output_file}

一些影响Android的相容性的重要选项是:

Some of the important options affecting Android compatibility are:

-coder 0      Uses CAVLAC rather than CABAC entropy encoding (CABAC not supported on Android)
-trellis 0    Should be shut off, requires CABAC
-bf 0         Turns off B-frames, not supported on Android or other h.264 Baseline Profile devices
-subq 6       Determines what algorithms are used for subpixel motion searching. 7 applies to B-frames, not supported on Android.
-refs 5       Determines how many frames are referenced prior to the current frame.  Increasing this number could affect compatibility

在我们EN code我们这个FFMPEG食谱视频中,我们还通过 QT-的fastStart视频。这一步rechunks流媒体视频。我们通过HTTP流式处理,以在我们的Andr​​oid应用程序的嵌入式VideoView。没有问题串流到任何Android设备,我们是知道的。

After we encode our video with this ffmpeg recipe, we also pass the video through qt-faststart. This step rechunks the video for streaming. We stream it over HTTP to an embedded VideoView within our Android app. No problems streaming to any Android device we're aware of.

更新2013年6月17号:我只是想补充一个需要注意的是,最好坚持使用基线天寒的所有Android设备最大程度的兼容H.264编码。上面的命令行并没有明确指定H.264配置文件,但ffmpeg的确实有一个 -profile 命令行标志,如果您使用的是它的$ P $的pset 的是有用的。你可能不应该乱用 -profile 。我有恩codeD的视频我的华硕变压器300平板电脑(安卓4.2),使用主,而不是基本配置文件(通过手刹)。 主的资料给问题的音频不同步的视频在播放。

Update 2013-06-17: I just wanted to add a note that it's best to stick with "baseline" profile for H.264 encoding for maximum compatibility across all Android devices. The above command line doesn't explicitly specify an H.264 profile, but ffmpeg does have a -profile command line flag that is useful if you are using its presets. You probably shouldn't mess with -profile. I have encoded videos for my ASUS Transformer 300 tablet (Android 4.2) using "main" rather than "baseline" profile (via Handbrake). The "main" profile gave problems with audio getting out of sync with video on playback.

这篇关于在Android和IOS有什么H.264格式的负载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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