Hi, I am doing some conversions between mpeg2 (TS) to mpeg4 (vxid) via mencoder. The TS isn't demultiplexed as I am using the TS directly as input. When done, the result is slightly asynchronous. mencoder itself reports a very slight delay (0,048s) but the result is even more asynchronous. Setting -delay 0 didn't help. Any clue? Markus
Markus Bonet wrote:
Hi,
I am doing some conversions between mpeg2 (TS) to mpeg4 (vxid) via mencoder. The TS isn't demultiplexed as I am using the TS directly as input.
When done, the result is slightly asynchronous. mencoder itself reports a very slight delay (0,048s) but the result is even more asynchronous.
Setting -delay 0 didn't help.
Any clue?
try with -demuxer lavf -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Prestiti Online. Scopri subito se sei finanziabile. in 24 ore senza spese n� anticipi, clicca qui * Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2908&d=22-1
On Jan 22, 07 14:40:49 +0100, Nico Sabbi wrote:
Markus Bonet wrote:
I am doing some conversions between mpeg2 (TS) to mpeg4 (vxid) via mencoder. The TS isn't demultiplexed as I am using the TS directly as input.
When done, the result is slightly asynchronous. mencoder itself reports a very slight delay (0,048s) but the result is even more asynchronous.
Good to know that others have the same issues. I get delays between +250ms and -200ms.
try with -demuxer lavf
This doesn't work correctly for -oac copy and ac3 streams. The produced file plays fine with mplayer, but with no other player (I think I remember xine worked as well). Media player classic (guliverkli) complains that there's no audio, VirtualDub even crashes as soon as anything is to be done with audio. FWIW, -demuxer mpegts (default) works (modulo the delay). Is this a known issue (actually two known issues), or should I upload a sample? Thanks Matthias -- Matthias Hopf <mhopf@suse.de> __ __ __ Maxfeldstr. 5 / 90409 Nuernberg (_ | | (_ |__ mat@mshopf.de Phone +49-911-74053-715 __) |_| __) |__ labs www.mshopf.de
Matthias Hopf wrote:
try with -demuxer lavf
This doesn't work correctly for -oac copy and ac3 streams. The produced file plays fine with mplayer, but with no other player (I think I remember xine worked as well). Media player classic (guliverkli) complains that there's no audio, VirtualDub even crashes as soon as anything is to be done with audio. FWIW, -demuxer mpegts (default) works (modulo the delay).
Is this a known issue (actually two known issues),
1 known issue
or should I upload a sample?
yes, please -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Refill srl il paradiso della tua stampante - cartucce e toner compatibili, inchiostri e accessori per la ricarica, carta speciale. Tutto a prezzi scontatissimi! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=5187&d=2-2
Nico,
or should I upload a sample? yes, please
Done. Find it named lavf_copy_broken_audio_hdtv.ts It's only 1MB, at 1080i, which gives you only approx 1-2 second of video and audio, but that's enough for the tests. Not for A/V sync issues, but that is not the case ATM. Let's concentrate on getting it working first, then I'll test A/V sync again afterwards. I've done more extensive testing with current unpatched mplayer SVN. Summary: - -demuxer lavf breaks -oac copy subtly - still works with mplayer/xine, but not on any other player I tried - remuxing doesn't help - the extracted ac3 looks good - the extracted ac3 from the broken avi is exactly the same as the extracted ac3 from the original file Now how I come to this summary: mencoder -oac copy -ovc xvid -xvidencopts 'fixed_quant=4' -o tst0_mpegts.avi lavf_copy_broken_audio_hdtv.ts mencoder -oac copy -demuxer lavf -ovc xvid -xvidencopts 'fixed_quant=4' -o tst1_lavf.avi lavf_copy_broken_audio_hdtv.ts mencoder -oac mp3lame -demuxer lavf -ovc xvid -xvidencopts 'fixed_quant=4' -o tst2_lavf_lame.avi lavf_copy_broken_audio_hdtv.ts mplayer -dumpaudio -dumpfile tst3_mpegts.ac3 lavf_copy_broken_audio_hdtv.ts mplayer -dumpaudio -demuxer lavf -dumpfile tst4_lavf.ac3 lavf_copy_broken_audio_hdtv.ts mplayer -dumpaudio -dumpfile tst5_mpegts_fromavi.ac3 tst0_mpegts.avi mplayer -dumpaudio -dumpfile tst6_lavf_fromavi.ac3 tst1_lavf.avi mencoder -oac copy -ovc copy -o tst7_mpegts_copy.avi tst0_mpegts.avi mencoder -oac copy -ovc copy -o tst8_lavf_copy.avi tst1_lavf.avi mplayer -dumpaudio -dumpfile tst9_lavf_fromcopyavi.ac3 tst7_lavf_copy.avi The resulting file sizes: 223242 tst0_mpegts.avi 232748 tst1_lavf.avi 221900 tst2_lavf_lame.avi 26112 tst3_mpegts.ac3 26112 tst4_lavf.ac3 24746 tst5_mpegts_fromavi.ac3 26112 tst6_lavf_fromavi.ac3 223218 tst7_mpegts_copy.avi 230184 tst8_lavf_copy.avi 26112 tst9_lavf_fromcopyavi.ac3 tst0, tst2, tst7: play fine everywhere tst1, tst8: - media player classic (guliverkli), M$ media player 9: no sound (no audio detected) - virtualdubmod crashes (6 Channel Stereo?!? 17 blocks audio only?!? inditerminable length, rate?!?) - if I embed one of the .ac3 files with virtualdubmod (disabling the already embedded audio) the files play fine (but I won't comment on A/V synchronity) - mplayer, xine: ok The .ac3 files tst3, tst4, tst6, and tst9 actually exactly the same, not only same size. Interestingly, tst5 is different, but it is one of the files that work. Please tell me if I can be of any more help. Matthias -- Matthias Hopf <mhopf@suse.de> __ __ __ Maxfeldstr. 5 / 90409 Nuernberg (_ | | (_ |__ mat@mshopf.de Phone +49-911-74053-715 __) |_| __) |__ labs www.mshopf.de
Hi, I noted (and participated) in a discussion on mencoder-users, that probably fits much better in mplayer-dev-eng now. You'll find a summary of the discussion that lead to this at the end of this mail. You might want to read it first if the summary doesn't make sense to you. Summary: - "-demuxer lavf" breaks "-oac copy" subtly - still works with mplayer and xine, but not on any other player I tried - remuxing doesn't help - the extracted ac3 looks good (5.1 channel ac3, no broken packets) - the extracted ac3 from the broken avi is exactly the same as the extracted ac3 from the original file - Sample uploaded as lavf_copy_broken_audio_hdtv.ts - Patch attached, but not to be applied without *major* revision The sample is only 1MB, at 1080i, which gives you only approx 1 second of video and audio, but that's enough for the tests. Not for A/V sync issues, but that seems to work out fine as later tests show. Now I've compared the avi files that were produced by choosing lavf and mpegts demuxers, and it showed, that mpegts produced a constant bitrate stream (dwSampleSize = 1), while lavf produced a VBR stream. Also, nBlockAlign, wBitsPerSample, nSamplesPerSecond wasn't set by lavf. nChannels is set differently (2 by mpegts, 6 by lavf), but that is irrelevant, and lavf is IMHO actually doing the right thing here. The culprit for not finding any audio at all in the other players I tried (compared to xine and mplayer which both found audio) was the missing nBlockAlign. Additionally, without setting/changing the constant bitrate information (dwSampleSize, dwRate, dwScale), stream duration was way off, and no sound was actually heard (though at least detected). I didn't really try to create correct VBR settings here, though, but just copied the ones from the avi created by mpegts. With this information I finally created the attached patch, which fixes the issues for me. Though I hardly know what I'm doing in this area. In fact, it should be considered rather a discussion base than a real patch. But it *did* fix *my* problems (except for wrong wBitsPerSample, which is cosmetic only) so far, and I get perfectly synchronous video and audio with it. So far. So the remaining question is basically twofold: - Why is nBlockAlign, wBitsPerSample not set correctly? - Why is dwRate/dwScale/dwStart/dwLength/dwSuggestedBufferSize wrong? What are the right values? I assume codec->frame_size and/or codec->sample_rate are wrong. lavf gets it right for constant bit rate, but an unknown ac3 stream is inherrently variable, so a VBR approach is the right thing (TM) to do. Can anyone with a deeper understanding how demuxing in mplayer actually works comment on my findings? Thanks Matthias =========== Now for the background discussion: Markus Bonet:
I am doing some conversions between mpeg2 (TS) to mpeg4 (vxid) via mencoder. The TS isn't demultiplexed as I am using the TS directly as input.
When done, the result is slightly asynchronous. mencoder itself reports a very slight delay (0,048s) but the result is even more asynchronous.
Setting -delay 0 didn't help.
Nico Sabbi:
try with -demuxer lavf
Markus Bonet:
Nice! Seemed to help. Thank you.
Me:
Good to know that others have the same issues. I get delays between +250ms and -200ms.
try with -demuxer lavf
This doesn't work correctly for -oac copy and ac3 streams. The produced file plays fine with mplayer, but with no other player (I think I remember xine worked as well). Media player classic (guliverkli) complains that there's no audio, VirtualDub even crashes as soon as anything is to be done with audio. FWIW, -demuxer mpegts (default) works (modulo the delay).
Is this a known issue (actually two known issues), or should I upload a sample?
Nico Sabbi:
Yes, please.
This resulted in the sample upload and further analysis: mencoder -oac copy -ovc xvid -xvidencopts 'fixed_quant=4' -o tst0_mpegts.avi lavf_copy_broken_audio_hdtv.ts mencoder -oac copy -demuxer lavf -ovc xvid -xvidencopts 'fixed_quant=4' -o tst1_lavf.avi lavf_copy_broken_audio_hdtv.ts mencoder -oac mp3lame -demuxer lavf -ovc xvid -xvidencopts 'fixed_quant=4' -o tst2_lavf_lame.avi lavf_copy_broken_audio_hdtv.ts mplayer -dumpaudio -dumpfile tst3_mpegts.ac3 lavf_copy_broken_audio_hdtv.ts mplayer -dumpaudio -demuxer lavf -dumpfile tst4_lavf.ac3 lavf_copy_broken_audio_hdtv.ts mplayer -dumpaudio -dumpfile tst5_mpegts_fromavi.ac3 tst0_mpegts.avi mplayer -dumpaudio -dumpfile tst6_lavf_fromavi.ac3 tst1_lavf.avi mencoder -oac copy -ovc copy -o tst7_mpegts_copy.avi tst0_mpegts.avi mencoder -oac copy -ovc copy -o tst8_lavf_copy.avi tst1_lavf.avi mplayer -dumpaudio -dumpfile tst9_lavf_fromcopyavi.ac3 tst7_lavf_copy.avi The resulting file sizes: 223242 tst0_mpegts.avi 232748 tst1_lavf.avi 221900 tst2_lavf_lame.avi 26112 tst3_mpegts.ac3 26112 tst4_lavf.ac3 24746 tst5_mpegts_fromavi.ac3 26112 tst6_lavf_fromavi.ac3 223218 tst7_mpegts_copy.avi 230184 tst8_lavf_copy.avi 26112 tst9_lavf_fromcopyavi.ac3 tst0, tst2, tst7: play fine everywhere tst1, tst8: - media player classic (guliverkli), M$ media player 9: no sound (no audio detected) - virtualdubmod crashes (6 Channel Stereo?!? 17 blocks audio only?!? inditerminable length, rate?!?) - if I embed one of the .ac3 files with virtualdubmod (disabling the already embedded audio) the files play fine (but I won't comment on A/V synchronity) - mplayer, xine: ok The .ac3 files tst3, tst4, tst6, and tst9 actually exactly the same, not only same size. Interestingly, tst5 is different, but it is one of the files that work. Both the analysis at the begining of this mail and the patch are new. -- Matthias Hopf <mhopf@suse.de> __ __ __ Maxfeldstr. 5 / 90409 Nuernberg (_ | | (_ |__ mat@mshopf.de Phone +49-911-74053-715 __) |_| __) |__ labs www.mshopf.de
participants (3)
-
Markus Bonet -
Matthias Hopf -
Nico Sabbi