Discussion:
[Tutor] Can one use python to concatenate n media files?
Fast Primes
2015-10-12 04:15:00 UTC
Permalink
If so, could someone present an example?

Thanks.

Sent from Mail for Windows 10
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Emile van Sebille
2015-10-12 14:21:57 UTC
Permalink
Post by Fast Primes
If so, could someone present an example?
<untested>
target = open(target,'wb')
for source in mediafilelist:
target.write(open(source,'rb').read())

But you probably want something different anyway.

Emile



_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Alan Gauld
2015-10-12 18:12:39 UTC
Permalink
Post by Fast Primes
If so, could someone present an example?
Yes, and Emile has shown how for a trivial, pure
binary case.

But to make the catenation sensible you need to know
the file type. Many media files hold the actual media
data inside an envelope of header information. To do
a sensible job you need to know where the data starts
and how you want to process the meta data in the headers.

It's all possible and helper modules exist for many types
of file/metadata. But without knowing the types of
media you are trying to catenate its effectively
impossible to give working examples.

And if you want to catenate different types of media
file (eg a .WMA, an .MP3 and a .AU) then you also need
to do data conversions etc. Its all possible but
its mostly non trivial.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Loading...