Audio track out sync after editing MP4

Started by Kibu, June 17, 2018, 09:12:57 AM

Previous topic - Next topic

Kibu

hi,

I'm using ffmpeg to concat and transform ts videos into mp4. Also I let move the metadata (title and so on) to the beginning of the mp4 video for better handling with dlna clients. This works OK so far.
When I now edit the mp4 cutting off trailing and leading parts and save it as mp4, audio is behind video track for about 1 second. This does not happen if I dont't move metadata to the beginning of the video. For target format I'm using copy for audio, video and MP4 muxer with default settings.
I'm using avidemux  2.7.1 on ubuntu 18.04.
Any ideas ?
TIA
Kibu

eumagga0x2a

Please provide a sample without moving metadata and the same source with metadata moved to the start of the file. Meanwhile, you should be able to compensate using a negative audio shift of 1000 ms.

Kibu

#2
I have to correct my last posting. I made a new test without generating/moving metadata and the effect is the same. Don't know if it's a good idea to upload dozens of MB video data here. But you can reproduce it. Take a ts file (generated by vdr recording tool), transform it with
ffmpeg -i video.ts c:a copy -c:v copy [-copyts -movflags -faststart -metadata title="Some Title"] -f mp4 -y video.mp4
The attributes in brackets generate the metadata and move them to the start.
When playing the result with avidemux, you can see the video / audio time offset. When I first transform and cut the ts file with avidemux into mp4 and then madd/move the moov atom part to the start with ffmpeg, video and audo have no offset.

Kibu

eumagga0x2a

I can confirm the issue, but I am not sure that Avidemux is at fault here. parseElst reports that ffmpeg (here: version 4.0.1) specifies a huge audio delay. This happens only when muxing to MP4, a ffmpeg-generated MKV doesn't exhibit the problem.