0

I have a script that writes MJPEG from an HDMI video capture card (/dev/video0) to a v4l2loopback device (/dev/video5). I compiled the v4l2loopback module from source. This script works fine on Raspberry Pi but fails on Ubuntu with this error: V4L2 output device supports only a single raw video stream. Is there a way around this or am I forced to transcode the HDMI capture output to rawvideo? I would prefer to get this working on Ubuntu in the same way it is working on Raspberry Pi.

Here is the FFMPEG command:

ffmpeg -input_format mjpeg -framerate 30 -s 1280x720 -i /dev/video0 -vcodec copy -f v4l2 /dev/video5

Full output of command:

Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 9137.845580, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
[video4linux2,v4l2 @ 0x55eb0d461b40] V4L2 output device supports only a single raw video stream
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Yllier123
  • 66
  • 14
  • 1
    The error is indicating you have multiple video streams generated by the HDMI video capture card. Post the log so we can see what kind of input streams you are dealing with. One thing you can try is to add `-map 0:v:0` *output* option to only grab the first input video stream. If this works, you need to decide which stream needs to be output to `/dev/video5`. – kesh Apr 22 '22 at 14:33
  • I added the full output of the command to my original post. I am only grabbing one stream. I believe that the v4l2loopback module is complaining about accepting MJPEG instead of rawvideo, which it does not do on the Raspberry Pi @kesh – Yllier123 Apr 22 '22 at 16:13
  • You're right. I got stuck on the word "single". Have you checked `ffmpeg -f video4linux2 -list_formats all /dev/video0` and `ffmpeg -f video4linux2 -list_formats all /dev/video5` to see if there are any common settings? Not knowing much about linux, could you look into the difference in how v4l2loopback device driver(?) on your 2 systems? – kesh Apr 22 '22 at 16:58

1 Answers1

0

I was using an outdated version of FFMPEG (4.2.X). I updated to 4.4.1-3 from this PPA and now everything works as expected. I hope this can be of use to someone someday dealing with the same hair-pulling issue.

Yllier123
  • 66
  • 14