Trouble with v4l2loopback and mpeg2/mpeg-ts stream

Nicolas Dufresne nicolas at
Fri Dec 23 12:47:46 UTC 2022


Le jeudi 22 décembre 2022 à 23:53 -0600, Dave Blanchard via gstreamer-devel a
écrit :
> I've got an SRT server with a MPEG2/MPEG-TS video stream that I'd like to make available on a v4l2 loopback device. Here is a sample configuration:
> gst-launch-1.0 \
>     srtsrc uri=srt://localhost:4003 \
>            wait-for-connection=false \
>     ! "video/mpegts, width=704, height=480, framerate=30/1, format=I420" \

nit: width/height/framerate/format have no effect here.

>     ! tsparse \
>     ! queue \
>     ! v4l2sink device=/dev/video53 
> ffmpeg/ffplay won't play this video at all; it quits with the following error:
> [video4linux2,v4l2 @ 0x7fcc90000c80] Cannot find a proper format for codec 'none' (id 0), pixel format 'none' (id -1)

It looks like V4L2_PIX_FMT_MPEG (V4L2 name for MPEGTS) is not mapped in FFMpeg
capture implementation. For this reason, FFMpeg driver would have to make a
guess (similar to GStreamer type finders). Perhaps ffplay does not even try to
guess while mplayer is probably guessing H.264 instead of MPEG TS.

The related FFMpeg code, you'll have to work with them if you want this to work.
Alternatively, if you only care about video, you could demux and parse the video
stream, this is supported.

> Attempting to specify the codec and pixel format manually doesn't seem to help.
> mplayer is sort-of able to play the stream, and there is a semi-recognizable image, but it's all blocky and corrupted, with a lot of errors printed on the console.
> Anyone got an idea what the problem is? Thanks.

More information about the gstreamer-devel mailing list