[MPlayer-users] Removing commercials etc from DVB .mpg program stream

Kimmo Mustonen kmustone at cc.hut.fi
Thu Jun 3 10:43:39 CEST 2004


Hello!

I though that there should be several working solutions to this problem
but I haven't found any yet. :( I have recorded DVB stream that starts
before the actual program starts, ends 10-15 minutes after the program
ends and the programs may contain commercials. How to remove the
commercials without losing (any?) quality first and then re-encode the
program to fit a certain size, like a CD or whatever. For re-encoding I
googled a shell script called encodedvd.sh doing a two-pass encoding,
edited that to read a file instead of a DVD, but it crashed mencoder
before completing the whole thing. I can provide more details on this
later when I have first been able to cut the original stream.

This feels like a real easy HOWTO or FAQ issue but I wasn't able to find
any working solution. There were several instructions for DVD sources but
DVB stream seems somehow different. And there are usually not that much
commercials on DVDs I guess. ;-)

I was suggested to use avidemux. I downloaded 2.0.24 and tried also with
2.0.22 but it found about 2 keyframes per more than one hour of DVB
stream, was not able to show any of them, ate all the CPU time (despite of
having P4 at 3GHz) and crashes all the time. I tried to convert the stream
from .mpg to .avi using mencoder and read the result in avidemux, but it
didn't help anything. I guess with mencoder you can specify about one
second granularity to strip away the unwanted data, but as I tested it
seems like when using mplayer -ss 00:57 it doesn't start at 57 seconds but
usually around two minutes on a plain dvb stream and mplayer -ss 00:58
goes several seconds further from that point, i.e.  the granularity seems
to be off by several seconds. Also the OSD times (behind 'o' key) shows
the total length apparently quite random and current time also starts in
about random position but I guess this is expected on such a stream?

I'd like to be able to cut the video using the granularity of 1 frame. Is
that possible? Using mencoder? Any other tool? I have been reading that
the cutting should be done on a keyframe, but why couldn't the software
recalculate the new keyframe at any point using the previous frames in the
stream? I don't mind using lots of bits for the first frame, because I
could always later re-encode the whole thing and set the keyframes very
far apart from each other (like a few seconds) to save space when I have
edited the video the way I like.

I tried to convert the DVB stream to DivX but was only able to crash
mencoder. I managed to convert it to XviD but the result was even larger
than the original DVB stream. I probably made something wrong or whatever,
but even if avidemux could now read this XviD stream, I guess I have
already lowered the quality by making extra re-encodings and I don't think
this is a good solution really.

I was also told that there's kino and some other tools as well to cut the
commercials but avidemux was definitely the best, I've been told. Any
suggestions? If using avidemux is the solution, what are the best mencoder
options to convert the stream for avidemux so that it does not crash all
the time and does not lose (any?) quality meanwhile? Any other solutions?
Is DVB mpg program stream somehow "different" from "usual" streams because
it seems not to work with avidemux at all, even after converting it to
.avi first? I was also warned about A-V synchronisation problems.

Regards,
Kimmo




More information about the MPlayer-users mailing list