c++ - 带有 GStreamer 安装问题的 Yocto OpenCV
问题描述
我有一个简单的 GStreamer 管道,我通过 OpenCV VideoWriter 实例化
LOG_INFO("Opening VP8 GStreamer writer object at "
<< host << ":" << port << " with " << horizontal_resolution
<< "x" << vertical_resolution << "p@" << fps << "fps"
<< "(color=" << is_color << ")");
const std::string filename{
" appsrc is-live=true ! videoconvert ! "
" vp8enc cpu-used=2 threads=2 min_quantizer=5 max_quantizer=5 deadline=100000 ! "
" rtpvp8pay ! application/x-rtp,media=video,encoding-name=VP8,payload=96 ! "
" udpsink host= " + host + " port= " + port
};
writer.open(
filename,
cv::CAP_GSTREAMER,
fps,
cv::Size{horizontal_resolution, vertical_resolution},
is_color
);
在我的主机上它运行顺利,但是当我在目标上交叉编译和运行时,我得到以下信息:
Opening VP8 GStreamer writer object at 127.0.0.1:8004 with 160x120p@30fps(color=true)
0:00:00.003785000 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "appsrc"!
0:00:00.003901750 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "appsrc"
0:00:00.003951125 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "videoconvert"!
0:00:00.003972875 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "videoconvert"
0:00:00.003998375 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@(nil)]
0:00:00.004042250 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "vp8enc"!
0:00:00.004070875 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "vp8enc"
0:00:00.004105500 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@(nil)]
0:00:00.004135750 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "rtpvp8pay"!
0:00:00.004160250 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "rtpvp8pay"
0:00:00.004186875 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@(nil)]
0:00:00.004309875 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "udpsink"!
0:00:00.004336375 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "udpsink"
0:00:00.004364125 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@(nil)]
(EXE:3484): GStreamer-CRITICAL **: gst_debug_log_valist: assertion 'category != NULL' failed
** (EXE:3484): CRITICAL **: gst_app_src_end_of_stream: assertion 'GST_IS_APP_SRC (appsrc)' failed
我的 Yocto 配置文件如下,目标平台是 i.MX8M Mini。
require conf/distro/include/yocto-uninative.inc
MACHINE ??= "e0219"
UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd] ??= "e0219_config"
#MACHINE ??= 'imx8mmevk'
DISTRO ?= 'fsl-imx-xwayland'
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
CONF_VERSION = "1"
DL_DIR ?= "${BSPDIR}/downloads/"
CORE_IMAGE_EXTRA_INSTALL += " net-tools iputils dhcpcd"
CORE_IMAGE_EXTRA_INSTALL += " openssh nano python3 ethtool i2c-tools strace spitools"
CORE_IMAGE_EXTRA_INSTALL += " tcpdump socat opencv libmicrohttpd libsrtp curl boost"
CORE_IMAGE_EXTRA_INSTALL += " nmap python-djangorestframework net-snmp"
CORE_IMAGE_EXTRA_INSTALL += " openmp llvm"
ACCEPT_FSL_EULA = "1"
如果我正确理解这一点,opencv 配方应该需要 gstreamer 及其一些插件,但在我看来,在构建之后,GStreamer 找不到运行管道所需的插件。这是 gst-inspect 的输出:
$ gst-inspect-1.0
coreelements: capsfilter: CapsFilter
coreelements: concat: Concat
coreelements: dataurisrc: data: URI source element
coreelements: downloadbuffer: DownloadBuffer
coreelements: fakesrc: Fake Source
coreelements: fakesink: Fake Sink
coreelements: fdsrc: Filedescriptor Source
coreelements: fdsink: Filedescriptor Sink
coreelements: filesrc: File Source
coreelements: funnel: Funnel pipe fitting
coreelements: identity: Identity
coreelements: input-selector: Input selector
coreelements: output-selector: Output selector
coreelements: queue: Queue
coreelements: queue2: Queue 2
coreelements: filesink: File Sink
coreelements: tee: Tee pipe fitting
coreelements: typefind: TypeFind
coreelements: multiqueue: MultiQueue
coreelements: valve: Valve element
coreelements: streamiddemux: Streamid Demux
staticelements: bin: Generic bin
staticelements: pipeline: Pipeline object
Total count: 2 plugins, 23 features
我该如何解决这个问题?
使用@Subrata 建议更新 2
我将@Subrata 建议的软件包添加到我的 local.conf 中,如下所示:
CORE_IMAGE_EXTRA_INSTALL += " gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav"
现在通过 gst-inspect 可以看到 179 个插件。
启动我的应用程序我仍然缺少一个元素,但这是朝着正确方向迈出的一步。
Opening VP8 GStreamer writer object at 127.0.0.1:8004 with 160x120p@30fps(color=true)
0:00:00.053317750 3520 0x16290b00 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "vp8enc"!
0:00:00.053537875 3520 0x16290b00 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "vp8enc"
0:00:00.053606125 3520 0x16290b00 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no sink [source=@0x16293290]
0:00:00.057937500 3520 0x16290b00 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@0x162a0250]
0:00:00.081852625 3520 0x1629f720 FIXME default gstutils.c:3981:gst_pad_create_stream_id_internal:<appsrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
解决方案
尝试重新gstreamer
安装gstreamer1.0-plugins-good, gstreamer1.0-plugins-bad, gstreamer1.0-plugins-ugly
和gstreamer1.0-libav
.
以下软件包将提供:gstreamer1.0-audiosink、gstreamer1.0-audiosource、gstreamer1.0-videosink、gstreamer1.0-videosource、gstreamer1.0-visualization
libav
具有用于编码 40 多种格式(MPEG、DivX、MPEG4、AC3、DV、...)的元素,用于解码 90 多种格式(AVI、MPEG、OGG、Matroska、ASF...)的解码元素。
推荐阅读
- reactjs - 函数组件的警告不能给出 refs - 即使将 forwardRef() 与 Styled Components 一起使用
- bash - 如何将ini文件与覆盖文件合并
- php - 如何设置 WordPress 特定类别始终用作第二个?
- c - 在 C 中分配 2d 堆数组的一致 Seg Fault
- docker - 使 docker 容器使用另一个容器的 config.v2.json
- java - 使用子类和超类引用访问实例方法
- c# - 减少在 C# 中描述嵌套集合的必要代码
- arrays - 给定一个图像列表,我如何以编程方式找到它们的 h 和 v 大小?
- shell - container_commands AWS beanstalk 中的 Docker 命令
- angular - 我什么时候应该使用“ngProjectAs”属性?