GNOME Bugzilla – Bug 602936
[ mp4mux] Lipsync issue when converting mkv to mp4 using h264/aac
Last modified: 2010-08-14 13:12:38 UTC
Created attachment 148443 [details] [review] Thiago's use timestamp patch With the current git version of gst-plugins-bad the following gst-launch line will give an unsynced mp4 using a synched mkv: gst-launch -v filesrc location=p.mkv ! matroskademux name=d mp4mux name=m ! filesink location=p.mp4 d.video_00 ! queue ! m.video_00 d.audio_00 ! queue ! m.audio_00 The sync issue was/is related to the way matroska uses durations. Durations are constant and ts_now + duration != ts_next. This did cause problems in qtmux which earlier always used durations. Thiago sent me a patch (that is attached) that checks if the duration if the timestamps are unordered. In all other cases the buffer timestamps are used. During my muxtests the patch has shown a great improvement and three out of four conversions works flawless and the video/audio is synced. But there is still one clip that fails for some reason. The clip is available here: http://bachman.rxtx.se/tmp/muxtest/p.mkv (synced matroska) http://bachman.rxtx.se/tmp/muxtest/p.mp4 (unsynced mp4muxed mp4)
Module: gst-plugins-bad Branch: master Commit: b343536de022a33bea6a3e774298c0c2c3e445a7 URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=b343536de022a33bea6a3e774298c0c2c3e445a7 Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk> Date: Wed Nov 25 21:41:27 2009 -0300 qtmux: replace _scale with _scale_round Use the rounding version for improved sync between streams. Small variations in the duration when muxing might lead to cumullative wrong timestamping when demuxing. Fixes #602936
I have pulled the latest qtmux from git and it hasn't made any difference. Still the sound is (a bit ahead) out of sync while playing the mp4. This is 1/5 mp4 files that wasn't generated successfully. Somebody else need to first carefully watch the mkv, and then watch the mp4 and verify the difference in sync.
not fixed.
Just tried this multiple times with git of all modules, and a/v sync seems fine to me. > This is 1/5 mp4 files that wasn't generated successfully. Does that mean that 4 out of 5 times the file created is fine, but 1 out of 5 times it's not?
I think that Thiago fixed this in mp4mux/qtmux and commited his changes months ago.