Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

moved the input file before the start time to improve precision #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

e-massa
Copy link

@e-massa e-massa commented Feb 24, 2015

The behaviour of ffmpeg depends on the order of the command line arguments and I found that when trimming a clip the precision on the start time and duration is much improved when the input file is given as an argument before the start time and end time.

For example during my test the command:

ffmpeg -y -ss 1 -t 3 -i input.mp4 -strict -2 output.mp4

trim a clip with 4 seconds duration while the command:

ffmpeg -y -i input.mp4 -ss 1 -t 3 -strict -2 output.mp4

output a video with exactly 3 seconds duration.

Therefore I suggest this small change to the code or at least to give the option to reorder the arguments if needed.

@shutup
Copy link

shutup commented May 2, 2016

@e-massa i think the time depends on the video itself,for some video ,all frame is key frame,so it can be very exactly,but others may be not ,so the best solution is to convert the video frames to all key frames,and then clip it .the word key frame may be not correct ,but i just mean it.
you can try the following cmd to convert the video frame to all key frame.

//for older ffmpeg
ffmpeg -i INPUT -sameq -intra OUTPUT
//for new ffmpeg like 3.0+
ffmpeg -i output.mp4 -strict -2  -qscale 0 -intra keyoutput.mp4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants