Skip to main content
Visitor II
June 7, 2022
Solved

How to stream camera over network

  • June 7, 2022
  • 1 reply
  • 2785 views

I am a beginner with STM32MPUs and I've been trying to follow the example: How to stream camera over network (can't add links because I'm a new member but it's in ST Wiki)

I'm trying to stream the video from an USB Webcam connected to the STM32MP157F-DK2 over the network to another Ubuntu PC running on a virtual machine.

Unfortunately it doesn work. When I run:

v4l2-ctl --set-parm=30;v4l2-ctl --set-fmt-video=width=640,height=480,pixelformat=JPEG --stream-mmap --stream-count=-1 --stream-to=- 2>/dev/null | gst-launch-1.0 fdsrc ! jpegparse ! rtpjpegpay ! udpsink host=192.168.0.9 port=5000

I see the webcam's LED on and I get the following output:

Frame rate set to 10.000 fps
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

Then, when I run the command below on the host PC side, nothing happens.

gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, encoding-name=JPEG ! rtpjpegdepay ! jpegparse ! decodebin ! videoconvert ! autovideosink

I have been able to test the webcam and I can see the video on the DK2's display using the following command

gst-launch-1.0 v4l2src device="/dev/video0" ! videoconvert ! autovideosink

Any ideas on what could be wrong with my test?

    This topic has been closed for replies.
    Best answer by OlivierK

    Hi LMarq.4 (Community Member)

    Can you double check that you can ping the host 192.168.0.9 from the target?

    I reproduced the test on an MP15-EV1 board with the ov5640 sensor, using the ethernet over usb cable to the host.

    On the Host side:

    enxbc141b6e675f: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

        inet 192.168.7.229

    On target side:

    root@stm32mp1:~# ifconfig 

    usb0   Link encap:Ethernet HWaddr EA:FA:3B:72:75:98             

         inet addr:192.168.7.1 Bcast:192.168.7.255 Mask:255.255.255.0     

     Target side:    

    root@stm32mp1:~# v4l2-ctl --set-parm=30;v4l2-ctl --set-fmt-video=width=640,heigh

    t=480,pixelformat=JPEG --stream-mmap --stream-count=-1 --stream-to=- 2>/dev/null

     | gst-launch-1.0 fdsrc ! jpegparse ! rtpjpegpay ! udpsink host=192.168.7.229 po

    rt=5000                                     

    Frame rate set to 30.000 fps                           

    Setting pipeline to PAUSED ...                          

    Pipeline is PREROLLING ...                            

    Pipeline is PREROLLED ...                            

    Setting pipeline to PLAYING ...                         

    New clock: GstSystemClock  

    Host side:

    $ gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, encoding-name=JPEG ! rtpjpegdepay ! jpegparse ! decodebin ! videoconvert ! autovideosink

    Setting pipeline to PAUSED ...

    Pipeline is live and does not need PREROLL ...

    Setting pipeline to PLAYING ...

    New clock: GstSystemClock

    Then a gst-launch-1.0 pop up window pops up on host, displaying the video capture.

    Rgds,

    Olivier

    1 reply

    OlivierKAnswer
    Technical Moderator
    June 10, 2022

    Hi LMarq.4 (Community Member)

    Can you double check that you can ping the host 192.168.0.9 from the target?

    I reproduced the test on an MP15-EV1 board with the ov5640 sensor, using the ethernet over usb cable to the host.

    On the Host side:

    enxbc141b6e675f: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

        inet 192.168.7.229

    On target side:

    root@stm32mp1:~# ifconfig 

    usb0   Link encap:Ethernet HWaddr EA:FA:3B:72:75:98             

         inet addr:192.168.7.1 Bcast:192.168.7.255 Mask:255.255.255.0     

     Target side:    

    root@stm32mp1:~# v4l2-ctl --set-parm=30;v4l2-ctl --set-fmt-video=width=640,heigh

    t=480,pixelformat=JPEG --stream-mmap --stream-count=-1 --stream-to=- 2>/dev/null

     | gst-launch-1.0 fdsrc ! jpegparse ! rtpjpegpay ! udpsink host=192.168.7.229 po

    rt=5000                                     

    Frame rate set to 30.000 fps                           

    Setting pipeline to PAUSED ...                          

    Pipeline is PREROLLING ...                            

    Pipeline is PREROLLED ...                            

    Setting pipeline to PLAYING ...                         

    New clock: GstSystemClock  

    Host side:

    $ gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, encoding-name=JPEG ! rtpjpegdepay ! jpegparse ! decodebin ! videoconvert ! autovideosink

    Setting pipeline to PAUSED ...

    Pipeline is live and does not need PREROLL ...

    Setting pipeline to PLAYING ...

    New clock: GstSystemClock

    Then a gst-launch-1.0 pop up window pops up on host, displaying the video capture.

    Rgds,

    Olivier