<html><head></head><body><div class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div dir="ltr" data-setdir="false">I'm creating a simple test stream from 3 solid color PNGs, using gstreamer:</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"> gst-launch-1.0 multifilesrc index=0 location="%d.png" ! pngdec ! videoconvert ! videorate ! video/x-raw,framerate=1/2 ! x264enc ! mp4mux ! filesink location=test.mp4</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">As expected it creates a 6 second video, each color showing for 2s.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I'm then trying to write an app that can consume these frames. I create a pipeline in my app (using vtdec to decode -- I'm on macOS):</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"> "filesrc location=test.mp4 ! qtdemux name=d d.video_0 ! queue ! h264parse ! vtdec ! videoscale add-borders=false ! videoconvert ! video/x-raw,width=200,height=200,format=NV12 ! fakesink sync=false silent=true enable-last-sample=false"</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I hook a signal-handoff callback for fakesink, and in that callback look at the GstBuffer's timestamp:</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><div><div> timestampBuffer = GST_BUFFER_PTS_IS_VALID(buffer) ? GST_BUFFER_PTS(buffer) : 0;</div><div dir="ltr" data-setdir="false"><br></div></div><div dir="ltr" data-setdir="false">I'm getting the timestamps 2, 4, and 6 (2,000,000,000 in ns, etc) for the buffers. Why is that? Why not 0, 2 4?</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">When I run the test.mp4 stream through ffprobe, it tells the "correct" story:</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><div><div>[FRAME]</div><div>media_type=video</div><div>stream_index=0</div><div>key_frame=1</div><div>pts=0</div><div>pts_time=0.000000</div><div>pkt_dts=0</div><div>pkt_dts_time=0.000000</div><div>best_effort_timestamp=0</div><div dir="ltr" data-setdir="false">best_effort_timestamp_time=0.000000</div></div><div dir="ltr" data-setdir="false">...</div><div dir="ltr" data-setdir="false"><div><div>/FRAME]</div><div>[FRAME]</div><div>media_type=video</div><div>stream_index=0</div><div>key_frame=0</div><div>pts=100</div><div>pts_time=2.000000</div><div>pkt_dts=N/A</div><div>pkt_dts_time=N/A</div><div>best_effort_timestamp=100</div><div dir="ltr" data-setdir="false">best_effort_timestamp_time=2.000000</div></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">and the same for 4.00000.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">One other thing to note -- if I run the playback pipeline using gst-launch and switch to autovideosink, or just let gstreamer handle it and run "gst-play test.mp4", on quite a few invocations, the first color doesn't show up. I just get a black video. When it hits 2s, the second color *always* shows up.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Am I setting something up wrong? Or are my assumptions broken?</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><br></div></div></div></div></div></body></html>