Recording and playback simultaneously

Hello,

I’m recording live stream from webcam into file sink (H.264/.mkv) :

gst-launch-1.0 -vvv -e avfvideosrc device-index=0 ! x264enc bitrate=1500 speed-preset=ultrafast tune=zerolatency key-int-max=15 ! video/x-h264,profile=constrained-baseline,stream-format=avc ! matroskamux ! filesink location="test.mkv"

At the same time, I implemented a GTK app to playback this recording file using playbin3 and gtkglsink.

Playback working fine also seeking froward/backward, the only issue is the file duration not updated if I seek back , the duration get stopped. which means I cannot seek forward to the recent recorded frames.

I did run gst_element_query_duration every 1 second but it return not updated result from the actual file on the filesystem.

gst_element_query_duration (data->playbin, GST_FORMAT_TIME, &data->duration)

Is there anything to do to get updated duration ? did playbin return a cashed duration result instead of querying the .mkv at the file system again ?

Thanks for any support.

Hi,
The issue here could be caused by how you are loading the file into your application. Once it is loaded, the duration is stored and the pipeline keeps reporting the duration at the time of loading. You could try to have some method of reloading the file to get an updated duration.

Yes, the Matroska demuxer does not expect or handle the input file to be updated while it’s being read (though it might re-check it once it hits the file size at the time of the initial loading, not sure, didn’t check if the implementation does that or not).