Hello
I'm using the latest and greatest (ffmpeg N-79690-g78baa45).
For some reason, the following doesn't work as expected: Instead of slicing the video after 5mn, it keeps going for 10:
Same result:Code:ffmpeg -ss 00:15:17 -i input.mp4 -to 00:20:17 -c copy -threads 2 -f mp4 output.mp4
Any idea why? Did the ffmpeg team changed the meaning of the -to switch?Code:ffmpeg -ss 00:15:17 -i input.mp4 -to 00:20:17 -c:v libx264 -pix_fmt yuv420p -c:a copy -threads 2 -f mp4 output.mp4
Thank you.
+ Reply to Thread
Results 1 to 6 of 6
-
Last edited by yetanotherlogin; 2nd Sep 2016 at 04:19.
-
Try:
Code:ffmpeg -ss 00:15:17 -i input.mp4 -t 00:05:00 -c copy -threads 2 -f mp4 output.mp4
Got my retirement plans all set. Looks like I only have to work another 5 years after I die........ -
I find that -to only works when -ss is entered as an output option.
-
Thanks. I don't want to use the -t option because the -to option lets me just type the end of the segment without having to compute how long it lasts.
Why does it matter where I put the -ss and -to options?
Here, they're put before the -i option:
http://ffmpeg.io/howto
Here, they're after:
http://stackoverflow.com/questions/18444194/cutting-the-videos-based-on-start-and-end-...e-using-ffmpeg
---
Edit: Here's the explanation:
https://trac.ffmpeg.org/wiki/SeekingLast edited by yetanotherlogin; 2nd Sep 2016 at 04:18.
-
"Thanks. I don't want to use the -t option because the -to option lets me just type the end of the segment without having to compute how long it lasts. Why does it matter where I put the -ss and -to options?"
The -ss option can be either an input option or an output option. The -to option and -t option are only output options.
If you use -ss and -to both on the output, then -to will work as you expect. The downside is that it will filter and encode all of the frames from the beginning of the file, then throw them out until the start time in -ss. Just a timewaster, but -to then works.
If you use -ss before -i, then those frames are thrown away before processing, so the output never sees those frames. So as far as the -to can tell, the video is that much shorter and started at 0, instead of started at the -ss time.
Want a clip from src video that starts at 2:30 and ends at 7:30...
ffmpeg -i src.mpg <encode options> -ss 00:02:30 -to 00:07:30 dst.mpg
ffmpeg -i src.mpg <encode options> -ss 00:02:30 -t 00:05:00 dst.mpg
ffmpeg -i src.mpg <encode options> -ss 00:02:30 -t 300 dst.mpg
ffmpeg -ss 00:02:30 -i src.mpg <encode options> -t 300 dst.mpg
All but the last command process frames from the start of the file then drops them in the very last step before writing; the last command instead throws out those frames (very quickly) before processing and starts processing frames beginning with the -ss time.
ffpmeg -
It doesn't matter if you use -t it - to. If you use -ss as an input it resets the timecode to 0 so -t and - to then means to a point from the ss point starting at 0. It is further complicated by the fact that if you use -c copy, ffmpeg will cut at a key frame but your first frame may not have a timecode of 0. This may play ok on some players but give problems if you try to merge it to another segment, even with the same parameters.
There is a way to do it with -vframes that works but it is tricky also.Last edited by Budman1; 13th May 2018 at 22:36.
Similar Threads
-
FFMpeg 's -qscale switch/option help
By TorBru in forum Video ConversionReplies: 1Last Post: 29th Oct 2014, 07:42 -
Feature request: Ignore list enhancement
By Selur in forum FeedbackReplies: 11Last Post: 9th Jul 2014, 13:07 -
Ignore the default embedded subtitles
By beycan in forum SubtitleReplies: 2Last Post: 28th Nov 2013, 21:19 -
ignore
By VanZan in forum TestReplies: 4Last Post: 20th Dec 2012, 14:32 -
FFmpeg Runtime error / FFmpeg git-df82454 32-bit Static (2012-10-03)
By MashedPotatoes in forum Newbie / General discussionsReplies: 5Last Post: 6th Oct 2012, 17:22