【问题标题】:gstreamer-imx video streaming and encodinggstreamer-imx 视频流和编码
【发布时间】:2020-10-29 11:41:18
【问题描述】:

我目前正在使用 Nitrogen 6 Max 开发板。我正在尝试通过 v4l2src 从我的网络摄像头检索视频,以便对反馈进行流式传输和编码以保存。

这是管道,它可以工作:

  v4l2src device="/dev/video2" ! tee name=t
      t. ! queue ! x264enc ! mp4mux ! filesink location=test.mp4
      t. ! queue ! videoconvert ! autovideosink

然后我尝试使用 imx-gstreamer 库。我花了一些时间环顾四周,发现这行得通:

   gst-launch-1.0 -e videotestsrc num-buffers=1000 ! \
       video/x-raw,width=640,height=480,framerate=30/1 ! imxvpuenc_h264 ! \
       h264parse !  avdec_h264 ! filesink location=cx1.mp4

但是,当我尝试使用“tee”来分割视频源时,它只是冻结并且我的终端会话被锁定。

   gst-launch-1.0 -e videotestsrc num-buffers=1000 ! autovideoconvert ! tee name=t \
       t. ! video/x-raw,width=640,height=480,framerate=30/1 ! imxvpuenc_h264 ! h264parse ! avdec_h264 ! filesink location=cx1.mp4 \
       t. ! video/x-raw,width=640,height=480,framerate=30/1 ! autovideosink

我尝试通过 tee 编码来隔离问题,并意识到它可以运行,但它生成的视频文件已损坏:

   gst-launch-1.0 -e videotestsrc num-buffers=1000 ! tee name=t \
       t. ! video/x-raw,width=640,height=480,framerate=30/1 ! imxvpuenc_h264 ! \
       h264parse !  avdec_h264 ! filesink location=cx1.mp4

我尝试使用队列、videoconvert,但它似乎不起作用。

另外,这里还有一个问题。我是 GstElement 功能的新手,它决定了可以链接哪个元素(即,v4l2src 视频/x-raw 功能包括 I420,这就是为什么我可以将此元素链接到 imxvpuenc_h264)。但是对于元素tee,是不是拆分复制了src的能力呢?

我是 gstreamer 的新手,我似乎无法解决这个问题。有人可以帮我吗?

【问题讨论】:

    标签: gstreamer-1.0 imx6


    【解决方案1】:

    一些提示可以帮助您:

    • 通常,您始终在 tee 的输出端使用队列,以免阻塞您的管道。
    • 避免阻塞的另一个选项是在接收器元素中设置async=false
    • 尝试将dts-method=2 设置为mp4mux,看看是否会有所不同。
    • gstreamer 工作时的第一条故障排除线是使用调试。请检查并分享GST_DEBUG=2 gst-launch-1.0 ... 的输出。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-05
      • 2016-11-01
      • 1970-01-01
      • 2022-12-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多