Problem with filesrc do-timestamp=1
I'm using elements that require live sources.
But sometimes I need to use files, in order to emulate a live source I use the do-timestamp
property of filesrc
and
multifilesrc
plus an identity sync=1
.
The multifilesrc
always works perfectly but the filesrc
gives me bad results off and on (buffers with invalid timestamps == -1).
I'm using gst-shark to be able to trace and print the timestamp information:
Here I got a correct pts: 0:00:00.203193445 5508 0x615b70 TRACE GST_TRACER :0:: buffer, pad=(string)pnmdec0:src, pts=(string)0:00:00.001304907, dts=(string)99:99:99.999999999, duration=(string)99:99:99.999999999, offset=(guint64)18446744073709551615, offset_end=(guint64)18446744073709551615, size=(guint64)6276528, flags=(string)GST_BUFFER_FLAG_DISCONT, refcount=(uint)1;
root@qt5022:~# GST_DEBUG="*:3,GST_TRACER:7" GST_TRACERS="buffer(filter=pnmdec)" gst-launch-1.0 filesrc do-timestamp=1 location=002.ppm ! pnmdec ! identity sync=1 ! videoconvert ! fakesink sync=0 async=0
0:00:00.043287794 5508 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620d80 (cpuusage)
0:00:00.043400473 5508 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620e40 (graphic)
0:00:00.043438270 5508 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620f00 (proctime)
0:00:00.043475497 5508 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65c840 (interlatency)
0:00:00.043525304 5508 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65c900 (scheduletime)
0:00:00.043587376 5508 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65c9c0 (framerate)
0:00:00.043632384 5508 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65ca80 (queuelevel)
0:00:00.043667904 5508 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65cb40 (bitrate)
0:00:00.043703081 5508 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65cc00 (buffer)
0:00:00.044473236 5508 0x64e180 TRACE GST_TRACER gsttracerrecord.c:111:gst_tracer_record_build_format: buffer.class, pad=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"The\\\ pad\\\ which\\\ the\\\ buffer\\\ is\\\ going\\\ through\"\;", pts=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"Presentation\\\ Timestamp\"\;", dts=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"Decoding\\\ Timestamp\"\;", duration=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)Duration\;", offset=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)Offset\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", offset_end=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)\"Offset\\\ End\"\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", size=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)\"Data\\\ Size\"\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", flags=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)Flags\;", refcount=(structure)"value\,\ type\=\(type\)guint\,\ description\=\(string\)\"Ref\\\ Count\"\,\ min\=\(uint\)0\,\ max\=\(uint\)4294967295\;";
0:00:00.044563092 5508 0x64e180 DEBUG GST_TRACER gsttracerrecord.c:125:gst_tracer_record_build_format: new format string: buffer, pad=(string)%s, pts=(string)%s, dts=(string)%s, duration=(string)%s, offset=(guint64)%lu, offset_end=(guint64)%lu, size=(guint64)%lu, flags=(string)%s, refcount=(uint)%u;
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
0:00:00.060434228 5508 0x615b70 FIXME videodecoder gstvideodecoder.c:933:gst_video_decoder_drain_out:<pnmdec0> Sub-class should implement drain()
New clock: GstSystemClock
0:00:00.061536333 5508 0x615b70 FIXME videodecoder gstvideodecoder.c:933:gst_video_decoder_drain_out:<pnmdec0> Sub-class should implement drain()
0:00:00.203193445 5508 0x615b70 TRACE GST_TRACER :0:: buffer, pad=(string)pnmdec0:src, pts=(string)0:00:00.001304907, dts=(string)99:99:99.999999999, duration=(string)99:99:99.999999999, offset=(guint64)18446744073709551615, offset_end=(guint64)18446744073709551615, size=(guint64)6276528, flags=(string)GST_BUFFER_FLAG_DISCONT, refcount=(uint)1;
Got EOS from element "pipeline0".
Execution ended after 0:00:00.143298097
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
And then running the exact same pipeline again I get a strange pts: 0:00:00.201213533 5511 0x615b70 TRACE GST_TRACER :0:: buffer, pad=(string)pnmdec0:src, pts=(string)7:44:53.025969752, dts=(string)99:99:99.999999999, duration=(string)99:99:99.999999999, offset=(guint64)18446744073709551615, offset_end=(guint64)18446744073709551615, size=(guint64)6276528, flags=(string)GST_BUFFER_FLAG_DISCONT, refcount=(uint)1;
root@qt5022:~# GST_DEBUG="*:3,GST_TRACER:7" GST_TRACERS="buffer(filter=pnmdec)" gst-launch-1.0 filesrc do-timestamp=1 location=002.ppm ! pnmdec ! identity sync=1 ! videoconvert ! fakesink sync=0 async=0
0:00:00.043163858 5511 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620d80 (cpuusage)
0:00:00.043273857 5511 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620e40 (graphic)
0:00:00.043310779 5511 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620f00 (proctime)
0:00:00.043347283 5511 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65c840 (interlatency)
0:00:00.043387067 5511 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65c900 (scheduletime)
0:00:00.043436940 5511 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65c9c0 (framerate)
0:00:00.043474066 5511 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65ca80 (queuelevel)
0:00:00.043518948 5511 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65cb40 (bitrate)
0:00:00.043554675 5511 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65cc00 (buffer)
0:00:00.044297121 5511 0x64e180 TRACE GST_TRACER gsttracerrecord.c:111:gst_tracer_record_build_format: buffer.class, pad=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"The\\\ pad\\\ which\\\ the\\\ buffer\\\ is\\\ going\\\ through\"\;", pts=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"Presentation\\\ Timestamp\"\;", dts=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"Decoding\\\ Timestamp\"\;", duration=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)Duration\;", offset=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)Offset\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", offset_end=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)\"Offset\\\ End\"\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", size=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)\"Data\\\ Size\"\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", flags=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)Flags\;", refcount=(structure)"value\,\ type\=\(type\)guint\,\ description\=\(string\)\"Ref\\\ Count\"\,\ min\=\(uint\)0\,\ max\=\(uint\)4294967295\;";
0:00:00.044383159 5511 0x64e180 DEBUG GST_TRACER gsttracerrecord.c:125:gst_tracer_record_build_format: new format string: buffer, pad=(string)%s, pts=(string)%s, dts=(string)%s, duration=(string)%s, offset=(guint64)%lu, offset_end=(guint64)%lu, size=(guint64)%lu, flags=(string)%s, refcount=(uint)%u;
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
0:00:00.059445900 5511 0x615b70 FIXME videodecoder gstvideodecoder.c:933:gst_video_decoder_drain_out:<pnmdec0> Sub-class should implement drain()
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.061032396 5511 0x615b70 FIXME videodecoder gstvideodecoder.c:933:gst_video_decoder_drain_out:<pnmdec0> Sub-class should implement drain()
0:00:00.201213533 5511 0x615b70 TRACE GST_TRACER :0:: buffer, pad=(string)pnmdec0:src, pts=(string)7:44:53.025969752, dts=(string)99:99:99.999999999, duration=(string)99:99:99.999999999, offset=(guint64)18446744073709551615, offset_end=(guint64)18446744073709551615, size=(guint64)6276528, flags=(string)GST_BUFFER_FLAG_DISCONT, refcount=(uint)1;
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:04.074898297
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
And the again, no pts:0:00:00.203289646 5498 0x615b70 TRACE GST_TRACER :0:: buffer, pad=(string)pnmdec0:src, pts=(string)99:99:99.999999999, dts=(string)99:99:99.999999999, duration=(string)99:99:99.999999999, offset=(guint64)18446744073709551615, offset_end=(guint64)18446744073709551615, size=(guint64)6276528, flags=(string)GST_BUFFER_FLAG_DISCONT, refcount=(uint)1;
root@qt5022:~# GST_DEBUG="*:3,GST_TRACER:7" GST_TRACERS="buffer(filter=pnmdec)" gst-launch-1.0 filesrc do-timestamp=1 location=002.ppm ! pnmdec ! identity sync=1 ! videoconvert ! fakesink sync=0 async=0
0:00:00.042737979 5498 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620d80 (cpuusage)
0:00:00.042845462 5498 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620e40 (graphic)
0:00:00.042882752 5498 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620f00 (proctime)
0:00:00.042919761 5498 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65c840 (interlatency)
0:00:00.042958778 5498 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65c900 (scheduletime)
0:00:00.043051814 5498 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65c9c0 (framerate)
0:00:00.043112182 5498 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65ca80 (queuelevel)
0:00:00.043168352 5498 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65cb40 (bitrate)
0:00:00.043223235 5498 0x64e180 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65cc00 (buffer)
0:00:00.043973091 5498 0x64e180 TRACE GST_TRACER gsttracerrecord.c:111:gst_tracer_record_build_format: buffer.class, pad=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"The\\\ pad\\\ which\\\ the\\\ buffer\\\ is\\\ going\\\ through\"\;", pts=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"Presentation\\\ Timestamp\"\;", dts=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"Decoding\\\ Timestamp\"\;", duration=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)Duration\;", offset=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)Offset\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", offset_end=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)\"Offset\\\ End\"\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", size=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)\"Data\\\ Size\"\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", flags=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)Flags\;", refcount=(structure)"value\,\ type\=\(type\)guint\,\ description\=\(string\)\"Ref\\\ Count\"\,\ min\=\(uint\)0\,\ max\=\(uint\)4294967295\;";
0:00:00.044052718 5498 0x64e180 DEBUG GST_TRACER gsttracerrecord.c:125:gst_tracer_record_build_format: new format string: buffer, pad=(string)%s, pts=(string)%s, dts=(string)%s, duration=(string)%s, offset=(guint64)%lu, offset_end=(guint64)%lu, size=(guint64)%lu, flags=(string)%s, refcount=(uint)%u;
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
0:00:00.059393979 5498 0x615b70 FIXME videodecoder gstvideodecoder.c:933:gst_video_decoder_drain_out:<pnmdec0> Sub-class should implement drain()
Setting pipeline to PLAYING ...
0:00:00.061049160 5498 0x615b70 FIXME videodecoder gstvideodecoder.c:933:gst_video_decoder_drain_out:<pnmdec0> Sub-class should implement drain()
New clock: GstSystemClock
0:00:00.203289646 5498 0x615b70 TRACE GST_TRACER :0:: buffer, pad=(string)pnmdec0:src, pts=(string)99:99:99.999999999, dts=(string)99:99:99.999999999, duration=(string)99:99:99.999999999, offset=(guint64)18446744073709551615, offset_end=(guint64)18446744073709551615, size=(guint64)6276528, flags=(string)GST_BUFFER_FLAG_DISCONT, refcount=(uint)1;
Got EOS from element "pipeline0".
Execution ended after 0:00:00.142536204
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
multifilesrc always returns me a valid pts: 0:00:00.113280317 596 0x623630 TRACE GST_TRACER :0:: buffer, pad=(string)pnmdec0:src, pts=(string)0:00:00.024404403, dts=(string)99:99:99.999999999, duration=(string)99:99:99.999999999, offset=(guint64)18446744073709551615, offset_end=(guint64)18446744073709551615, size=(guint64)6276528, flags=(string)GST_BUFFER_FLAG_DISCONT, refcount=(uint)1;
root@qt5022:~# GST_DEBUG="*:3,GST_TRACER:7" GST_TRACERS="buffer(filter=pnmdec)" gst-launch-1.0 multifilesrc num-buffers=1 do-timestamp=1 location=002.ppm ! pnmdec ! identity sync=1 ! videoconvert ! fakesink sync=0 async=0
0:00:00.039729121 596 0x64d980 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65ac00 (cpuusage)
0:00:00.039876322 596 0x64d980 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65ab40 (graphic)
0:00:00.039915541 596 0x64d980 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65aa80 (proctime)
0:00:00.039954115 596 0x64d980 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65a9c0 (interlatency)
0:00:00.039990671 596 0x64d980 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65a900 (scheduletime)
0:00:00.040313876 596 0x64d980 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x65a840 (framerate)
0:00:00.040352600 596 0x64d980 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620f00 (queuelevel)
0:00:00.040388033 596 0x64d980 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620e40 (bitrate)
0:00:00.040424745 596 0x64d980 DEBUG GST_TRACER gsttracer.c:164:gst_tracer_register:<registry0> update existing feature 0x620d80 (buffer)
0:00:00.041331466 596 0x64d980 TRACE GST_TRACER gsttracerrecord.c:111:gst_tracer_record_build_format: buffer.class, pad=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"The\\\ pad\\\ which\\\ the\\\ buffer\\\ is\\\ going\\\ through\"\;", pts=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"Presentation\\\ Timestamp\"\;", dts=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)\"Decoding\\\ Timestamp\"\;", duration=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)Duration\;", offset=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)Offset\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", offset_end=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)\"Offset\\\ End\"\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", size=(structure)"value\,\ type\=\(type\)guint64\,\ description\=\(string\)\"Data\\\ Size\"\,\ min\=\(guint64\)0\,\ max\=\(guint64\)18446744073709551615\;", flags=(structure)"value\,\ type\=\(type\)gchararray\,\ description\=\(string\)Flags\;", refcount=(structure)"value\,\ type\=\(type\)guint\,\ description\=\(string\)\"Ref\\\ Count\"\,\ min\=\(uint\)0\,\ max\=\(uint\)4294967295\;";
0:00:00.041434660 596 0x64d980 DEBUG GST_TRACER gsttracerrecord.c:125:gst_tracer_record_build_format: new format string: buffer, pad=(string)%s, pts=(string)%s, dts=(string)%s, duration=(string)%s, offset=(guint64)%lu, offset_end=(guint64)%lu, size=(guint64)%lu, flags=(string)%s, refcount=(uint)%u;
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
0:00:00.058401943 596 0x623630 FIXME videodecoder gstvideodecoder.c:933:gst_video_decoder_drain_out:<pnmdec0> Sub-class should implement drain()
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.083718900 596 0x623630 FIXME videodecoder gstvideodecoder.c:933:gst_video_decoder_drain_out:<pnmdec0> Sub-class should implement drain()
0:00:00.113280317 596 0x623630 TRACE GST_TRACER :0:: buffer, pad=(string)pnmdec0:src, pts=(string)0:00:00.024404403, dts=(string)99:99:99.999999999, duration=(string)99:99:99.999999999, offset=(guint64)18446744073709551615, offset_end=(guint64)18446744073709551615, size=(guint64)6276528, flags=(string)GST_BUFFER_FLAG_DISCONT, refcount=(uint)1;
Got EOS from element "pipeline0".
Execution ended after 0:00:00.054257974
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...