0
I'm trying to trim a video from a given initial point in time and a duration. However, after researching, it seems that ffmpeg's seek accuracy is not sufficient most of the times, unless the video stream is re-encoded.
- Is there an efficient way to seek accurately without re-encoding, on most files?
- It seems odd since Windows Media Player succeeds in this task most of the time.
What are they implementing differently?
Edit:
For example, given sample.mp4 5 seconds long:
Working (with transcoding)
ffmpeg -ss 00:00:03 -t 1 -i sample.mp4 -c:v libx264 -movflags +faststart -c:a aac -strict -2 -b:a 192k out.mp4
Not working (without transcoding) - Will produce a video from the start of the file.
ffmpeg -ss 00:00:03 -t 1 -i sample.mp4 -c:v copy -c:a copy out.mp4
ffmpeg version used: 2.8.4
Through practice, I've found that adding the seeking option after the input was in some cases more precise than using fast-seeking (before). It'll be much slower since the file has to be decoded up to your seek point, but try
ffmpeg -i input.mp4 -ss xx:xx:xx
instead of putting the-ss
before the input. – Ely – 2016-04-12T19:24:13.443Please see http://superuser.com/questions/458761/accurately-cut-video-files-from-command-line/458804#458804 — also, what exactly have you tried with ffmpeg? How did it fail? Which version did you use? (Ideally, show the command-line output.) If you could [edit] your post to include a more specific question, we can help you better. Note that WMP will likely re-encode the file, which makes accurate seeking easy.
– slhck – 2016-04-13T08:38:13.163