首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Yocto OpenCV w/ GStreamer安装问题

Yocto OpenCV w/ GStreamer安装问题
EN

Stack Overflow用户
提问于 2019-07-31 13:15:45
回答 2查看 759关注 0票数 0

我有一个简单的GStreamer管道,我通过OpenCV VideoWriter实例化它

代码语言:javascript
复制
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
);

在我的主机上,它运行平稳,但是当我交叉编译并在目标上运行时,我得到以下信息:

代码语言:javascript
复制
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。

代码语言:javascript
复制
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的输出-检查:

代码语言:javascript
复制
$ 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中,如下所示:

代码语言:javascript
复制
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检查看到179个插件。

在启动我的应用程序时,我仍然缺少一个元素,但这是朝着正确方向迈出的一步。

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-08-01 09:55:28

要完成@Subrata的回答:您需要安装与gstreamer所需的元素相对应的包。

我不知道您使用的是哪个Yocto版本,但您可以看到gstreamer上默认安装了哪些gstreamer元素。在meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good.inc文件中:

代码语言:javascript
复制
PACKAGECONFIG ??= " \
    ${GSTREAMER_ORC} \
    ${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio x11', d)} \
    cairo flac gdk-pixbuf gudev jpeg libpng soup speex taglib v4l2 \
"

[...]

PACKAGECONFIG[vpx]        = "--enable-vpx,--disable-vpx,libvpx"

现在您需要vp8enc,包括在vpx库中,但是,如您所见,PACKAGECONFIG变量不包含此选项。

您需要在meta :your-meta/repices-multimedia/gstreamer/gstreamer1.0-plugins-good_%.bbappend中添加一个带有此选项的your-meta/repices-multimedia/gstreamer/gstreamer1.0-plugins-good_%.bbappend文件,以使用此插件

代码语言:javascript
复制
PACKAGECONFIG_append=" vpx"

如果计划编写一个需要此vpx元素的菜谱,可以将其添加到RDEPENDS中:

代码语言:javascript
复制
DEPENDS=" gstreamer1.0 gstreamer1.0-plugins-good"

RDEPENDS_${PN}=" gstreamer1.0 \
                 gstreamer1.0-plugins-good-vpx "
票数 1
EN

Stack Overflow用户

发布于 2019-07-31 14:44:32

尝试重新安装gstreamer包,如gstreamer1.0-plugins-good, gstreamer1.0-plugins-bad, gstreamer1.0-plugins-uglygstreamer1.0-libav

以下软件包将提供:gStreamer1.0-音频链接,gStreer1.0-audiosource,gStreer1.0-视频链接,gStreer1.0-视频资源,gStreer1.0-可视化

libav具有编码40+格式的元素(MPEG、DivX、MPEG4、AC3、DV、.)、用于解码90+格式的解码元素(AVI、MPEG、OGG、Matroska、ASF、.)。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57291680

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档