简体   繁体   English

使用 FFMPEG 将 MJPEG 写入环回设备在 Ubuntu 20.04 上失败。 适用于树莓派

[英]Writing MJPEG to loopback device with FFMPEG fails on Ubuntu 20.04. Works on Rasperry Pi

I have a script that writes MJPEG from an HDMI video capture card (/dev/video0) to a v4l2loopback device (/dev/video5) .我有一个脚本,可以将 MJPEG 从 HDMI 视频捕获卡(/dev/video0)写入 v4l2loopback 设备(/dev/video5) I compiled the v4l2loopback module from source .从源代码编译了 v4l2loopback 模块。 This script works fine on Raspberry Pi but fails on Ubuntu with this error: V4L2 output device supports only a single raw video stream .此脚本在 Raspberry Pi 上运行良好,但在 Ubuntu 上失败并出现以下错误: 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?有没有办法解决这个问题,或者我是否被迫将 HDMI 捕获 output 转码为原始视频? I would prefer to get this working on Ubuntu in the same way it is working on Raspberry Pi.我更愿意以与在 Raspberry Pi 上工作相同的方式在 Ubuntu 上工作。

Here is the FFMPEG command:这是 FFMPEG 命令:

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

Full output of command:命令的完整 output:

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)

I was using an outdated version of FFMPEG (4.2.X).我使用的是 FFMPEG (4.2.X) 的过时版本。 I updated to 4.4.1-3 from this PPA and now everything works as expected.我从这个 PPA更新到 4.4.1-3,现在一切都按预期工作。 I hope this can be of use to someone someday dealing with the same hair-pulling issue.我希望这对有一天处理同样令人毛骨悚然的问题的人有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM