使用 GStreamer 编码单镜头 png 文件

问题描述

我在将一些视频流编码为 png 文件时遇到问题

我输入的命令行如下

gst-launch-1.0 --verbose v4l2src num-buffers=1 ! pngenc ! filesink location=qrcode.png

但是我有以下错误

Setting pipeline to PAUSED ...
Pipeline is live and does not need preroll ...
Setting pipeline to PLAYING ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../../../../git/libs/gst/base/gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l:
streaming stopped,reason not-negotiated (-4)
Execution ended after 0:00:00.000189250
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

内部数据流错误是什么意思?我试图通过将 pngenc 更改为 jpegenc 并将文件更改为 *.jpg 以 jpeg 格式对其进行编码。它完美地工作

问候

解决方法

可能是您的相机提供的格式不满足 pngenc 元素支持的格式。尝试在 videoconvert 之前添加 pngenc

gst-launch-1.0 --verbose v4l2src num-buffers=1 ! videoconvert ! pngenc ! filesink location=qrcode.png