ffmpeg video cutting error: out of sync audio
Solution 1:
Because of Keyframes, combining -ss
and -t
options with -c copy
, results in unsynchronizing video and/or imprecise duration.
Better is to have one cycle of decode/encode (although it results some quality loss) to get better timing . Cutting and converting at the same time is a better option and don't have above mentioned cons.
Solution 2:
I had a similar problem and it was solved in the following way, maybe it helps future readers.
ffmpeg -i test.mp4 -ss 2 -to 10 -c:v copy -c:a aac out.mp4
That is, I reencoded the audio. With this the audio was in sync.
I don't think it makes a difference but note that my usecase needed the -to
option instead of -t
.