开发者

gstreamer rtp streaming webcam

开发者 https://www.devze.com 2023-02-21 10:15 出处:网络
im trying to stream my webcam using OpenCV and gstreamer... for this first i test using the command line with this:

im trying to stream my webcam using OpenCV and gstreamer... for this first i test using the command line with this:

gst-launch v4l2src ! ffmpegcolorspace ! theoraenc ! rtptheorapay ! udpsink host=localhost port=5000 sync=false -v

Then i try to see the streaming using this command line:

gst-launch udpsrc port=5000 caps="video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, width=(int)640, height=(int)480, interlaced=(boolean)false" ! rtptheoradepay ! theoradec ! ximagesink

But i get an error: could not link udpsrc0 to rtptheoradepay0 and could not link udpsrc0 to rtptheoradepay0

then i try to use vlc to see what i get from webcam using rtp://@localhost:5000 but nothing happend ...

what i'm do wrong???

I'm running Ubun开发者_开发技巧tu 10.10 with gstreamer and plugins compiled from git repositorie...

Thanks in advance!!


Theora decoder needs additional configuration parameter. Here is excerpt from the specification:

Theora makes the same controversial design decision that Vorbis made to include the entire probability model for the DCT coefficients and all the quan- tization parameters in the bitstream headers. This is often several hundred fields. It is therefore impossible to decode any frame in the stream without having previously fetched the codec info and codec setup headers.

You can see this configuration parameters as a loooong base64 encoded string in the gst-launch verbose output:

/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)THEORA, sampling=(string)YCbCr-4:2:0, width=(string)640, height=(string)480, configuration=(string)\"AAAAAbkkHgqZ...gA\\=\\=\", delivery-method=(string)inline, payload=(int)96, ssrc=(guint)109069492, clock-base=(guint)1126428223, seqnum-base=(guint)23181

You need to copy this string and paste it to the receiving gst-launch script:

$ gst-launch \
    udpsrc \
      port=5000 \
      caps="video/x-raw-yuv \
           ,format=I420 \
           ,framerate=30/1 \
           ,width=640,height=480 \
           ,interlaced=false \
           ,configuration=(string)\"AAAAAbkkHgqZ...gA\\=\\=\"" \
    ! rtptheoradepay \
    ...

If you don't change video encoding parameters (size, bitrate, etc) this string will remain the same. So, you can just hardcode it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号