【问题标题】:GStreamer/iMX6: streaming h264 encoded video over serial port between iMX6 and PCGStreamer/iMX6:在 iMX6 和 PC 之间通过串行端口流式传输 h264 编码视频
【发布时间】:2018-12-04 02:36:50
【问题描述】:

最近,我开始从事一个项目,该项目旨在基于 imx6 处理器的实时视频流应用程序。简要描述一下我到目前为止所做的事情以及我正在尝试做的事情:

  1. 设置:imx6 板(边界设备 Saber Lite)充当视频服务器(使用 GStreamer imx 插件),以及在其上运行 Ubuntu 的 PC,从 imx6 接收数据并使用 GStreamer 功能流式传输视频。
  2. 在 imx6 处理器上,我运行了“testvideosrc”,并使用 imx6 和 PC 之间的 eternet 接口通过 UDP 使用 RTP 成功流式传输了它。
  3. 在Linux中使用设备文件访问串口,接下来我尝试将视频数据从imx6板转储到串口并在PC上读取这个串口。为此,两个设备的波特率均配置为 115200 波特。编码“比特率”配置为 5Kbps。以下是命令:

IMX6:

#gst-launch-1.0 -v videotestsrc pattern=18 ! video/x- raw,width=100,height=50 ! imxvpuenc_h264 bitrate=5 ! h264parse ! filesink location=/dev/ttyUSB1 

电脑:

#CAPS=video/x-h264 
#gst-launch-1.0 -v filesrc location=/dev/ttyUSB1 ! $CAPS ! h264parse ! avdec_h264 ! autovideosink sync=true 

在 imx6 板上没有观察到错误。 但是,我在 PC 端看到以下错误:

# GST_DEBUG=3 gst-launch-1.0 -v filesrc location=/dev/ttyUSB1 ! $CAPS ! h264parse ! avdec_h264 ! autovideosink sync=true 
  Setting pipeline to PAUSED … 
  0:00:00.066439392 15475 0x556d8a01d160 WARN basesrc gstbasesrc.c:3583:gst_base_src_start_complete: pad not activated yet 
  Pipeline is PREROLLING … 
  0:00:21.730466251 15475 0x556d8a000940 WARN capsfilter 
  gstcapsfilter.c:455:gst_capsfilter_prepare_buf: error: Filter caps do not completely specify the output format 
  0:00:21.730523691 15475 0x556d8a000940 WARN capsfilter gstcapsfilter.c:455:gst_capsfilter_prepare_buf: error: Output caps are unfixed: video/x-h264, width=(int)[ 1, 8192 ], height=(int)[ 1, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ] 
  0:00:21.730676173 15475 0x556d8a000940 WARN basetransform gstbasetransform.c:2159:default_generate_output: could not get buffer from pool: error 
  0:00:21.730742223 15475 0x556d8a000940 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop: error: Internal data stream error. 
  0:00:21.730775478 15475 0x556d8a000940 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop: error: streaming stopped, reason error (-5) 
  ERROR: from element /GstPipeline:pipeline0/GstCapsFilter:capsfilter0: Filter caps do not completely specify the output format 
  Additional debug info: 
  gstcapsfilter.c(455): gst_capsfilter_prepare_buf (): /GstPipeline:pipeline0/GstCapsFilter:capsfilter0: 
  Output caps are unfixed: video/x-h264, width=(int)[ 1, 8192 ], height=(int)[ 1, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ] 
  ERROR: pipeline doesn’t want to preroll. 
  Setting pipeline to NULL … 
  Freeing pipeline … 
  1. 由于编码率为5Kbps(bitrate=5,如上面命令中指定的),我想通过串口发送这么多数据是可能的。我意识到目前,上限谈判失败,但是,我不确定如何进行。

  2. 在 PC 端,使用“cat /dev/ttyUSB1”读取串行端口成功,但数据有限。数据不可读(如预期的那样),但它不是连续的流。

有没有人知道如何解决这个问题。我还认为,当我尝试使用 GStreamer 读取串行数据文件时,我误解了 Linux 设备文件的用法。

我稍后的测试是使用实际的相机 (MIPI) 并尝试通过串行端口对其进行流式传输。这看起来可行还是完全疯狂的想法?

【问题讨论】:

  • 上述问题已通过以下方式解决:CAPS=video/x-h264,width=100,height=50,framerate=30/1
  • 但是,在 PC 端,GStreamer 不显示任何视频。我原以为会看到一个弹出窗口并显示 videotestsrc 模式,但事实并非如此。我尝试了不同的比特率(1、5、10、50),结果是一样的。有没有人对我如何继续这个有更多的建议。

标签: serial-port video-streaming gstreamer h.264 imx6


【解决方案1】:

使用以下命令,我可以在波特率为 19200 的串行上运行它。但是,延迟在 5-6 秒范围内非常高。在波特率为 1M 的情况下,它可以在小于 1 秒的延迟下工作。

imx6:

gst-launch-1.0 -v videotestsrc pattern=18 ! video/x-raw,width=100,height=50
! imxvpuenc_h264 bitrate=5 ! h264parse ! filesink location=/dev/ttyUSB0
blocksize=1024 max-bitrate=19000 sync=false

电脑:

gst-launch-1.0 -v filesrc location=/dev/ttyUSB1 blocksize=1024 ! $CAPS !
h264parse ! avdec_h264 lowres=2 skip-frame=0 ! autovideosink sync=false 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-01-26
    • 1970-01-01
    • 2012-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-17
    相关资源
    最近更新 更多