GStreamer - Webcam stream from Raspberry to VLC-PC

前端 未结 1 970
北海茫月
北海茫月 2020-12-06 08:17

I\'m trying to stream webcam video from a Raspberry to a VLC player using gstreamer 1.0. Right now i got the following command for the Raspberry:

gst-launch-         


        
相关标签:
1条回答
  • 2020-12-06 08:32

    VLC understand ts stream combined with RTP protocol. The approach is to use rtp payloader after mpegtsmux which will payload the generated ts buffers (packets).

    So instead of this:

    src ! queue ! x264enc ! h264parse ! rtph264pay ! udpsink
    

    You can do this:

    src ! queue ! x264enc ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink
    

    And then use just rtp://@:port in vlc In this way the mpegtsmux will encapsulate information about what streams does it contains

    I should note that your approach is not incorrect, and could be even more effective (mpegtsmux will slice video into 188 Byte packets, but your approach will slice into ~ 1400 Bytes udp packets), but you need to provide correct SDP file for vlc in order to stream it. For example like this but I do not have much experience with this..

    So this is your current pipe which works:

    gst-launch-1.0 -vv -e v4l2src device=/dev/video0 ! "video/x-raw,width=352,height=288,framerate=25/1"\ ! queue ! x264enc speed-preset=1 ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink host=192.255.10.41 port=5004
    

    You can maybe achieve better results when using zerolatency:

    like this x264enc tune=4 it will discard all other quality parameters like speed-preset etc..

    This is from docs about tune property:

    tune : Preset name for non-psychovisual tuning options
           flags: readable, writable
           Flags "GstX264EncTune" Default: 0x00000000, "(none)"
           (0x00000001): stillimage       - Still image
           (0x00000002): fastdecode       - Fast decode
           (0x00000004): zerolatency      - Zero latency
    
    0 讨论(0)
提交回复
热议问题