Combining music or video files?

Python.Arno python at rgbaz.eu
Mon Jun 16 09:49:00 CEST 2008


On 16 jun 2008, at 05:55, Jason Scheirer wrote:

> On Jun 15, 7:53 pm, John Salerno <johnj... at gmailNOSPAM.com> wrote:
>> Before I try this and destroy my computer :) I just wanted to see if
>> this would even work at all. Is it possible to read a binary file  
>> such
>> as an mp3 or an avi, put its contents into a new file, then read  
>> another
>> such file and append its contents to this same new file as well,  
>> thereby
>> making, for example, a single long video instead of two smaller ones?
>>
>> Thanks.
>
> This works with basic mpeg videos, but pretty much nothing else.
> You're going to need some video editing software.

you can't just edit mpeg (including mp3)...
mpeg is a stream. it sets a "key" frame for the first frame
followed by motion vectors from the changes from that frame
until the next keyframe.
If you cut in the middle of the vectors the keyframe is lost
and the vector frames don;t make any sense anymore.

avi is not a video codec, it's a container like quicktime.
so it depends...

I come from a Mac background and use quicktime a lot.
there are some basic editing features that quicktime can do.
And Apple has a nice quicktime python module in OSX.
I bet there's something for windows too...

best thing to do is convert the video o a framesequence and
the audio to an uncompressed format like wav or aiff
then combine in quicktime or <something in windows>

cheers,
Arno







More information about the Python-list mailing list