Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th January 2015, 02:58   #1  |  Link
Hello, World
Registered User
 
Join Date: Oct 2014
Posts: 7
How should I mux a mkv file so that sound could be played on Android?

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?

Last edited by Hello, World; 27th January 2015 at 02:43. Reason: additional info
Hello, World is offline   Reply With Quote
Old 26th January 2015, 09:41   #2  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,175
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.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 27th January 2015, 02:41   #3  |  Link
Hello, World
Registered User
 
Join Date: Oct 2014
Posts: 7
Quote:
Originally Posted by foxyshadis View Post
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!

Last edited by Hello, World; 27th January 2015 at 02:59.
Hello, World is offline   Reply With Quote
Old 27th January 2015, 22:15   #4  |  Link
mindbomb
Registered User
 
Join Date: Aug 2010
Posts: 578
maybe converting the audio from pcm to flac will help?
mindbomb is offline   Reply With Quote
Old 28th January 2015, 05:54   #5  |  Link
Hello, World
Registered User
 
Join Date: Oct 2014
Posts: 7
Quote:
Originally Posted by mindbomb View Post
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.

Last edited by Hello, World; 28th January 2015 at 11:12.
Hello, World is offline   Reply With Quote
Old 28th January 2015, 22:01   #6  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 2,710
I have noticed PCM is not well supported on mobile devices. According to developer.android.com PCM is only supported in WAV.

Except mkvmerge can generate mkvs with PCM that play well on Android.
Asmodian is offline   Reply With Quote
Old 30th January 2015, 09:19   #7  |  Link
Hello, World
Registered User
 
Join Date: Oct 2014
Posts: 7
Quote:
Originally Posted by Asmodian View Post
I have noticed PCM is not well supported on mobile devices. According to developer.android.com PCM is only supported in WAV.

Except mkvmerge can generate mkvs with PCM that play well on Android.
Yup, do anyone know the reason?
Hello, World is offline   Reply With Quote
Old 30th January 2015, 11:30   #8  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,510
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 ...
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 2nd February 2015, 09:09   #9  |  Link
Hello, World
Registered User
 
Join Date: Oct 2014
Posts: 7
Quote:
Originally Posted by Ghitulescu View Post
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.
Hello, World is offline   Reply With Quote
Old 2nd February 2015, 10:27   #10  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,510
Quote:
Originally Posted by Hello, World View Post
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.
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 2nd February 2015, 10:56   #11  |  Link
Hello, World
Registered User
 
Join Date: Oct 2014
Posts: 7
Quote:
Originally Posted by Ghitulescu View Post
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.

Last edited by Hello, World; 2nd February 2015 at 10:58.
Hello, World is offline   Reply With Quote
Old 2nd February 2015, 13:43   #12  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,510
Then the problem lies in the manner you create your own MKVs.
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 3rd February 2015, 02:32   #13  |  Link
Hello, World
Registered User
 
Join Date: Oct 2014
Posts: 7
Quote:
Originally Posted by Ghitulescu View Post
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.
Hello, World is offline   Reply With Quote
Old 3rd February 2015, 02:52   #14  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,175
Quote:
Originally Posted by Hello, World View Post
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.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 3rd February 2015, 10:50   #15  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,510
Quote:
Originally Posted by Hello, World View Post
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.
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Reply

Tags
android, audio, mkv, pcm

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.