我想通過IP將流量從一臺PC傳輸到另一臺。這全部通過命令行。首先我試試:無法顯示通過UDP與GStreamer流式傳輸的h.264攝像頭圖像
#gst-launch v4l2src! xvimagesink
這工作正常,並啓動網絡攝像頭,並給出顯示圖片/視頻。然後我嘗試將網絡攝像頭通過udp流式傳輸到另一臺PC。
gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=320,height=240' ! x264enc pass=qual quantizer=20 tune=zerolatency ! rtph264pay ! udpsink host=127.0.0.1 port=1234 sync=false
在目標電腦我開始這樣的:
gst-launch -v udpsrc port=1234 ! fakesink dump=1
凡在外殼我看到:
00000000 (0x7f2ebc004a70): 80 e0 18 2b 7a 74 25 94 2b 28 22 2d 5c 41 73 0c ...+zt%.+("-\As.
00000010 (0x7f2ebc004a80): a5 12 72 91 4b 97 36 f6 8f 12 46 d9 45 5f cf ac ..r.K.6...F.E_..
00000020 (0x7f2ebc004a90): 92 80 33 35 c2 65 37 d5 f0 1e f0 70 d6 95 b2 3d ..35.e7....p...=
00000030 (0x7f2ebc004aa0): 52 82 53 f7 fe 47 be 62 30 39 e9 97 c9 bb 56 de R.S..G.b09....V.
00000040 (0x7f2ebc004ab0): b1 d3 eb d0 f1 49 90 7b bc 23 9b 9f ab 1e ee 72 .....I.{.#.....r
00000050 (0x7f2ebc004ac0): ff 61 41 ac 8e 54 b9 96 16 ba 4d 37 f6 67 8e ce .aA..T....M7.g..
00000060 (0x7f2ebc004ad0): 1a 8b 6b 9a 06 f0 31 51 25 e2 b0 a6 73 55 23 76 ..k...1Q%...sU#v
00000070 (0x7f2ebc004ae0): 02 e8 97 60 ec 77 52 1d 3d 1c 55 52 5c 24 5a fb ...`.wR.=.UR\$Z.
00000080 (0x7f2ebc004af0): ae 6f d7 bb 0a 18 bf bb 72 43 7e c2 76 ab fc ca .o......rC~.v...
00000090 (0x7f2ebc004b00): ba dd a0 e5 f5 ea 61 2b 1c 77 da ab 44 62 4f 60 ......a+.w..DbO`
000000a0 (0x7f2ebc004b10): 78 83 d3 1a 54 f7 a9 af 15 4b db 08 6d 43 31 a5 x...T....K..mC1.
所以,在我看來,這是工作流的圖像。現在,我嘗試在屏幕上顯示它。我用此顯示流:
gst-launch -v udpsrc port=1234 ! application/x-rtp,clockrate=90000,payload=96 ! rtph264depay queue-delay=0 ! ffdec_h264 ! xvimagesink
但它不顯示攝像頭;而是在我得到的外殼:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = application/x-rtp, clockrate=(int)90000, payload=(int)96, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:src: caps = video/x-h264
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = application/x-rtp, clockrate=(int)90000, payload=(int)96, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/ffdec_h264:ffdec_h2640.GstPad:sink: caps = video/x-h264
/GstPipeline:pipeline0/ffdec_h264:ffdec_h2640.GstPad:src: caps = video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)30/1, format=(fourcc)I420, interlaced=(boolean)false, pixel-aspect-ratio=(fraction)1/1
ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2543): gst_base_src_loop(): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 79200858888 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
/GstPipeline:pipeline0/ffdec_h264:ffdec_h2640.GstPad:src: caps = NULL
/GstPipeline:pipeline0/ffdec_h264:ffdec_h2640.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = NULL
Setting pipeline to NULL ...
Freeing pipeline ...
我不知道我在做什麼錯。所有這些都在CentOS 6.3上,我安裝了GStreamer 10.29以及所有插件(基礎,好的,壞的,醜陋的)和gstreamer-ffmpeg,它們都來自版本庫http://pkgrepo.linuxtech.net/el6/release/linuxtech.repo。
我想你的管道(用'videotestsrc')和它的作品「的那種「確定(即,我得到輟學,但可以看到一張圖片)。可能你應該嘗試設置'udspsrc'出現的上限與進入'udpsink'的完全相同的上限 - 使用'gst-launch -v'來獲得生產者的全部上限) –