[英]How should I choose a video format to be played on Web, Android & iOS?
I am working on a video sharing project and wonder what if there's a video format that is compatible with most players on Web, Android & iOS. 我正在开展一个视频共享项目,并想知道如果有一种视频格式与Web,Android和iOS上的大多数播放器兼容。
The app will work like this: 该应用程序将如下工作:
I am not familiar with different video formats. 我不熟悉不同的视频格式。 I noticed that .mov and .mp4 are used in iOS.
我注意到.mov和.mp4在iOS中使用。 But I assume .mov cannot be played on Android and web browsers except Safari?
但我认为.mov不能在除Safari之外的Android和Web浏览器上播放? Could anyone give a hint?
任何人都可以提示吗?
From Android Developer - Supported media formats , 来自Android Developer - 支持的媒体格式 ,
Type | Format / | Supported File Type(s) /
| Codec | Container Formats
------+-----------+----------------------------------------------------------
Video | H.263 | 3GPP (.3gp)
| | MPEG-4 (.mp4)
+-----------+----------------------------------------------------------
| H.264 AVC | 3GPP (.3gp)
| | MPEG-4 (.mp4)
| | MPEG-TS (.ts, AAC audio only, not seekable, Android 3.0+)
+-----------+----------------------------------------------------------
| H.265 HEVC| MPEG-4 (.mp4, Android 5.0+)
+-----------+------------------------------------------------------
| MPEG-4 SP | 3GPP (.3gp)
+-----------+----------------------------------------------------------
| VP8 | WebM (.webm)
| | Matroska (.mkv, Android 4.0+)
+-----------+----------------------------------------------------------
| VP9 | WebM (.webm)
| | Matroska (.mkv, Android 4.0+)
On the other hand, from iOS Developer Library - Media Layer , 另一方面,来自iOS Developer Library - Media Layer ,
iOS supports many industry-standard video formats and compression standards, including the following:
iOS支持许多行业标准视频格式和压缩标准,包括:
H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
H.264视频,高达1.5 Mbps,640 x 480像素,每秒30帧,H.264基线配置文件的低复杂度版本,AAC-LC音频高达160 Kbps,48 kHz,立体声音频,.m4v, .mp4和.mov文件格式
H.264 video, up to 768 Kbps, 320 by 240 pixels, 30 frames per second, Baseline Profile up to Level 1.3 with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
H.264视频,高达768 Kbps,320 x 240像素,每秒30帧,基线配置文件高达1.3级,AAC-LC音频高达160 Kbps,48 kHz,立体声音频,.m4v,.mp4和。 mov文件格式
MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
MPEG-4视频,高达2.5 Mbps,640 x 480像素,每秒30帧,简单配置文件,AAC-LC音频高达160 Kbps,48 kHz,立体声音频,.m4v,.mp4和.mov文件格式
Numerous audio formats, including the ones listed in Audio Technologies
多种音频格式,包括音频技术中列出的格式
Also, from MDN - Media formats supported by the HTML audio and video elements ( <video>
tag in HTML5), 此外,从MDN - HTML音频和视频元素支持的媒体格式 (HTML5中的
<video>
标签),
<video>
: VP8 and Vorbis in WebM<video>
:WebM中的VP8和Vorbis<video>
: VP9 and Opus in WebM<video>
:WebM中的VP9和Opus<video>
: Streaming WebM via MSE<video>
:通过MSE流式传输WebM<video>
: Theora and Vorbis in Ogg<video>
:Ogg的Theora和Vorbis<video>
: H.264 and MP3 in MP4<video>
:MP4中的H.264和MP3<video>
: H.264 and AAC in MP4<video>
:MP4中的H.264和AAC<video>
: FLAC in MP4<video>
:MP4中的FLAC
From all data, it seems that .mp4 (to be exact, H.264 video, AAC audio, in MPEG-4 ) is the choice here, since it's supported in all platforms (iOS, Android, web browser). 从所有数据来看,似乎.mp4 (确切地说, H.264视频,AAC音频,MPEG-4 )是这里的选择,因为它在所有平台(iOS,Android,网络浏览器)中都受支持。 However, take note that you still have to check for compatibility issues on each platform (different version of Android, different web browser), which is explained on each site.
但是,请注意,您仍然需要检查每个平台(不同版本的Android,不同的Web浏览器)上的兼容性问题,这在每个站点上都有说明。
Adding more info from Andrew T.'s answer. 添加更多信息来自Andrew T.的回答。
To set the parameters from Andrew's conclusion: 从Andrew的结论中设置参数:
// To Set Audio Encoder: AAC
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
// To set Video Encoder: H264
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
// To set Output Video format: mp4
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
Hope it helps...!!! 希望能帮助到你...!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.