[FFmpeg-user] Inaccurate trimming with re-encoding
cmharwoo at umich.edu
Sat Aug 3 01:59:13 CEST 2013
I'm a fairly new ffmpeg user, but I've found it really helpful for
processing videos as part of my graduate research. I've got a mess of videos
(recordings of experiments from different angles) that I'm trying to
synchronize. I coded my data acquisition system such that an LED turns on
when I begin collecting data, giving me a visual indicator of where I can
sync the videos, which should be accurate to within ~1/2 frame.
So I've got a script to trim my videos to the frames at which I see the LED
turn on (in HH:MM:SS[.ms] format). I tried it with -vcodec copy, but
(predictably) I found my outputs began at the nearest I-frame, up to 1s away
from my desired trim point.
My understanding is that, if I re-encode, I should be able to trim at
exactly the desired time and place an I-frame at the beginning of the saved
output. An example command is using a gopro video shot at 59.94 fps, with
ffmpeg -t 30 -i GOPR0103.mp4 -vcodec libx264 –threads 0 -preset ultrafast
-an -y -ss 00:03:09[.606] Run041_UW1.avi
Here's where I'm confused. If I execute the above command, I do get a
trimmed output, but the resulting video starts 40 frames away from the
desired frame. In contrast, if I use -vcodec copy on the same file, the
output is only off by ~26 frames.
What am I doing wrong here? Is there any way for me to get frame-accurate
splitting? I'm okay with re-encoding if that's what it takes. I have about
800 videos to chew through, but I can run my lab workstation for a week
straight to get it done.
Thanks very much!
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Inaccurate-trimming-with-re-encoding-tp4660437.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.
More information about the ffmpeg-user