HowTo: Cut a video directly with ffmpeg, without re-encoding

You only need the -ss and -t options. -ss is the starttime and -t the duration, so if you want 10 seconds from a video starting from minute one, you would use this.

ffmpeg -i INFILE.mp4 -vcodec copy -acodec copy -ss 00:01:00.000 -t 00:00:10.000 OUTFILE.mp4

You can use seconds or hh:mm:ss[.xxx] as arguments for the start time and duration, i prefer the second option.
The options -vcodec copy and -acodec copy are used to only cut the video and disable the re-encoding, this really speed things up. 😉

Advertisements
This entry was posted in ffmpeg and tagged , , , , , , . Bookmark the permalink.

12 Responses to HowTo: Cut a video directly with ffmpeg, without re-encoding

  1. Brother says:

    This command is Best of all sort of solutions I was seeking for. Thanks dude a lot. This was what I was looking for, without installing anything new on my system, and without losing the original video by encoding.

  2. Anonymous says:

    does this command delete the source file ???

  3. caroline says:

    when the “from”(start_seconds) variable is larger than 107seconds it doesn’t work for me. I run this:
    ffmpeg -ss 00:02:47.0 -t 00:00:30.0 -i tamta.wmv -acodec copy -async 1 carolTest2.wmv
    and the video isn’t created correct.i just hear a sound for 1second with no video. did i do something wrong?
    generally all commands don’t work when start_seconds are larger than 107 seconds

    • sgcdffd@sharklasers.com says:

      This command-line is actually wrong: you need to put the -ss before the -i or ffmpeg will report success but produce a corrupt file.

  4. Pingback: Videos mit FFmpeg schneiden | FinnChristiansen.de

  5. Knut says:

    Hm, this is not the first time that I read this blogpost. It was always exactly what I was looking for. Maybe I should bookmark it. But google also finds it reliably.

  6. Ben Wong says:

    Synopsis:
    ffmpeg -i [input_file] -ss [start_seconds] -t [duration_seconds] [output_file]

    **use FFmpeg cut mp4 video without re-encoding**

    Example:
    ffmpeg -i source.mp4 -ss 00:00:05 -t 00:00:10 -c copy cut_video.mp4

    **use FFmpeg cut mp4 video with re-encoding**

    Example:
    ffmpeg -i source.mp4 -ss 00:00:05 -t 00:00:10 -async 1 -strict -2 cut_video.mp4

    To see more detailed, see this post [How to cut video with FFmpeg on windows 7][1]

    [1]: http://www.sthshare.com/wordpress/how-to-cut-video-with-ffmpeg-on-windows-7.html

  7. Pingback: Повседневные задачи с видео | Crafting.be

  8. Anonymous says:

    So, I noticed the cut file is actually transcoded from the source file. Any way to accomplish this without the transcoding? I really just need to extract 3 minutes from a long video — without modifying the original encoding.

  9. Anonymous says:

    Thank you so much for this! However, I noticed that using this line directly as given leaves off the first few seconds of the segment I’m trying to cut out. Using sgcdffd’s suggestion to put the -ss before the -i gave the more accurate start time and recording time for me.

    This is what worked better for me:

    ffmpeg -ss 00:01:00.000 -t 00:00:10.000 -i INFILE.mp4 -vcodec copy -acodec copy OUTFILE.mp4

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s