[mythtv-users] Automated mpeg2 recordings chopping with avidemux

James L. Paul james at mauibay.net
Sat Nov 29 18:39:11 EST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 29 November 2003 11:08, Paul de Bruin wrote:
> Hi all,
>
> Today I spent some time figuring out how to cut sections from mpeg2
> recordings (pvr250/350) without reencoding. After a bit of
> experimentation I found out it can be done using avidemux.  I have
> attached a snippet of python code that generates the required commands.

I have done some similar automation using avidemux2. Can you tell me what 
version of avidemux your are using? I'm satisfied with using avidemux2, but 
as of a couple weeks ago I haven't been successful finding a version of 
avidemux that will recognize my PVR-250 files.

> The steps:
>
> My recordings are: MPEG2 352x576 at 25 2000/2500 bitrate, with 224 mp2 audio
>
> In mythtv create/edit the cutlist for the recording. Make sure there is
> a cut at the beginning of the recording (if the recording starts
> immediately, cut the first second or so).
>
> Edit the attached python script to provide mysql location/user/password.
> Call with the full path to the recording to generate the lines to be
> executed to generate a .m2v/.mp2 pair for each section of the cutlist.
>
> Example:
>
> # cutmpeg2.py /media/tv/9_20031129151300_20031129154500.nuv
>
> avidemux --index-mpeg /media/tv/9_20031129151300_20031129154500.nuv
>          /media/tv/9_20031129151300_20031129154500.nuv.idx C0 --audio-codec
> MP2 --quit avidemux --load /media/tv/9_20031129151300_20031129154500.nuv
> --begin 9097 --end 40597 --audio-codec MP2 --save-raw-video
> 9_20031129151300_20031129154500_0.m2v --save-raw-audio
> 9_20031129151300_20031129154500_0.mp2 --quit
>
> [the output above is two lines, but is formatted for this mail]
>
> The first line generates an index (.idx) for the mpeg2 recording
> (required). The second line cuts the raw video and audio streams and
> saves these to two files (.m2v and .mp2) for each section of the
> cutlist.  These streams can then be remuxed and all sections can be
> concatenated.

My results with concatenation have been poor. I haven't found a tool that will 
do it properly without causing problems that the cut points with either 
element streams or program streams.

For making DVDs I just leave the segments unconcatenated. That is, I pass all 
the segments to a single title for dvdauthor, which by default generates a 
chapter marker for each segment which works out pretty nicely.

> Note:
> 1) This is all just a proof of concept.
> 2) avidemux needs X to operate and will popup all sorts of annoying
>    progress windows during processing.

Yah, I wish avidemux2 had a more pure commandline mode, but I guess we're 
lucky to even have what it does. My homebrew method for making DVDs has been 
working so well I haven't had time to polish it up or integrate it better. I 
have no doubt somebody will beat me to it. ;)

> Hope this helps,
> Regards,
> Paul
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/yS4fT8BYaKRUpkQRAgcCAJ9Hsl/BqHBv87ZMY6n1RrHoRN20CQCfeakw
/q5MckfF1AIW6NzsR4xJYbw=
=wH7U
-----END PGP SIGNATURE-----




More information about the mythtv-users mailing list