[MPlayer-users] Splitting and Rejoining Movies

Richard Tweedie rich at tweedie.org.uk
Sat Jan 3 12:37:47 CET 2004

D. Starner wrote:

>[Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
>I taped a movie from cable recently, and took it to a friend's house over Christmas 
>and transferred it to MPEG2. I then tried to encode it to MPEG4 in three sections, 
>so I could delogo it only where necessary, like so.
>mencoder  -endpos 595  -nosound -ovc lavc -lavcopts vcodec=mpeg4:gray:vbitrate=1250: -oac copy Noname-002.mpg -o Cops/Sect2.avi
>mencoder -ss 595 -endpos 32  -nosound -ovc lavc -lavcopts vcodec=mpeg4:gray:vbitrate=1250 -vf delogo=530:390:130:35 -oac copy Noname-002.mpg -o Cops/Sect3.avi
>mencoder  -ss  627  -nosound -ovc lavc -lavcopts vcodec=mpeg4:gray:vbitrate=1250 -oac copy Noname-002.mpg -o Cops/Sect4.avi
>(Slightly simplified; the actual run was two pass, among other things.)
>The problem is, the end of Sect2 is not the start of Sect3; -endpos 595 doesn't match 
>-ss 595. I don't care if I delogo a few seconds of movie that didn't need to be delogoed, 
>but I need the end of Sect2 to match up exactly to the start of Sect3. I think the 
>problem lies in the messages "demux_mpg: 24fps progressive NTSC content detected, 
>switching framerate." and "1 duplicate frame(s)!" that mencoder spits out when reading 
>the MPEG2 input. How do I match the ends of Sect2 and Sect3 up right? I don't care if I 
>delogo a few seconds of movie that didn't need to be delogoed, but I need the end of 
>Sect2 to match up exactly to the start of Sect3.
This question has been asked quite a lot, the problem, in a nutshell, is 
because of key frames.  I am no expert on this stuff but basically, a 
keyframe is a full image representation of the frame, frames following 
this frame may provide only parts of the image that have changed - 
there's more to it than that but I'm not the man to explain it.  When 
you split a movie you must split it at a keyframe, mencoder lets you 
split the movie at any point, using -endpos, but it will only start a 
movie at a keyframe, using -ss, (I'm guessing this bit).  So, to use 
mencoder to split a movie you must guess exactly where a keyframe is 
otherwise you'll be missing a bit!  The solution to this is to use a 
different program to split the avi.  I use avidemux 

If anyone else knows a different/better way of splitting the movie 
(preferably using mencoder) I'd like to know as well.



Ps.  If the movie was correctly split at a keyframe, you can use 
mencoder to rejoin the separate files and it'll be seamless

More information about the MPlayer-users mailing list