[MPlayer-users] Removing commercials etc from DVB .mpg program stream
Kimmo Mustonen
kmustone at cc.hut.fi
Mon Jun 7 09:26:16 CEST 2004
> >>> you can dump the stream with dvbstream using -ps (to save as
> >>> program stream) then
> >>> cut all you don't want using GOPchop,
> >>
> >> avidemux works very nice for editing mpeg2 files and it has an option
> >> to output an mpeg2 file back out without re-encoding once you've cut
> >> out the stuff you want (its the File/Save/Save as DVD PS option).
> >
> > I used it a couple of times with 2.0.22, but A/V sync was destroyed,
> > and I noticed that it added a huge amount
> > of Nav packets (much more that dvb-mplex -t DVD)
>
> hmm, I've been using 2.0.24 and had sync problems only when I saved
> video and audio separately, when I've used the save as dvd ps option its
> always worked great. For the vcd or svcd conversion I use ffmpeg with
> the -target option.
I tried both of these during the weekend but with not too much of success.
:(
I have captured DVB stream using dvbd as daemon and dvbcat as client,
saving the resulting file as a program stream so it should be quite ok
from that side. It plays correctly on mplayer with A/V in sync.
When I tried to load that file either in GOPchop (1.0.0) or in avidemux2
(2.0.24), it only found about 2-3 keyframes for some reason.
I had to demultiplex it (why's that? it should already be a MPEG-PS
because it was been captured using
dvbcat -P -o target.mpg dvb-t CHANNELNAME
where -P is
-P, --ps Convert stream to program stream
Well, I used dvb-mplex found in libdvb-0.5.4/dvb-mpegtools with -t MPEG2.
It says that VPTS - APTS delay is 597ms and demultiplexes (what?) the
stream to a new program stream(?) that can be read by GOPchop and
avidemux2 and that contains about two GOPs (and keyframes) per second.
The resulting mplexed.mpg stream plays correctly on mplayer with A/V in
sync and it can be loaded both in GOPchop and avidemux2. Sounds fine? Yes.
BUT! :-(
When I load it in GOPchop I can only cut it by the GOPs (keyframes),
right? This means that I cannot get very accurate cutting. Well, I tried
that anyway. The resulting video and audio seem to be in sync when viewed
using mplayer, but at the beginning of each clip (at start, after each
commercial break etc), there are broken frames containing green blocks etc
and the result is thus unacceptable. I wonder if GOPchop doesn't start new
clips with the keyframe? As far as I understand the keyframe should be
independent and thus I shouldn't see any broken frames.
When I load it in avidemux2 and scan for the audio, it is 677 ms shifted
(597ms plus for some strange reason 80ms added to that???). It warns about
that and the cutting is difficult because the audio is not in sync with
video while cutting. Well, I saved the clip using Save as DVD PS and it
asked for A/V shift value for saving between -1000 and +1000 ms. I
accepted the default, 0. When viewed on mplayer, I had to set the
audio_delay to about +200ms to look like being quite exact. Why +200? Why
not -677, +677, -597 or -597 or 0? I tried saving the same clip again in
avidemux2 using +200ms as the audio shift value but that was the wrong
way, it became worse but not +400ms but something else. I tried with
then saving with -200ms but it still wasn't correct. Is there any way to
really fix this or should I just keep on guessing? I tried even +1000ms
and -1000ms but it wasn't shifted accordingly. Sometimes even in the
original dvb-t stream I have to use audio_delay of -200 or -300 in mplayer
to get it right.
There are also audio delay (-a) and video delay (-v) options in dvb-mplex.
I tried to set -a -597 and -a -677 to fix the time shift alert in
avidemux2. It helped, using one of them (probably -677 but I'm not sure)
disabled the alert. But still even when viewing in avidemux2, the
A-V sync was already lost. :(
Can this be really this difficult? Is this because of dvb-t stream? I also
tried using dvb-mplex with -t DVD but it didn't seem to change anything.
The types available are
--type, -t: set output type (MPEG2, DVD, SVCD (default),
MPEG1, VCD, XSVCD, XVCD)
Any better tools for cutting? Any tool to finetune the A-V sync after
avidemux2 has output the file? Or any other solution? Is it possible that
even the original dvb-t file has A-V out of sync but the players like
mplayer are just able to fix the synchronisation but avidemux2 isn't?
Sorry for my long(ish!) descriptions.
Regards,
Kimmo
More information about the MPlayer-users
mailing list