I use ffmpeg because I want to do video editing without re-encoding. I only know the bare bones options for this though:

ffmpeg -i input.mp4 -ss 00:00:30 -to 00:05:00 -acodec copy -vcodec copy output.mp4

The audio, for the output of the above command, starts at 30 seconds, however this video only starts at the next i-frame after the 30 second mark, sometimes this might even be around 33 seconds.

Using -ss as input option together with -c:v copy might not be accurate since ffmpeg is forced to only use/split on i-frames. Though it will—if possible—adjust the start time of the stream to a negative value to compensate for that. Basically, if you specify "second 157" and there is no key frame until second 159, it will include two seconds of audio (with no video) at the start, then will start from the first key frame. So be careful when splitting and doing codec copy. https://trac.ffmpeg.org/wiki/Seeking

This is quite annoying, to have audio playing and be waiting for the video.

Is there a way to seek the audio to the same timestamp as the first video time?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.