Android MediaPlayer支持的音视频格式和协议

时间:2024-03-15 12:06:50

Android MediaPlayer支持的音视频格式和协议

2018年04月18日 18:33:42 阅读数:11127 标签: MediaplayerIjkPlayerAndroid音视频Android Mediaplayer音视频编解码 更多

个人分类: Android-音视频

版权声明:原创作品,转载请注明原创链接地址! https://blog.csdn.net/wangxp423/article/details/79994879

最近在研究android音视频相关的知识。下面是对应标题的官方文档 
android 官网对于Mediaplayer支持格式的文档: 
https://developer.android.google.cn/guide/topics/media/media-formats.html


一,对比Mediaplayer和IjkMediaPlayer

在写完MediaPlayer的demo(红米6.0.1系统)的时候,准备接入一下bilibili开源的ijkplayer的时候,在做对比的时候发现— 
Mediaplayer对于: 
1,raw下资源文件主要指.mp4 .mkv 
2,sd卡下的mp4,mkv 
3,http协议下的MP4 
4,https协议下的MP4 
5,rm,rmvb格式视频不支持

而对于ijkplayer的IjkMediaPlayer 
1,raw下资源文件 
2,sd卡下的mp4,mkv 
3,http协议下的MP4 
这些是支持的,但是对于https,rm,rmvb的竟然不支持。后来发现在编译的指定.so文件以后就会支持https和更多其他格式的视频文件。 
这个时候不禁想,那Mediaplayer到底支持哪些格式的文件。所以才有了这篇文章。

二,支持格式

引言中已经贴出了android官网对于支持格式的文档 不想跳转的直接往下看。

Supported Media Formats

This document describes the media codec, container, and network protocol support provided by the Android platform.

As an application developer, you can use any media codec that is available on any Android-powered device, including those provided by the Android platform and those that are device-specific. However, it is a best practice to use media encoding profiles that are device- agnostic.

The tables below describe the media format support built into the Android platform. Codecs that are not guaranteed to be available on all Android platform versions are noted in parentheses, for example: (Android 3.0+). Note that any given mobile device might support other formats or file types that are not listed in the table.

Section 5 of the Android Compatibility Definition specifies the media formats a device must support to be compatible with Android 8.1. 
Android MediaPlayer支持的音视频格式和协议
Android MediaPlayer支持的音视频格式和协议
Android MediaPlayer支持的音视频格式和协议

Video decoding recommendations

Device implementations must support dynamic video resolution and frame rate switching through the standard Android APIs within the same stream for all VP8, VP9, H.264, and H.265 codecs in real time and up to the maximum resolution supported by each codec on the device.

Implementations that support the Dolby Vision decoder must follow these guidelines:

Provide a Dolby Vision-capable extractor. 
Properly display Dolby Vision content on the device screen or on a standard video output port (e.g., HDMI). 
Set the track index of backward-compatible base-layer(s) (if present) to be the same as the combined Dolby Vision layer’s track index.

Video streaming requirements

For video content that is streamed over HTTP or RTSP, there are additional requirements:

For 3GPP and MPEG-4 containers, the moov atom must precede any mdat atoms, but must succeed the ftyp atom. 
For 3GPP, MPEG-4, and WebM containers, audio and video samples corresponding to the same time offset may be no more than 500 KB apart. To minimize this audio/video drift, consider interleaving audio and video in smaller chunk sizes.

Android MediaPlayer支持的音视频格式和协议