Jump to content

If you ever need to cut a few seconds at the beginning or end of a video file, do it in FFmpeg.

Most programs will re-encode the entire file if you cut it, which results in really long processing times (the file has to be transcoded) and it reduces the quality of the video. With this one line command you can do it in a few seconds with no quality loss:

 

ffmpeg -i INPUTFILE.mp4 -vcodec copy -acodec copy -ss 00:00:00.000 -t 00:00:00.000 OUTPUTFILE.mp4

 

Replace "INPUTFILE.mp4" with the name of the video (or entire path if it's not in the same folder as FFmpeg).

Replace the 00:00:00.000 with the time you want. -ss is when the video should start, and -t is when the video should end.

 

For example:

ffmpeg -i Overwatch-GamePlay.mkv -vcodec copy -acodec copy -ss 00:01:04.000 -t 00:10:03.000 PlayOfTheGame.mp4

 

That will take the video "Overwatch-GamePlay.mkv", and crop out the part between 1 minute and 4 seconds, until 10 minutes and 3 seconds, and create a lossless, shorter video, in seconds.

 

Don't be stupid like me and mess around in non-linear video editors.

  1. TVwazhere

    TVwazhere

    Good info for my Dashcam videos! 

  2. Windows7ge

    Windows7ge

    What are the chances this works with audio too?

  3. LAwLz

    LAwLz

    Seems to work but I have no way of checking if it's actually 1:1.

    The speed of processing the audio certainly seems to indicate that it's just cutting and not transcoding. Cutting out 20 seconds of a song was essentially instantaneous for me.

     

    Try it out for yourself if you want (changed the command slightly to leave out the video related stuff):

    ffmpeg -i INPUT.m4a -c copy -ss 00:25 -t 00:55 OUTPUT.m4a

  4. Windows7ge

    Windows7ge

    Not frequently but on occasion I wish I could crop video & audio. If a simple terminal app can accomplish that that's perfect. Most of my video/audio is compressed .mp3/.mp4 though so I'll have to see how it handles that.

×