Home » Questions » Computers [ Ask a new question ]

Command line tools for copying parts of video

Command line tools for copying parts of video

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?

Asked by: Guest | Views: 315
Total answers/comments: 1
Guest [Entry]

"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."