Variable framerate handling regression in GStreamer 1.18.4
Use case : use DSLR as a webcam on Ubuntu with gstreamer & gphoto2 & v4l2loopback
This was working perfectly fine with GStreamer 1.18.0 and Ubuntu 20.10 groovy
gphoto2 --stdout --capture-movie > \ >(gst-launch-1.0 fdsrc fd=0 ! decodebin name=dec ! queue ! \ videoconvert ! v4l2sink device=/dev/video0 >/dev/null \ ) 2>/dev/null &
On GStreamer 1.18.4 and Ubuntu 21.04 hirsute, it doesn't work anymore and throws errors on the fdsrc component
Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Capturing preview frames as movie to 'stdout'. Press Ctrl-C to abort. ERROR: from element /GstPipeline:pipeline0/GstFdSrc:fdsrc0: Internal data stream error. Additional debug info: ../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstFdSrc:fdsrc0: streaming stopped, reason not-negotiated (-4) ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... Freeing pipeline ...
I had a hard time tracking this down to an issue related to the variable framerate of the input stream (
framerate=(fraction)0/1). If I output to
autovideosink instead of
v4l2sink it works like a charm. I should be related to some negociation mecanism.
Finally this works :
gphoto2 --stdout --capture-movie > \ >(gst-launch-1.0 -v fdsrc fd=0 ! decodebin name=dec ! videorate ! \ videoconvert ! v4l2sink device=/dev/video0 sync=false \ ) 2>/dev/null &
NB 1. I don't remember why I had a
queue in the former pipeline.
NB 2. The
sync=false is definitely needed in the later pipeline to prevent very bad framerate.