Dik,

Sorry, I made a mistake in the first example (untested code, you
know). I tested this one, it works:

#!/bin/python
import mpeg,sys
in_filenames=sys.argv[1:-1]
out_filename=sys.argv[-1]
 
in_mpegs=map(mpeg.MpegFile,in_filenames)
reduce(lambda a,b: a+b, in_mpegs).to_file(out_filename)

On Mon, 13 Dec 2004 23:10:17 -0600, Mark Rages <[EMAIL PROTECTED]> wrote:
> On Tue, 14 Dec 2004 00:26:36 +0100 (CET), Dik Takken
> <[EMAIL PROTECTED]> wrote:
> > On Mon, 13 Dec 2004, Mark Rages wrote:
> >
> > > It is also possible to do simple cut/paste editing on MPEG without
> > > re-encoding.  I have a Python library for doing so:
> > >
> > > http://mlug.missouri.edu/~markrages/software/python_mpeg/
> >
> > Wow, that looks interesting. Too bad I don't know any Python. Can this
> > thing join MPEG2 files in a way that does not confuse any set-top DVD
> > players? DVDAuthor can also join MPEG2 files, but some DVD players choke
> > on it because it's not done proper. I guess it's done proper once you
> > can't distinguish an MPEG2 stream that has been split and re-joined
> > from an MPEG2 stream that hasn't been touched.
> 
> Limitations:
> 1) The library only works with elementary stream files.  That means
> you'll need to demux.
> 2) Audio must be in .wav format.  I don't know how to split mp3 and
> ac3 at arbitrary frame points. Audio should have the same name as the
> MPEG file, but a .wav extension.
> 
> > Could you tell a bit more about this python library? Would it be difficult
> > to write a basic commandline front end that can join two MPEG2 files, or
> > split a stream at a certain frame (or nearest GOP border)?
> 
> Here's one that will join MPEG2 files:
> 
> #!/bin/python
> import mpeg,sys
> in_filenames=sys.argv[1:-2]
> out_filename=sys.argv[-1]
> 
> in_mpegs=map(mpeg.MpegFile,in_filenames)
> reduce(in_mpegs).to_file(out_filename)
> 
> Here's one to split a stream at a frame:
> 
> #!/bin/python
> import mpeg,sys
> in_filename, splitpoint, out_filename1, out_filename2=sys.argv[1:]
> 
> m=mpeg.MpegFile(in_filename)
> m[:splitpoint].to_file(out_filename1)
> m[splitpoint:].to_file(out_filename2)
> 
> There's an example on the web page I think.
> 
> Regards,
> Mark
> [EMAIL PROTECTED]
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users

Reply via email to