retrixe/coupe-video

inaccurate ffmpeg seek occasionally causes video to start frozen for few seconds

Opened this issue · 2 comments

Sometimes ffmpeg leaves the first few seconds showing only a single frame with working audio, e.g.

test.mp4

Using accurate seek seems to need transcoding, we need to look into accurate seeking with stream copy as transcoding is far too slow to perform.

https://trac.ffmpeg.org/wiki/Seeking#Cuttingsmallsections
ffmpeg -ss 00:01:00 -i video.mp4 -to 00:02:00 -c copy cut.mp4 works fairly well, we just need to use some maths to compute -to.
We currently use ffmpeg -i video.mp4 -ss 00:01:00 -to 00:02:00 -c copy cut.mp4.

Hmm, looks like putting -ss first causes audio desyncing.