If I have a video, normally avi, but could be any, and I want to create another one in the same format but just a part, the position i seconds to f seconds into the video, what is the one-line command to do this?
If I have a video, normally avi, but could be any, and I want to create another one in the same format but just a part, the position i seconds to f seconds into the video, what is the one-line command to do this?
This can be done using mencoder
or ffmpeg
.
Say that you want to cut out a part starting at 00:00:30 into the original file with a 5 seconds length and that it shouldn't be reencoded (if you want to re-encode it you'll have to replace copy
with audio and video codecs, for a list of available audio codecs issue mencoder -oac help
, for a list of available video codecs issue mencoder -ovc help
), then you issue:
mencoder -ss 00:30:00 -endpos 00:00:05 -oac pcm -ovc copy originalfile -o newfile
You'll have to replace orginalfile
and newfile
with actual file names, the latter is the name of the file that is created to hold the cut-out part.
Say that you want to cut out a part starting at 00:00:30 into the original file with a 5 seconds length and that it shouldn't be re-encoded (if you want to re-encode it you'll have to replace copy
with audio and video codecs, for a list of available codecs issue ffmpeg -formats -E
), then you issue:
ffmpeg -ss 00:00:30 -i orginalfile -t 00:00:05 -vcodec copy -acodec copy newfile
You'll have to replace orginalfile
and newfile
with actual file names, the later is the name of the file that is created to hold the cut out part.
For reference see http://lazyxiong-tech.blogspot.com/2007/05/using-mencoder-to-cut-out-pieces-of.html and "7. Copy Only A Part Of Video" in http://segfault.in/2010/10/ffmpeg-tricks-you-should-know-about/