Let's say I need to remove everything but the second minute from a video.
I can do this, for example, in the following way:
ffmpeg -copyts -ss <start> -i input.mp4 -to <end> -c:v libx264 -crf 23 -c:a aac -b:a 192k output.mp4
I am interested in whether the -ss
should be before or after the -i
.
I have read all the answers and comments here and here. From what I read there, it seems that in older versions of FFmpeg, before 2.1, placing -ss
before -i
was for faster processing, while placing -ss
after -i
was for more accurate processing, but in newer versions, placing -ss
before -i
is not only for faster processing, but also for more accurate processing.
But on the other hand, the sections “Input seeking” and “Output seeking” here don't mention this nuance, and after reading them I'm not so sure that putting -ss
before -i
is "the one and only solution".
Could someone explain this? (What I want from processing is accuracy. I don't care how long it will take.)
-ss
should be before the-i
, because it is faster, and has the same accuracy as after the-i
. Without re-encoding should also work:ffmpeg -ss <start> -i input.mp4 -to <end> -c copy output.mp4
(in most cases).-preset ultrafast
to make it a little faster. (No quality loss)-ss
should be before the-i
' - And are there cases in which-ss
should be after-i
?-ss
before the-i
gives an error message, try placing it after the-i
. In all other cases, I assume it is recommended placing it before the-i
(as far as I know), assuming you FFmpeg version is not too old... Can you please be more specific on you objectives? Is your only objective is cutting a part of a video, or are there other objectives? Do you know how to check if the cutting is accurate?ffmpeg -y -f lavfi -r 10 -i testsrc=size=192x108:rate=1:duration=500 -vf setpts=N/10/TB -c:v libx264 -pix_fmt yuv420p input.mp4
. I don't know how to test the audio cutting accuracy. I suggest you to do some research, and figure out how to test it.