webrtcbin fake-live filesrc and seeking

Marianna Smidth Buschle msb at qtec.com
Wed Apr 20 08:57:36 UTC 2022

On 20.04.2022 06.41, gstreamer-devel-request at lists.freedesktop.org wrote:
> Thanks for your hints!
> I didnt consider clocksync yet, its indeed an option. I do not
> understand all aspects of timing yet. However, aiming to support as
> many input files as possible, and then feeding realtime focussed
> webrtcbin, Id like to clocksync audio and video compensating any
> possible a/v offset (like e.g. audio being muxed 2 seconds ahead of
> video) as well as decoder delays.
> Anyways, thats a fine tuning for later times. I get a reasonably
> working stream with many sync variants for now..
> Interestingly, you are associating "duration/position working" with
> "seeking working" to some extend. For my experiments duration/position
> works well in any setup, in case I ask decodebin directly.

Well it was mostly related to my use case.
Which was live streaming from a camera while recording to a file, so 
that I could do a replay by rewinding the file fx 10 seconds.
Therefore I needed the current position.

And my general experience was that whenever the position query failed 
the seek would also fail.
I'm guessing some of the same internal mechanisms are used...

> Seeking however, is still not working. I made a slightly simplified
> pipeline, trying to follow your advices, where streaming and
> duration/position still works, while seek fails, as in any other
> attempt:
I have always just sent my position queries and seek directly to the 
pipeline object.
So I don't know if that is the difference.

Moreover I have generally tried to keep my pipelines decoupled 
(proxysink/src, interpipesink/src, etc), so fx errors in the file 
recording (full disk, etc) wouldn't interfere with the streaming.
That might also have some influence on the behavior.

> ------------------------------------------------------------------------------
> filesrc location=/home/ubuntu/test.mkv do-timestamp=1 ! decodebin name=decbin
> ! video/x-raw ! vaapipostproc ! video/x-raw... ! queue  ! vaapih264enc ... !
> video/x-h264... ! h264parse config-interval=-1 ! clocksync  !
> rtph264pay config-interval=-1 !
> application/x-rtp... ! queue ! tee name=videotee ! queue ! fakesink
> name=vfakesink
> decbin. ! audio/x-raw ! audioconvert ! audioresample ! audio/x-raw... !
> opusenc bitrate=... ! queue ! clocksync ! rtpopuspay !
> application/x-rtp... ! queue ! tee name=audiotee ! queue ! fakesink
> ------------------------------------------------------------------------------
> webrtcbin consumers are linked to the tees dynamically (with queues).
> Seek is sent to the pipeline object.
> Any further ideas what I could try here?
Well, my best advice with gstreamer is always to simplify and isolate 
the problem.
Which also relates to my comment above about decoupled pipelines.

So I would suggest you divide your pipeline in smaller chunks and try 
the SEEK and see when it works and when it doesn't.
In this way you can try to pin point where it is going wrong.

Start fx with just: 'filesrc ! decodebin ! video/x-raw ! clocksync ! 
Then try adding the encoding. Then the RTP of the video.
Then start playing with audio, etc...

> Philipp

Best regards / Med venlig hilsen
“Marianna Smidth Buschle”

More information about the gstreamer-devel mailing list