首页 > 代码库 > 视频格式资料

视频格式资料

视频播放:

reference address:

http://developer.android.com/guide/appendix/media-formats.html#core

http://developer.android.com/guide/appendix/media-formats.html#recommendations

http://developer.android.com/guide/appendix/media-formats.html

https://www.google.pt

 

 

Table 1: Supported Video Format for Android 

 

Android Supported Video Format/Codec

Supported Video File Types/Container Formats

Details

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+)

Baseline Profile (BP)

MPEG-4 SP

•3GPP (.3gp)

 

VP8

• WebM (.webm)
• Matroska (.mkv, Android 4.0+)

Streamable only in Android 4.0 and above

 

 

Tips: for more information about audio and image formats compatible with Android, please see the following: 

• Supported Audio formats: MP3, 3GP, MP4, M4A, AAC, WAV, TS, FLAC, OGG, MID, XMF, MXMF, RTTTL, RTX, OTA, IMY.

• Supported Image formats: JPG, GIF, PNG, BMP, WEBP.

Now that you‘ve had a clear understanding of the android supported video file formats, let’s move to the next section of recommended video encoding profiles and parameters that the Android devices support for playback. Only if you are skilled in the encoding parameters for Android recognized video, can you play videos on Android without going awry. To twist the video encoding parameters to best suit your Android phones and tablets, you can count on video converter software to fulfill the needs.

Table 2: Video Encoding Parameter Recommendations for Android

 

 

SD (Low quality)

SD (High quality)

HD (Only available on some devices)

Video resolution

176 x 144 px

480 x 360 px

1280 x 720 px

Video codec

H.264 Baseline Profile

H.264 Baseline Profile

H.264 Baseline Profile

Video frame rate

12 fps

30 fps

30 fps

Video bitrate

56 Kbps

500 Kbps

2 Mbps

Audio bitrate

24 Kbps

128 Kbps

192 Kbps

Audio codec

AAC-LC

AAC-LC

AAC-LC

Audio channels

1 (mono)

2 (stereo)

2 (stereo)

 

 
example codes:

Summary: 

  • H.264 Baseline Profile, 480 x 360 px, 30 fps, 500 Kbps
  • AAC-LC, Stereo, 128 Kbps
 
 
this.mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);this.mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);this.mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);this.mediaRecorder.setMaxDuration(10000);this.mediaRecorder.setOutputFile(this.initFile().getAbsolutePath());this.mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);this.mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);this.mediaRecorder.setVideoSize(640,480); this.mediaRecorder.setVideoFrameRate(12); try {    this.mediaRecorder.setPreviewDisplay(this.cameraPreview.getHolder().getSurface());    this.mediaRecorder.prepare();    // start the actual recording    // throws IllegalStateException if not prepared    this.mediaRecorder.start();    Toast.makeText(this, R.string.recording, Toast.LENGTH_SHORT).show();    // enable the stop button by indicating that we are recording    this.toggleButtons(true);} catch (Exception e) {    Log.wtf(TAG, "Failed to prepare MediaRecorder", e);    Toast.makeText(this,"record nathi thatu...", Toast.LENGTH_SHORT).show();    this.releaseMediaRecorder();}

视频格式资料