New element to clip streams in order to void initial gaps
Submitted by Frédéric Sureau (sfred)
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 !
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.
I fixed the problem by removing calls to update_edit_list function
in the qtmux element: