2012-11-15 51 views
3

我想通过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

+0

我想你的管道(用'videotestsrc')和它的作品“的那种“确定(即,我得到辍学,但可以看到一张图片)。可能你应该尝试设置'udspsrc'出现的上限与进入'udpsink'的完全相同的上限 - 使用'gst-launch -v'来获得生产者的全部上限) –

回答

相关问题