I've been having issues while trying to play MP4s with multiple audio streams and have recently decided to track the problem down.
Situation: Select an audio stream different than the first one for an mp4 from the #TRANSCODE folder
Result: A different audio stream would play then the one selected.
I tracked the problem down to the following section of code from net/pms/dlna/DLNAMediaInfo.java:
- Code: Select all
712 if (langId == 0 && (getContainer().equals("avi") || getContainer().equals("ogm") || getContainer().equals("mov") || getContainer().equals("flv") || getContainer().equals("mp4"))) {
713 langId++;
714 }
After spending some time trying to figure out why the langID was being incremented, I tracked down the post/revision it was added:
viewtopic.php?f=11&t=11363
http://code.google.com/p/ps3mediaserver ... tail?r=704
But I was confused as to why this was happening. So I ran some test MP4s to see what MPlayer was saying both at the current revision (r1007) and the revision the change was made (r704).
Results for mplayer=ps3mediaserver/osx/mplayer @ r1007:
- Code: Select all
$ mplayer RvB_S01_Remastered.mp4
MPlayer SB18 (C) 2000-2011 MPlayer Team
Custom build by SubJunk, http://www.spirton.com
Playing RvB_S01_Remastered.mp4.
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
====================================================
$mplayer \[TV-J\]\ Kidou\ Senshi\ Gundam\ UC\ Unicorn\ -\ episode.02\ \[BD\ 1920x1080\ h264+AAC\(5.1ch\ JP+EN\)\ +Sub\(JP-EN-SP-FR-CH\)\ Chap\].mp4
MPlayer SB18 (C) 2000-2011 MPlayer Team
Custom build by SubJunk, http://www.spirton.com
Playing [TV-J] Kidou Senshi Gundam UC Unicorn - episode.02 [BD 1920x1080 h264+AAC(5.1ch JP+EN) +Sub(JP-EN-SP-FR-CH) Chap].mp4.
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang jpn
[lavf] stream 2: audio (aac), -aid 1, -alang eng
[lavf] stream 3: subtitle (dvdsub), -sid 0, -slang jpn
[lavf] stream 4: subtitle (dvdsub), -sid 1, -slang eng
[lavf] stream 5: subtitle (dvdsub), -sid 2, -slang fra
[lavf] stream 6: subtitle (dvdsub), -sid 3, -slang spa
[lavf] stream 7: subtitle (dvdsub), -sid 4, -slang zho
[lavf] stream 8: subtitle (dvdsub), -sid 5, -slang zho
Results for mplayer=ps3mediaserver/osx/mplayer @ r704:
- Code: Select all
$ mplayer RvB_S01_Remastered.mp4
MPlayer SVN-r33685-4.2.1 (C) 2000-2011 MPlayer Team
Playing RvB_S01_Remastered.mp4.
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
====================================================
$ mplayer \[TV-J\]\ Kidou\ Senshi\ Gundam\ UC\ Unicorn\ -\ episode.02\ \[BD\ 1920x1080\ h264+AAC\(5.1ch\ JP+EN\)\ +Sub\(JP-EN-SP-FR-CH\)\ Chap\].mp4
MPlayer SVN-r33685-4.2.1 (C) 2000-2011 MPlayer Team
Playing [TV-J] Kidou Senshi Gundam UC Unicorn - episode.02 [BD 1920x1080 h264+AAC(5.1ch JP+EN) +Sub(JP-EN-SP-FR-CH) Chap].mp4.
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang jpn
[lavf] stream 2: audio (aac), -aid 1, -alang eng
[lavf] stream 3: subtitle (dvdsub), -sid 0, -slang jpn
[lavf] stream 4: subtitle (dvdsub), -sid 1, -slang eng
[lavf] stream 5: subtitle (dvdsub), -sid 2, -slang fra
[lavf] stream 6: subtitle (dvdsub), -sid 3, -slang spa
[lavf] stream 7: subtitle (dvdsub), -sid 4, -slang zho
[lavf] stream 8: subtitle (dvdsub), -sid 5, -slang zho
From this, I see that the code is incorrectly setting the index of the first audio stream from 0 to 1.
I also decided to run this test agains the rest of the files types the code was correcting itself for and found the following results (for mplayer @ r1007):
- Code: Select all
$ mplayer FLCL\ -\ 01\ -\ Fooly\ Cooly.ogm
MPlayer SB18 (C) 2000-2011 MPlayer Team
Custom build by SubJunk, http://www.spirton.com
Playing FLCL - 01 - Fooly Cooly.ogm.
libavformat file format detected.
[lavf] stream 0: video (mpeg4), -vid 0, FLCL - Episode 1 - Fooly Cooly
[lavf] stream 1: audio (vorbis), -aid 0, -alang English
[lavf] stream 2: audio (vorbis), -aid 1, -alang Japanese
[lavf] stream 3: audio (vorbis), -aid 2, -alang Director's Comments
[lavf] stream 4: subtitle (text), -sid 0, -slang English
[lavf] stream 5: subtitle (text), -sid 1, -slang Director's Comments
====================================================
$ mplayer oneyearwar_040405_01_qtlow.mov
MPlayer SB18 (C) 2000-2011 MPlayer Team
Custom build by SubJunk, http://www.spirton.com
Playing oneyearwar_040405_01_qtlow.mov.
libavformat file format detected.
[lavf] stream 0: video (svq3), -vid 0
[lavf] stream 1: audio (mp3), -aid 0, -alang eng
====================================================
$ mplayer ctrl.alt.del.episode1.m4v
MPlayer SB18 (C) 2000-2011 MPlayer Team
Custom build by SubJunk, http://www.spirton.com
Playing ctrl.alt.del.episode1.m4v.
libavformat file format detected.
[lavf] stream 0: audio (aac), -aid 0, -alang eng
[lavf] stream 1: video (h264), -vid 0
====================================================
$ mplayer 20051210-w50s.flv
MPlayer SB18 (C) 2000-2011 MPlayer Team
Custom build by SubJunk, http://www.spirton.com
Playing 20051210-w50s.flv.
libavformat file format detected.
[lavf] stream 0: video (vp6f), -vid 0
[lavf] stream 1: audio (mp3), -aid 0
====================================================
$ mplayer domino-tuesday.avi
MPlayer SB18 (C) 2000-2011 MPlayer Team
Custom build by SubJunk, http://www.spirton.com
Playing domino-tuesday.avi.
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
According to these results, OGM, MOV, and FLV files also do not need to be re-adjusted.
The only reason I can see why this was added is one of two things:
1) The Windows version of MPlayer/MEncoder starts their audio streams at 1 for these files types.
2) The Windows version of MPlayer/MEncoder @ r704 was incorrectly setting the first audio stream at 1 for these file types.
However, before I file a bug on this, I need someone on Windows, seeing as how that is the originating OS, to confirm that everything I'm seeing is consistant with what mplayer is showing on Windows as well.
If it is the case, then it looks like the patch is simple enough:
- Code: Select all
Index: net/pms/dlna/DLNAMediaInfo.java
===================================================================
--- net/pms/dlna/DLNAMediaInfo.java (revision 1007)
+++ net/pms/dlna/DLNAMediaInfo.java (working copy)
@@ -709,7 +709,7 @@
int a = line.indexOf("(");
int b = line.indexOf("):", a);
DLNAMediaAudio audio = new DLNAMediaAudio();
- if (langId == 0 && (getContainer().equals("avi") || getContainer().equals("ogm") || getContainer().equals("mov") || getContainer().equals("flv") || getContainer().equals("mp4"))) {
+ if (langId == 0 && getContainer().equals("avi")) {
langId++;
}
audio.setId(langId++);
Super thanks to you guys for adding descriptive enough toString to everything, it made finding this problem a lot easier.
