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
orffmpeg
.mencoder
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 issuemencoder -oac help
, for a list of available video codecs issuemencoder -ovc help
), then you issue:You'll have to replace
orginalfile
andnewfile
with actual file names, the latter is the name of the file that is created to hold the cut-out part.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 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 issueffmpeg -formats -E
), then you issue:You'll have to replace
orginalfile
andnewfile
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/
Do you need to cut video with re-encoding or without re-encoding mode? You can try to following below command.
Synopsis: ffmpeg -i [input_file] -ss [start_seconds] -t [duration_seconds] [output_file]
use FFmpeg cut mp4 video without re-encoding
use FFmpeg cut mp4 video with re-encoding
If you want to cut off section from the beginning, simply drop
-t 00:00:10
from the commandmedipack is a very simple command-line app as a wrapper over
ffmpeg
.you can achieve trimming your video using these commands:
you can view options of trim subcommand as:
you could also explore other options using
medipack -h
you may visit https://github.com/srbcheema1/medipack and checkout examples in README.
To be more precise you can: MANUALLY Open the file in a media player that will frame by frame advance (potplayer my favorite but MPC-HC works)and play an AVISynth file with data such as:
Then cut with the EXACT time format:
and
If you wish to join, make a txt file with the video files with contents like:
Run
ffmpeg
:PROGRAMMATICALLY I wrote a program but have no level 10 to show it, sorry