IMX6 : Video streaming over serial port using Gstreamer and H264 encoder

James Cameron quozl at laptop.org
Tue Jun 26 21:30:50 UTC 2018


I do think the IO does stall, easily demonstrated mathematically, but
I wasn't saying that was a problem.  Unless you have configured the
serial ports properly, this won't work.  You haven't answered those
parts of my mail, so I'm worried you may have missed it.  I'll go into
more detail.

To check serial port configuration;

stty < /dev/PORT

or

stty --all < /dev/PORT

Without configuration, the default is not binary safe.  Certain
characters cause process signals unless disabled with -icanon or raw.
An -echo is also useful as it prevents the receiving host from sending
back what was received.

An example test on Ubuntu 16.04 using two serial ports;

1.  make a test file of binary random numbers; pick a suitable size,
my choice was 1 MB for a 115200 baud test,

# dd if=/dev/urandom of=test bs=1024k count=1

2.  test the file

# sha256sum test

3.  set serial ports to raw, no echo,

# stty 115200 raw -echo < /dev/ttyUSB0
# stty 115200 raw -echo < /dev/ttyUSB1

4.  in one terminal, start receiving,

# pv /dev/ttyUSB1 > test.received

5.  in another terminal, start transmitting,

# pv test > /dev/ttyUSB0

6.  when the transmission is finished, stop the receiver with ctrl-c,

7.  compare the file sizes, they should be equal,

# ls -l tes*
-rw-r--r-- 1 root root 1048576 Jun 27 06:29 test
-rw-r--r-- 1 root root 1048576 Jun 27 06:32 test.received

8.  compare the file sha256sum,

9.  if there is a difference, use a binary comparison program, or
hexdump each file and use a textual differences program,

p.s. also remove or disable Modem Manager, as on Ubuntu it will often
probe any newly attached serial port.  The probing can interfere.

On Tue, Jun 26, 2018 at 03:55:58AM -0700, vk_gst wrote:
> Hi James,
> 
> Thanks for your answer. 
> 
> 1. I do not think the IO is stalled, because at the PC side, the terminal
> keeps running without any error messages. The below is the output of
> terminal at the PC side: 
> 
> root at linux-GP60-2PE:/home/linux# gst-launch-1.0 -v  filesrc
> location=/dev/ttyUSB0 ! $CAPS  ! h264parse  ! avdec_h264 ! autovideosink
> silent=false
> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
> /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps =
> video/x-h264, width=(int)100, height=(int)50, framerate=(fraction)10/1
> /GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps =
> video/x-h264, width=(int)100, height=(int)50, framerate=(fraction)10/1
> 
> 
> 2. Before beginning this test, I have connected the serial devices via
> HyperTerminal in window and tested by sending and receiving some random
> bytes of data. It worked fine. However, I did not do any binary comparison
> of the data received
> 
> 3. I resolved the caps negotiation error with the following: 
> CAPS=video/x-h264,width=100,height=50,framerate=10/1
> 
> The output now is as shown in the point 1. There is no pop-up window that
> displays the video received on the PC. 
> 
> Do you have any more suggestions on to see whats going on behind the
> commands? ;)
> Also what other approach can I try to get GStreamer display the video?
> 
> Regards.
> 
> 
> 
> 
> 
> 
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-- 
James Cameron
http://quozl.netrek.org/


More information about the gstreamer-devel mailing list