GStreamer/iMX6:通过串口在 iMX6 和 PC 之间传输 h264 编码视频
GStreamer/iMX6: streaming h264 encoded video over serial port between iMX6 and PC
最近开始做一个项目,目标是基于imx6处理器的视频直播应用。简要描述我到目前为止所做的事情以及我正在尝试做的事情:
- 设置:imx6 板(边界设备 Sabre Lite)充当视频服务器(使用 GStreamer imx 插件),PC 运行ning Ubuntu 在其上接收来自 imx6 和流的数据使用 GStreamer 功能的视频。
- 在 imx6 处理器上,我 运行 'testvideosrc' 并使用 imx6 和 PC 之间的以太网接口使用 UDP 上的 RTP 成功地流式传输它。
- 使用Linux中的设备文件访问串口,接下来我尝试将视频数据从imx6板转储到串口并在PC上读取这个串口。为此,两个设备的波特率都配置为 115200 波特。编码 'bitrate' 配置为 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 …
由于编码速率为5Kbps(bitrate=5,如上命令中指定的),我想通过串口发送这个数据量是可以的。我知道目前上限谈判失败了,但是,我不确定如何进行。
PC端用'cat /dev/ttyUSB1'读取串口成功,数据有限。数据不可读(正如预期的那样),但它不是连续的流。
有没有人知道如何解决这个问题。我还认为,当我尝试使用 GStreamer 读取串行数据文件时,我误解了 Linux 设备文件的用法。
我后来的测试是使用实际的相机 (MIPI) 并尝试通过串口传输它。这看起来可行还是一个完全疯狂的想法?
使用以下命令,我可以在波特率为 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
最近开始做一个项目,目标是基于imx6处理器的视频直播应用。简要描述我到目前为止所做的事情以及我正在尝试做的事情:
- 设置:imx6 板(边界设备 Sabre Lite)充当视频服务器(使用 GStreamer imx 插件),PC 运行ning Ubuntu 在其上接收来自 imx6 和流的数据使用 GStreamer 功能的视频。
- 在 imx6 处理器上,我 运行 'testvideosrc' 并使用 imx6 和 PC 之间的以太网接口使用 UDP 上的 RTP 成功地流式传输它。
- 使用Linux中的设备文件访问串口,接下来我尝试将视频数据从imx6板转储到串口并在PC上读取这个串口。为此,两个设备的波特率都配置为 115200 波特。编码 'bitrate' 配置为 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 …
由于编码速率为5Kbps(bitrate=5,如上命令中指定的),我想通过串口发送这个数据量是可以的。我知道目前上限谈判失败了,但是,我不确定如何进行。
PC端用'cat /dev/ttyUSB1'读取串口成功,数据有限。数据不可读(正如预期的那样),但它不是连续的流。
有没有人知道如何解决这个问题。我还认为,当我尝试使用 GStreamer 读取串行数据文件时,我误解了 Linux 设备文件的用法。
我后来的测试是使用实际的相机 (MIPI) 并尝试通过串口传输它。这看起来可行还是一个完全疯狂的想法?
使用以下命令,我可以在波特率为 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