After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 602936 - [ mp4mux] Lipsync issue when converting mkv to mp4 using h264/aac
[ mp4mux] Lipsync issue when converting mkv to mp4 using h264/aac
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.20
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-11-25 13:35 UTC by bachman
Modified: 2010-08-14 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Thiago's use timestamp patch (1.22 KB, patch)
2009-11-25 13:35 UTC, bachman
none Details | Review

Description bachman 2009-11-25 13:35:29 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)
Comment 1 Thiago Sousa Santos 2009-11-26 00:47:06 UTC
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
Comment 2 bachman 2009-11-26 14:36:59 UTC
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.
Comment 3 bachman 2009-11-26 14:39:27 UTC
not fixed.
Comment 4 Tim-Philipp Müller 2010-08-06 10:59:51 UTC
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?
Comment 5 bachman 2010-08-06 11:17:29 UTC
I think that Thiago fixed this in mp4mux/qtmux and commited his changes months ago.