When converting a recording that lasts approximately 1 hour and 40 minutes from mjr files to MP4, I encounter audio‑video synchronization issues toward the end of the recording.
Here’s my workflow:
I have two files: audio.mjr and video.mjr.
Using janus-pp-rec, I convert them into audio.opus and video.mp4.
Then, using ffmpeg, I merge them into a single file: record.mp4.
When playing back record.mp4, the audio and video remain synchronized for the first 45 minutes. However, gradually, the video starts to lag behind the audio. By the end of the recording, the desynchronization reaches 1–2 seconds.
Has anyone encountered this issue? How did you manage to resolve it?
First of all, you should check the start times of both recordings, which is part of the metadata you can extract from MJR files. If, for instance, the audio file was creared a second later, it’s up to you to shift it when mixing/muxing multiple files together. Another thing to pay attention to is when the first keyframe appears in the video (another info MJR files give you when you parse them), as that would mark the actual start of the video file, and so external shifting would need to happen in that case too.
Otherwise, have a look at the audioskew/distance/restamp options in janus-pp-rec, which can help with correcting the timing of audio packets if skewing happened there that impacted RTP timestamps. You’ll have to play with different values to see if the output changes.