View Full Version : How should I mux a mkv file so that sound could be played on Android?
Hello, World
26th January 2015, 02:58
Hi,
I have a H.264 video source and a PCM audio source.
I want to mux them into a mkv file by myself so that it can be played properly on Android.
But, the mkv file generated can be played well on Windows (either with WMP or with VLC) and Ubuntu (either with the default player or with VLC) only.
There is no sound when playing with the default player on Android but it is fine when playing with MX Player.
Also, if I mux the mkv file with some existing software like MKVToolNix with the same source, the generated mkv file could be played well on android (even with the default player).
So, I believe that it is the mkv format's problem. I somehow mux them so that the android's default player can't analyze the audio frames.
How can I fix the problem? Thanks!
(Edit: Some more information provided on #3.)
PS. Am I posting on the right forum?
foxyshadis
26th January 2015, 09:41
So why not just use mkvmerge, if it works? Without any description of how you're doing it, it's impossible to guess what you're doing wrong.
Hello, World
27th January 2015, 02:41
So why not just use mkvmerge, if it works? Without any description of how you're doing it, it's impossible to guess what you're doing wrong.
It's because I am not going to mux on a PC.
My generated mkv files have a structure very similar to a normal mkv file - a EBML & a Segment. For the segment, there are a SeekHead, a Tags, a Info, a Tracks, some Cluster blocks and a CUES. The difference to a normal mkv file may be in cluster. For some reasons, I wanna pack 1 video frame and 1 audio block in a cluster. The mkv files are in 20fps with a 16k sampling rate PCM. So, in one cluster, there are a video frame (i.e. 1 NALU for non-ref frame) and a audio block with 800 samples.
Simple Block Header for the video block and the audio block in a cluster (suppose the Timecode is 0):
video: 0x81 0x00 0x00 0x80
audio: 0x82 0x00 0x00 0x84 0x0F (0x0F means 16 frames)
I am sure that it's not the offset problem and those mkv analyzer, like Elecard, can analyze my videos.
Thanks!
mindbomb
27th January 2015, 22:15
maybe converting the audio from pcm to flac will help?
Hello, World
28th January 2015, 05:54
maybe converting the audio from pcm to flac will help?
You mean that the default player of Android doesn't support PCM?
But I must mux it with PCM audio source.:(
Asmodian
28th January 2015, 22:01
I have noticed PCM is not well supported on mobile devices. According to developer.android.com PCM is only supported in WAV (http://developer.android.com/guide/appendix/media-formats.html).
Except mkvmerge can generate mkvs with PCM that play well on Android. :confused:
Hello, World
30th January 2015, 09:19
I have noticed PCM is not well supported on mobile devices. According to developer.android.com PCM is only supported in WAV (http://developer.android.com/guide/appendix/media-formats.html).
Except mkvmerge can generate mkvs with PCM that play well on Android. :confused:
Yup, do anyone know the reason?
Ghitulescu
30th January 2015, 11:30
One should not look for a reason, in particular when the things cannot be changed. Surely one may complain, scream, cry, but eg Microsoft will do still how she likes.
I assume the reason is that WAV (PCM) is too big to be handled on portables, and the quality difference (inaudible) will not justify it. There can also be some "conspiracy theories" involved ... :)
Hello, World
2nd February 2015, 09:09
One should not look for a reason, in particular when the things cannot be changed. Surely one may complain, scream, cry, but eg Microsoft will do still how she likes.
I assume the reason is that WAV (PCM) is too big to be handled on portables, and the quality difference (inaudible) will not justify it. There can also be some "conspiracy theories" involved ... :)
I mean why mkvmerge can generate mkvs with PCM which have no problem on Android.
Ghitulescu
2nd February 2015, 10:27
I mean why mkvmerge can generate mkvs with PCM which have no problem on Android.
Android is not always Android. Each build (version) has its own specifications. On top of this, the manufacturers may change the Android as they see fit. Therefore a Sony and a Samsung may behave differently even if both have eg the same 4.2.2.
Remember that the same chaos was also last decade and before on PC, one had to find various "codec packs" to make an AVI play on their PC.
Hello, World
2nd February 2015, 10:56
Android is not always Android. Each build (version) has its own specifications. On top of this, the manufacturers may change the Android as they see fit. Therefore a Sony and a Samsung may behave differently even if both have eg the same 4.2.2.
Remember that the same chaos was also last decade and before on PC, one had to find various "codec packs" to make an AVI play on their PC.
You misunderstood my question again.
I am talking about why mkvmerge can generate mkvs with PCM playing well on Andriod but the mkv generated by myself cannot play well on the SAME phone(s). I believe that this is not because of the build / the codec / anything of the os.
Ghitulescu
2nd February 2015, 13:43
Then the problem lies in the manner you create your own MKVs.
Hello, World
3rd February 2015, 02:32
Then the problem lies in the manner you create your own MKVs.
So, this is what I have been asking since #1.
I wanna know what is wrong in my program.
foxyshadis
3rd February 2015, 02:52
So, this is what I have been asking since #1.
I wanna know what is wrong in my program.
You haven't posted your source code or any samples. How should we know? We're just guessing. You'd probably have to show your source code before anyone could help debug it.
Ghitulescu
3rd February 2015, 10:50
So, this is what I have been asking since #1.
I wanna know what is wrong in my program.
You should have mentioned this also in the #1 post. You added more and more information during the discussion.
You should post a sample of your MKV so that able people may find the issue.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.