Dear Forum experts, with regard to using a VideoView to play movies, I have found that my Galaxy S3 will play .mp4, .xvid, .avi, .m4v, .wmv, and .mkv files, but my Nexus 7 will only play .mp4 (and only some of them).
Now I realise that .mp4, .avi and .xvid are containers for various formats and don't really want to get in too deep . If I just look at face value, my S3 works and my Nexus 7 does'nt. So whats different between them? Is it something that I can change or is it built into the firmware, that is the question!
I've been researching and found some references to a couple of system files located in "/system/etc"
The first is a "media_codes.xml" Galaxy S3 version shown below...
The second file is called "media_profiles" and again I've listed the S3 version...
Now comparing these files with the Nexus 7 its possible to see that the Nexus is missing a lot of the file-types listed above. I'm going to have a play whilst I wait to see if this thread gets any responses. I very much doubt that it's as simple as just replacing these files on the Nexus 7. Does anyone else have any experience with this type of thing? What other files should I be looking to replace?
I'm unable to re-encode my entire library of films and so its not an option to convert all my files to a supported type, there's too many. I have installed MediaTomb and if need be I could attempt to transcode on the fly to a supported format. I just thought that I'd give this a try first and it may help others like Ajay who have recently been experiencing similar problems.
Thanks,
RandomCoder
@Erel I've checked the apache license agreement and think that I'm ok to post these files here but if not then please remove.
Now I realise that .mp4, .avi and .xvid are containers for various formats and don't really want to get in too deep . If I just look at face value, my S3 works and my Nexus 7 does'nt. So whats different between them? Is it something that I can change or is it built into the firmware, that is the question!
I've been researching and found some references to a couple of system files located in "/system/etc"
The first is a "media_codes.xml" Galaxy S3 version shown below...
B4X:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
<!-- <!DOCTYPE MediaCodecs [ <!ELEMENT MediaCodecs (Decoders,Encoders)> <!ELEMENT Decoders (MediaCodec*)> <!ELEMENT Encoders (MediaCodec*)> <!ELEMENT MediaCodec (Type*,Quirk*)> <!ATTLIST MediaCodec name CDATA #REQUIRED> <!ATTLIST MediaCodec type CDATA> <!ELEMENT Type EMPTY> <!ATTLIST Type name CDATA #REQUIRED> <!ELEMENT Quirk EMPTY> <!ATTLIST Quirk name CDATA #REQUIRED> ]> There's a simple and a complex syntax to declare the availability of a media codec: A codec that properly follows the OpenMax spec and therefore doesn't have any quirks and that only supports a single content type can be declared like so: <MediaCodec name="OMX.foo.bar" type="something/interesting" /> If a codec has quirks OR supports multiple content types, the following syntax can be used: <MediaCodec name="OMX.foo.bar" > <Type name="something/interesting" /> <Type name="something/else" /> ... <Quirk name="requires-allocate-on-input-ports" /> <Quirk name="requires-allocate-on-output-ports" /> <Quirk name="output-buffers-are-unreadable" /> </MediaCodec> Only the three quirks included above are recognized at this point: "requires-allocate-on-input-ports" must be advertised if the component does not properly support specification of input buffers using the OMX_UseBuffer(...) API but instead requires OMX_AllocateBuffer to be used. "requires-allocate-on-output-ports" must be advertised if the component does not properly support specification of output buffers using the OMX_UseBuffer(...) API but instead requires OMX_AllocateBuffer to be used. "output-buffers-are-unreadable" must be advertised if the emitted output buffers of a decoder component are not readable, i.e. use a custom format even though abusing one of the official OMX colorspace constants. Clients of such decoders will not be able to access the decoded data, naturally making the component much less useful. The only use for a component with this quirk is to render the output to the screen. Audio decoders MUST NOT advertise this quirk. Video decoders that advertise this quirk must be accompanied by a corresponding color space converter for thumbnail extraction, matching surfaceflinger support that can render the custom format to a texture and possibly other code, so just DON'T USE THIS QUIRK. -->
-<MediaCodecs>
-<Decoders>
-<MediaCodec type="video/avc" name="OMX.SEC.avc.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/mp4v-es" name="OMX.SEC.mpeg4.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/3gpp" name="OMX.SEC.h263.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/wvc1" name="OMX.SEC.vc1.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/x-ms-wmv" name="OMX.SEC.vc1.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/avc" name="OMX.SEC.avcdec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/3gpp" name="OMX.SEC.h263.sw.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="video/avc" name="OMX.SEC.avc.sw.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="video/mp4v-es" name="OMX.SEC.mpeg4.sw.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="video/x-ms-wmv" name="OMX.SEC.vc1.sw.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="video/wvc1" name="OMX.SEC.vc1.sw.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="video/x-ms-wmv7" name="OMX.SEC.wmv7.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="video/x-ms-wmv8" name="OMX.SEC.wmv8.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
<MediaCodec type="video/sorenson" name="OMX.SEC.h263sr.dec"/>
<MediaCodec type="video/mp43" name="OMX.SEC.mp43.dec"/>
-<MediaCodec type="video/x-vnd.on2.vp8" name="OMX.SEC.vp8.dec">
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec name="OMX.SEC.amr.dec">
<Type name="audio/amr-wb"/>
<Type name="audio/3gpp"/>
<Quirk name="needs-flush-before-disable"/>
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="audio/mpeg" name="OMX.SEC.mp3.dec">
<Quirk name="needs-flush-before-disable"/>
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="audio/mpeg" name="OMX.SEC.MP3.Decoder">
<Quirk name="supports-multiple-frames-per-input-buffer"/>
<Quirk name="needs-flush-before-disable"/>
</MediaCodec>
-<MediaCodec type="audio/mpeg-L1" name="OMX.SEC.mp3.dec">
<Quirk name="needs-flush-before-disable"/>
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="audio/mpeg-L2" name="OMX.SEC.mp3.dec">
<Quirk name="needs-flush-before-disable"/>
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
<MediaCodec type="audio/mpeg" name="OMX.google.mp3.decoder"/>
-<MediaCodec type="audio/mp4a-latm" name="OMX.SEC.aac.dec">
<Quirk name="needs-flush-before-disable"/>
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="audio/flac" name="OMX.SEC.flac.dec">
<Quirk name="needs-flush-before-disable"/>
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="audio/x-ms-wma" name="OMX.SEC.wma.dec">
<Quirk name="needs-flush-before-disable"/>
<Quirk name="decoder-ignores-streamcorrupt-error"/>
</MediaCodec>
-<MediaCodec type="video/mp4v-es" name="OMX.SEC.MPEG4.Decoder">
<Quirk name="requires-allocate-on-input-ports"/>
<Quirk name="requires-allocate-on-output-ports"/>
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/3gpp" name="OMX.SEC.H263.Decoder">
<Quirk name="requires-allocate-on-input-ports"/>
<Quirk name="requires-allocate-on-output-ports"/>
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/avc" name="OMX.SEC.AVC.Decoder">
<Quirk name="requires-allocate-on-input-ports"/>
<Quirk name="requires-allocate-on-output-ports"/>
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
<MediaCodec type="audio/3gpp" name="OMX.google.amrnb.decoder"/>
<MediaCodec type="audio/amr-wb" name="OMX.google.amrwb.decoder"/>
<MediaCodec type="audio/mp4a-latm" name="OMX.google.aac.decoder"/>
-<MediaCodec type="audio/g711-alaw" name="OMX.google.g711.alaw.decoder">
<Quirk name="decoder-lies-about-samplingrate"/>
</MediaCodec>
-<MediaCodec type="audio/g711-mlaw" name="OMX.google.g711.mlaw.decoder">
<Quirk name="decoder-lies-about-samplingrate"/>
</MediaCodec>
<MediaCodec type="audio/vorbis" name="OMX.google.vorbis.decoder"/>
<MediaCodec type="audio/raw" name="OMX.google.raw.decoder"/>
<MediaCodec type="video/mp4v-es" name="OMX.google.mpeg4.decoder"/>
<MediaCodec type="video/3gpp" name="OMX.google.h263.decoder"/>
<MediaCodec type="video/avc" name="OMX.google.h264.decoder"/>
<MediaCodec type="video/x-vnd.on2.vp8" name="OMX.google.vpx.decoder"/>
</Decoders>
-<Encoders>
-<MediaCodec type="video/mp4v-es" name="OMX.SEC.mpeg4.enc">
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/3gpp" name="OMX.SEC.h263.enc">
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
-<MediaCodec type="video/avc" name="OMX.SEC.avc.enc">
<Quirk name="video-controller-check-enable"/>
</MediaCodec>
<MediaCodec type="audio/mp4a-latm" name="OMX.SEC.aac.enc"/>
-<MediaCodec type="video/mp4v-es" name="OMX.SEC.MPEG4.Encoder">
<Quirk name="requires-allocate-on-input-ports"/>
<Quirk name="requires-allocate-on-output-ports"/>
<Quirk name="requires-allocate-on-output-ports"/>
</MediaCodec>
-<MediaCodec type="video/3gpp" name="OMX.SEC.H263.Encoder">
<Quirk name="requires-allocate-on-input-ports"/>
<Quirk name="requires-allocate-on-output-ports"/>
</MediaCodec>
-<MediaCodec type="video/avc" name="OMX.SEC.AVC.Encoder">
<Quirk name="requires-allocate-on-input-ports"/>
<Quirk name="requires-allocate-on-output-ports"/>
</MediaCodec>
<MediaCodec type="audio/3gpp" name="OMX.google.amrnb.encoder"/>
<MediaCodec type="audio/amr-wb" name="OMX.google.amrwb.encoder"/>
<MediaCodec type="audio/mp4a-latm" name="OMX.google.aac.encoder"/>
<MediaCodec type="audio/flac" name="OMX.google.flac.encoder"/>
</Encoders>
</MediaCodecs>
The second file is called "media_profiles" and again I've listed the S3 version...
B4X:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
<!DOCTYPE MediaSettings>
<!-- This file is used to declare the multimedia profiles and capabilities on an android-powered device. -->
-<MediaSettings>
<!-- Each camcorder profile defines a set of predefined configuration parameters -->
<!-- Back Camera -->
-<CamcorderProfiles cameraId="0">
-<EncoderProfile duration="30" fileFormat="mp4" quality="low">
<Video frameRate="30" height="144" width="176" bitRate="384000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="high">
<Video frameRate="30" height="1080" width="1920" bitRate="17000000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="qcif">
<Video frameRate="30" height="144" width="176" bitRate="384000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="480p">
<Video frameRate="30" height="480" width="640" bitRate="3078000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="720p">
<Video frameRate="30" height="720" width="1280" bitRate="12000000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="1080p">
<Video frameRate="30" height="1080" width="1920" bitRate="17000000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapselow">
<Video frameRate="30" height="144" width="176" bitRate="384000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapsehigh">
<Video frameRate="30" height="1080" width="1920" bitRate="17000000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapseqcif">
<Video frameRate="30" height="144" width="176" bitRate="384000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapse480p">
<Video frameRate="30" height="480" width="640" bitRate="3078000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapse720p">
<Video frameRate="30" height="720" width="1280" bitRate="12000000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapse1080p">
<Video frameRate="30" height="1080" width="1920" bitRate="17000000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
<ImageEncoding quality="90"/>
<ImageEncoding quality="80"/>
<ImageEncoding quality="70"/>
<ImageDecoding memCap="20000000"/>
</CamcorderProfiles>
<!-- Front Camera -->
-<CamcorderProfiles cameraId="1">
-<EncoderProfile duration="30" fileFormat="mp4" quality="low">
<Video frameRate="30" height="144" width="176" bitRate="384000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="high">
<Video frameRate="30" height="480" width="640" bitRate="3078000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="qcif">
<Video frameRate="30" height="144" width="176" bitRate="384000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="480p">
<Video frameRate="30" height="480" width="640" bitRate="3078000" codec="h264"/>
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapselow">
<Video frameRate="30" height="144" width="176" bitRate="384000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapsehigh">
<Video frameRate="30" height="480" width="640" bitRate="3078000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapseqcif">
<Video frameRate="30" height="144" width="176" bitRate="384000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
-<EncoderProfile duration="30" fileFormat="mp4" quality="timelapse480p">
<Video frameRate="30" height="480" width="640" bitRate="3078000" codec="h264"/>
<!-- The Audio part of the profile will not be used since time lapse mode does not capture audio -->
<Audio bitRate="128000" codec="aac" channels="1" sampleRate="48000"/>
</EncoderProfile>
<ImageEncoding quality="90"/>
<ImageEncoding quality="80"/>
<ImageEncoding quality="70"/>
<ImageDecoding memCap="20000000"/>
</CamcorderProfiles>
<EncoderOutputFileFormat name="mp4"/>
<!-- If a codec is not enabled, it is invisible to the applications In other words, the applications won't be able to use the codec or query the capabilities of the codec at all if it is disabled -->
<VideoEncoderCap name="h264" maxFrameRate="30" minFrameRate="1" maxFrameHeight="1080" minFrameHeight="144" maxFrameWidth="1920" minFrameWidth="176" maxBitRate="20000000" minBitRate="64000" enabled="true"/>
<VideoEncoderCap name="h263" maxFrameRate="30" minFrameRate="1" maxFrameHeight="480" minFrameHeight="144" maxFrameWidth="800" minFrameWidth="176" maxBitRate="1000000" minBitRate="64000" enabled="true"/>
<VideoEncoderCap name="m4v" maxFrameRate="30" minFrameRate="1" maxFrameHeight="1080" minFrameHeight="144" maxFrameWidth="1920" minFrameWidth="176" maxBitRate="20000000" minBitRate="64000" enabled="true"/>
<AudioEncoderCap name="aac" maxBitRate="196000" minBitRate="8192" enabled="true" maxChannels="2" minChannels="1" maxSampleRate="48000" minSampleRate="8000"/>
<AudioEncoderCap name="amrwb" maxBitRate="23050" minBitRate="6600" enabled="true" maxChannels="1" minChannels="1" maxSampleRate="16000" minSampleRate="16000"/>
<AudioEncoderCap name="amrnb" maxBitRate="12200" minBitRate="5525" enabled="true" maxChannels="1" minChannels="1" maxSampleRate="8000" minSampleRate="8000"/>
<!-- FIXME: We do not check decoder capabilities at present At present, we only check whether windows media is visible for TEST applications. For other applications, we do not perform any checks at all. -->
<VideoDecoderCap name="wmv" enabled="false"/>
<AudioDecoderCap name="wma" enabled="false"/>
<!-- The VideoEditor Capability configuration: - maxInputFrameWidth: maximum video width of imported video clip. - maxInputFrameHeight: maximum video height of imported video clip. - maxOutputFrameWidth: maximum video width of exported video clip. - maxOutputFrameHeight: maximum video height of exported video clip. - maxPrefetchYUVFrames: maximum prefetch YUV frames for encoder, used to limit the amount of memory for prefetched YUV frames. For this platform, it allows maximum 8MB(1.3MB per 720p frame x 6 frames) memory. -->
<VideoEditorCap maxPrefetchYUVFrames="6" maxOutputFrameHeight="720" maxOutputFrameWidth="1280" maxInputFrameHeight="720" maxInputFrameWidth="1280"/>
<!-- The VideoEditor Export codec profile and level values correspond to the values in OMX_Video.h. E.g. for h264, profile value 1 means OMX_VIDEO_AVCProfileBaseline and level 2048 means OMX_VIDEO_AVCLevel4. Please note that the values are in decimal. These values are for video encoder. -->
<!-- Codec = h.264, Baseline profile, level 4 -->
<ExportVideoProfile name="h264" level="2048" profile="1"/>
<!-- Codec = h.263, Baseline profile, level 0 -->
<ExportVideoProfile name="h263" level="1" profile="1"/>
<!-- Codec = mpeg4, Simple profile, level 5 -->
<ExportVideoProfile name="m4v" level="128" profile="1"/>
</MediaSettings>
Now comparing these files with the Nexus 7 its possible to see that the Nexus is missing a lot of the file-types listed above. I'm going to have a play whilst I wait to see if this thread gets any responses. I very much doubt that it's as simple as just replacing these files on the Nexus 7. Does anyone else have any experience with this type of thing? What other files should I be looking to replace?
I'm unable to re-encode my entire library of films and so its not an option to convert all my files to a supported type, there's too many. I have installed MediaTomb and if need be I could attempt to transcode on the fly to a supported format. I just thought that I'd give this a try first and it may help others like Ajay who have recently been experiencing similar problems.
Thanks,
RandomCoder
@Erel I've checked the apache license agreement and think that I'm ok to post these files here but if not then please remove.