Lipsync problem using mp4mux with v4l2src

Frédéric Sureau frederic.sureau at veo-labs.com
Thu Jun 11 02:21:00 PDT 2015


Hi!

I am facing lipsync problems while muxing live sources into an mp4 file.

Here is the pipeline:
gst-launch-1.0 -ev mp4mux name=mux ! filesink location=test.mp4
     v4l2src device=/dev/v4l/by-path/ipu1-capture io-mode=dmabuf !
     "video/x-raw,format=NV12,width=1280,height=720,framerate=50/1" !
     v4l2h264enc device=/dev/v4l/by-path/vpu-encoder 
output-io-mode=dmabuf-import !
     h264parse ! queue ! mux.
     alsasrc device=hw:sndcard0,0 ! "audio/x-raw, rate=48000" ! faac ! 
aacparse ! queue ! mux.

The v4l2src element takes some time to initialize, so the first buffer 
arrives after 300ms or 400ms.
Timestamps start accordingly around 0:00:00.300
Timestamps are conserved after the encoder element (checked using identity)

Sound start immediately at 0

Audio/video sync is OK when using matroskamux, flvmux or tsmux but 
desynchronized when using mp4mux. This is weird because *video* is late, 
as if the real lateness was compensated 2 times.

Then I fixed the problem by removing calls to update_edit_list function 
in the qtmux element:
https://gitlab.com/veo-labs/gst-plugins-good/commit/1febe4fc6fe2fe1322d5ae5c062da2903990680a

I have the feeling that this is not a good thing to do, but can't say 
why as I am not familiar at all with mp4 container.

Any suggestion on that?

Thanks
Fred


More information about the gstreamer-devel mailing list