关于Gstrteamer udp和 v4l2src测试问题

第一组:

接收:gst-launch-0.10 udpsrc port=1234 ! theoradec ! ffmpegcolorspace ! ximagesink

发送:gst-launch-0.10 v4l2src ! ffmpegcolorspace ! theoraenc ! udpsink host=127.0.0.1 port=1234

这组可以成功显示摄像头图片

放心使用也可以把ximagesink换成xvimagesink没有影响。


注意要先执行接收命令


第二组:

1. To send


gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=640,height=480' !  x264enc pass=qual quantizer=20 tune=zerolatency ! rtph264pay ! udpsink host=127.0.0.1 port=1234


2. To receive

gst-launch udpsrc port=1234 ! "application/x-rtp, payload=127" ! rtph264depay ! ffdec_h264 ! xvimagesink sync=false

这组有点为题

我想先遇到:WARNING: erroneous pipeline: no element "x264enc"

解决方法是:apt-get install gstreamer0.10-plugins-ugly-multiverse
又提示:WARNING: erroneous pipeline: no property "tune" in element "x264enc0"

我把tune=zerolatency零延迟去掉提示:gst_base_src_loop (): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming task paused, reason not-negotiated (-4)

我就糊涂了没有解决

高手们知道的可以通知我一下哦!!!!谢谢!!

在网上有找了一组还没有测试,有条件的可以测试一下

1) RTP send webcam and audio

gst-launch gstrtpbin name=rtpbin latency=0 v4l2src device=/dev/video0 ! typefind ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv, width=640, height=480 ! videorate ! video/x-raw-yuv, framerate=30/1 ! ffenc_mpeg4 ! rtpmp4vpay send-config=true ! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 ! udpsink port=5502 host=127.0.0.1 rtpbin.send_rtcp_src_0 ! udpsink port=5510 host=127.0.0.1 sync=false async=false udpsrc port=5510 ! rtpbin.recv_rtcp_sink_0 autoaudiosrc samplesperbuffer=1000 ! alawenc ! rtppcmapay ! rtpbin.send_rtp_sink_1 rtpbin.send_rtp_src_1 ! udpsink port=5504 host=127.0.0.1 rtpbin.send_rtcp_src_1 ! udpsink port=5512 host=127.0.0.1 sync=false async=false udpsrc port=5512 ! rtpbin.recv_rtcp_sink_1




2) RTP receive webcam and audio

gst-launch gstrtpbin name=rtpbin2 latency=0 udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP4V-ES, profile-level-id=(string)1" port=5502 ! rtpbin2.recv_rtp_sink_0 rtpbin2. ! rtpmp4vdepay ! ffdec_mpeg4 ! videoscale ! video/x-raw-yuv, width=640, height=480 ! videorate ! video/x-raw-yuv, framerate=30/1 ! ffmpegcolorspace ! autovideosink udpsrc port=5510 ! rtpbin2.recv_rtcp_sink_0 rtpbin2.send_rtcp_src_0 ! udpsink host=127.0.0.1 port=5510 sync=false async=false udpsrc caps="application/x-rtp,media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMA" port=5504 ! rtpbin2.recv_rtp_sink_1 rtpbin2. ! rtppcmadepay ! alawdec ! autoaudiosink buffer-time=10000 udpsrc port=5512 ! rtpbin2.recv_rtcp_sink_1 rtpbin2.send_rtcp_src_1 ! udpsink host=127.0.0.1 port=5512 sync=false async=false


第四组:

send:

gst-launch-0.10 -v gstrtpbin name=rtpbin v4l2src device=/dev/video0 ! videorate ! videoscale ! ffmpegcolorspace ! 'video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)15/1' !  rtpvrawpay ! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 ! multiudpsink clients="127.0.0.1:9996" rtpbin.send_rtcp_src_0 ! multiudpsink clients="127.0.0.1:9997" sync=false async=false udpsrc port=10000 ! rtpbin.recv_rtcp_sink_0

recv:

gst-launch  udpsrc caps=" application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:0, depth=(string)8, width=(string)320, height=(string)240, colorimetry=(string)SMPTE240M, ssrc=(guint)4294234526, payload=(int)96, clock-base=(guint)520513122, seqnum-base=(guint)28177" port=9996 ! queue ! rtpvrawdepay  ! queue ! ffmpegcolorspace ! autovideosink

recv的caps=" "要根据send命令得到caps重新填写,注意!!!!

第五组:

生成avi文件

gst-launch v4l2src ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! jpegenc ! avimux ! filesink location=osug-1.avi

生成ogg文件

gst-launch v4l2src ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=osug-1.ogg

结合第四组和第五组的分流处理:显示与生成文件同时进行

send 同第四组一样

recv-to-display-and-avi

gst-launch  udpsrc caps=" application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:0, depth=(string)8, width=(string)320, height=(string)240, colorimetry=(string)SMPTE240M, ssrc=(guint)4294234526, payload=(int)96, clock-base=(guint)520513122, seqnum-base=(guint)28177" port=9996 ! queue ! rtpvrawdepay  ! queue ! tee name="splitter" ! queue ! ffmpegcolorspace ! autovideosink splitter. ! queue ! ffmpegcolorspace ! jpegenc ! avimux ! filesink location=osug-udp-2.avi


你可能感兴趣的:(gstreamer,udpsrc,udpsink,v4l2src)