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. 😉
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.
Glad I could help.
does this command delete the source file ???
No this doesn’t delete the source file.
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
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.
This gave me troubles until i found your post, I put -ss first and it worked perfectly x
ffmpeg -ss 00:00:00 -i input.mp4 -vcodec copy -acodec copy -t 02:51:23 output.mp4
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.
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**
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
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.
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
Please see this article also
http://joms3.com/articles/data/Cutting_video_file_using_ffmpeg_command_in_Ubuntu_server.php
Thank you. Exactly what i was looking for. Simple solutions are the best!