0

Given mkv file with 4 streams - video hevc, audio, subtitles and mjpeg with image. I'd like to delay audio which is out of sync when played. When trying to do that with e.g. -itsoffset as explained in In ffmpeg, how to delay only the audio of a .mp4 video without converting the audio? I'm facing two issues. If I exclude mjpeg, during playback I've got freezes lasting several seconds when seeking a minute forward (not happening in original). When I keep all streams including mjpeg I'm getting silence depending on length of output (sometimes complete, sometimes only after 3 seeks forward).

E.g.

ffmpeg -i f.mkv -c copy -map 0 -to 0:26:0 t0.mkv - as original.

ffmpeg -i f.mkv -i f.mkv -c copy -map 0:0 -map 1:1 -map 0:2 -map 0:3 -to 0:5:0 t1.mkv - freezes for several seconds when seek 1 minute forward

ffmpeg -i f.mkv -i f.mkv -c copy -map 0:0 -map 1:1 -map 0:2 -map 0:3 -to 0:15:0 t2.mkv - no freezes but silent

Both 5 and 15 minutes with two inputs print Starting new cluster due to timestamp twice (no such line when only one input file). When I compare resultant files with ffmpeg -i, I don't see much difference.

What could cause such strange results? What to try to do to fix the above? I'd like to have non-freezing playback with sound.

Edit: when I started playback of the silent output file from the command line the printout included "Too many packets in the demuxer packet queues" as opposed to non-silent file.

I was able to successfully process the file with mkvmerge -o out.mkv -y 1:100 f.mkv, where ID:100 is delay in milliseconds for stream ID which can be found via mkvmerge --identify f.mkv.

I got the hint from https://www.reddit.com/r/ffmpeg/comments/brrj5i/troubleshootingfeedback_request_audio_downmix/ where mkvmerge was mentioned in response to the issue of "Too many packets in the demuxer packet queues".

0 Answers0