Gstreamer over UDP between two RIoT boards with CAM8200-U

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Gstreamer over UDP between two RIoT boards with CAM8200-U

Jump to solution
1,913 Views
bozhidar1
Contributor II

Hey guys,

I've been stuck on something for quite some time and was curious if you have any ideas. It's my first time using the board or gstreamer or Linux at all, so bare with me.

I have been following few hundred tutorials for gstreamer and what I am trying to accomplish now, is to use gst-launch capture a video, transmit it over ethernet and save it on a second board.

CAM8200-U -> RIoT_1------Ethernet-----RIoT_2 -> Save file.

Both boards are running Linux Yocto v3.10.17.

Currently I am able to save the video with the following line: gst-launch-0.10 v4l2src device=/dev/video0 num-buffers=-1 ! 'video/x-raw-yuv,width=1024,height=768' ! queue ! ffmpegcolorspace ! vpuenc codec=0 ! matroskamux ! filesink location=output.mkv sync=false

What I want to accomplish is instead of saving the file with "filesink" on board 1 to use "udpsink" and send it over to the 2nd board, where I want to save it as a file. Then I want to get the file from the 2nd board and play it on a PC (which I know how to do, I want the video to be "playable" after saving).

Do you have any ideas for a way (gst-launch configuration) to receive this video or any other options? It is just a proof of concept, so I do not care about any formats, settings, etc. I just want to get video, stream it, save it and then be able to play it.

Thanks in advance!

Cheers,

Bozhidar

Some useful links:

CAM8200-U: https://www.element14.com/community/servlet/JiveServlet/previewBody/71630-102-1-303180/CAM8200-U%20U...

RIoT: Hardware | RIoTBoard - Revolutionizing the Internet of Things http://riotboard.org/hardware

gst-launch example: Connecting Cameras to the RIoTboard - YouTube

Labels (5)
0 Kudos
1 Solution
1,496 Views
bozhidar1
Contributor II

Hi Yuri,

The documentation you send me was not really helpful regarding this issue, but it helped me with another issues. Thanks!

My main issue was with getting the stream to work or in very details how to encrypt/decrypt/use the right caps, so it works.

I was able to do streaming and saving from RIoT to RIoT with the following options:

Sender:

gst-launch-0.10 v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=1024,height=768' ! ffmpegcolorspace ! vpuenc codec=5 ! rtph263pay ! udpsink host=192.168.1.104 port=5200

Receiver:

gst-launch-0.10 udpsrc port=5200 ! application/x-rtp, media=video, payload=96 ! rtph263depay ! vpudec ! matroskamux ! filesink location=video3.mkv

Quite strange was that if I use avimux instead of matroskamux the video plays back on 5x speed. No idea why, but it doesn't matter at this point. Moreover, these options will not work from a RIoTboard to a PC, just because there is no vpudec option in Ubuntu (or at least don't how to add it). Maybe using different way to decrypt the H.263 will work.

This stream works with different options for vpuenc (codec=0 MPEG4, 5 H.263 and 6 H.264). You have to change also rtp___(de)pay with mp4v (for MPEG4), h263 (for H.263) and h264 (for H.264).

Thanks for the help anyways!

View solution in original post

0 Kudos
3 Replies
1,497 Views
bozhidar1
Contributor II

Hi Yuri,

The documentation you send me was not really helpful regarding this issue, but it helped me with another issues. Thanks!

My main issue was with getting the stream to work or in very details how to encrypt/decrypt/use the right caps, so it works.

I was able to do streaming and saving from RIoT to RIoT with the following options:

Sender:

gst-launch-0.10 v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=1024,height=768' ! ffmpegcolorspace ! vpuenc codec=5 ! rtph263pay ! udpsink host=192.168.1.104 port=5200

Receiver:

gst-launch-0.10 udpsrc port=5200 ! application/x-rtp, media=video, payload=96 ! rtph263depay ! vpudec ! matroskamux ! filesink location=video3.mkv

Quite strange was that if I use avimux instead of matroskamux the video plays back on 5x speed. No idea why, but it doesn't matter at this point. Moreover, these options will not work from a RIoTboard to a PC, just because there is no vpudec option in Ubuntu (or at least don't how to add it). Maybe using different way to decrypt the H.263 will work.

This stream works with different options for vpuenc (codec=0 MPEG4, 5 H.263 and 6 H.264). You have to change also rtp___(de)pay with mp4v (for MPEG4), h263 (for H.263) and h264 (for H.264).

Thanks for the help anyways!

0 Kudos
1,496 Views
bozhidar1
Contributor II

Additional info: To stream H.264 between 2 RIoTboards with short delay (~200ms)

Sender:

gst-launch-0.10 v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=640,height=480' ! ffmpegcolorspace ! vpuenc codec=6 ! rtph264pay ! udpsink host=192.168.1.103 port=5200 --gst-debug=2

Receiver:

gst-launch-0.10 udpsrc port=5200 ! application/x-rtp, media=video, payload=96, encoding-name=H264 ! rtph264depay ! vpudec low-latency=true ! autovideosink --gst-debug=2

0 Kudos
1,496 Views
Yuri
NXP Employee
NXP Employee

Hello,

  You may look at sections 7.3.10 (Web camera)  and

7.3.13 (RTP/UDP MPEGTS streaming) of "i.MX_Linux_User's_Guide.pdf".

https://www.nxp.com/webapp/Download?colCode=L3.14.52_1.1.0_LINUX_DOCS&location=null&fpsp=1&WT_TYPE=S...


Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos