2

I have a divx video of 10 mins. I want to copy two parts from it , minutes 2 to 6 and 8 to 10 and create another video by merging the two. how can I do it using lightweight command line tools. Either on Windows or Linux?

2 Answers 2

3

Perhaps ffmpeg/mencoder (available on either platform).

To split:

ffmpeg -ss [start_seconds] -i [input_file] -t [duration_seconds] [outputfile]

For example:

ffmpeg -ss 2 -i input.avi -c copy -t 4 video1.avi
ffmpeg -ss 8 -i input.avi -c copy -t 2 video2.avi

To merge:

mencoder -ovc copy -oac copy video1.avi video2.avi -o output.avi

If your video/audio is out of synchronization, you might need to re-encode them, e.g. with XviD for an AVI container, and MP3 audio:

ffmpeg -ss 2 -i input.avi -c:v libxvid -qscale:v 3 -c:a libmp3lame -q:a 3 -t 2 output.avi

Change the qscale parameter to a lower value for higher quality, and the same for q:a for the audio parts.

4
  • does it work on divx encoded videos? let me check..
    – iceman
    Nov 26, 2009 at 20:20
  • small corrections ; -t duration' : Restrict the transcoded/captured video sequence to the duration specified in seconds. hh:mm:ss[.xxx] syntax is also supported. -ss position' : Seek to given time position in seconds. hh:mm:ss[.xxx] syntax is also supported. Itried this and it worked but the video and the audio are time shifted and also there's a big difference in the original and output quality.The output's very degraded. DivX is a variant of MPEG4 hence we can ffmpeg as it can produce MPEG4 on its own
    – iceman
    Nov 26, 2009 at 21:03
  • I left out the hh:mm:ss given the context of your answer. I admit, I tried this in a ssh connection to home. Didn't verify the quality. Perhaps try doing it all w/ mencoder?
    – basszero
    Nov 28, 2009 at 14:35
  • the video and the audio are time shifted
    – iceman
    Dec 27, 2009 at 9:01
0

To split the video there's a hand command line tool called jumptheshark.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .