I am trying to trim many smaller videos out of one big video. I have watched the entire big video using VLC and noted the time index where each video stops and starts.

Next, I use ffmpeg to trim each small video:

ffmpeg -ss 00:43:58 -i big_video.mp4 -v copy -t 1:00 small_video.mp4

While the duration for each video is correct, the start time is off by about a minute. Note this is not the issue where ffmpeg starts at the nearest keyframe. If I manually compensate the start time, the clip is trimmed correctly.

If I use ffplay as follows to skip to the starting point in the video, it also starts about one minute ahead:

ffplay -ss 00:44:58 big_video.mp4

I then verified my timestamps in VLC, and they are correct. It seems that there is some sort of difference between how VLC and ffmpeg seek in the index? Or maybe even that the index is corrupted in some way. How can I fix this?

  • When viewing certain parts of the video with ffplay, it seems some parts play a bit faster as they should. In VLC this does not happen. The passage of time as indicated by each player remains constant, so this explains at least where the discrepancy is. Different parts of the video happen at a different time index when comparing between ffplay/ffmpeg and VLC. The discrepancy becomes bigger after more time passes. Not yet sure what causes this though... Commented Sep 27, 2020 at 9:36
  • Eventually, I noted down time stamps again while playing via ffplay. The following command displays timestamps while playing: ffplay -vf "drawtext=text='%{pts\:hms}':box=1:x=(w-tw)/2:y=h-(2*lh)" input.mp4 Commented Sep 27, 2020 at 10:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.