2009-12-10 6 views
7

Je suis en train de développer une application GStreamer et un peu difficile avec l'implémentation d'un lecteur pour les flux RTP entrants. J'essaye de construire un pipeline autour de l'élément gstrtpbin. Je suis en train de modéliser le pipeline à l'aide d'une construction gst-launch:Lecture d'un flux RTP entrant avec GStreamer

VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" 

gst-launch -v udpsrc caps=$VIDEO_CAPS port=4444 \ 
       ! gstrtpbin .recv_rtp_sink_0 \ 
       ! rtph264depay ! ffdec_h264 ! xvimagesink 

Quand je lance le script GStreamer signale ces erreurs:

Setting pipeline to PAUSED ... 
Pipeline is live and does not need PREROLL ... 
Setting pipeline to PLAYING ... 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0: ntp-ns-base = 3469468914024449000 
New clock: GstSystemClock 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0.GstProxyPad:proxypad0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSsrcDemux:rtpssrcdemux0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpPtDemux:rtpptdemux0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_src_0_960476599_33.GstProxyPad:proxypad1: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)33 
ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data flow error. 
Additional debug info: 
gstbasesrc.c(2378): gst_base_src_loop(): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: 
streaming task paused, reason not-linked (-1) 
Execution ended after 209381685 ns. 
Setting pipeline to PAUSED ... 
Setting pipeline to READY ... 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_src_0_960476599_33: caps = NULL 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpPtDemux:rtpptdemux0.GstPad:src_33: caps = NULL 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpPtDemux:rtpptdemux0.GstPad:sink: caps = NULL 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:sink: caps = NULL 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:src: caps = NULL 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSsrcDemux:rtpssrcdemux0.GstPad:src_960476599: caps = NULL 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSsrcDemux:rtpssrcdemux0.GstPad:sink: caps = NULL 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_src: caps = NULL 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_sink: caps = NULL 
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0: caps = NULL 
/GstPipeline:pipeline0/GstUDPSrc:udpsrc0.GstPad:src: caps = NULL 
Setting pipeline to NULL ... 
Freeing pipeline ... 

Je dois dire que cela fonctionne avec un playbin et SDP fichier. Par exemple, ce fichier:

v=0 
o=- 1188340656180883 1 IN IP4 127.0.0.1 
s=Session streamed by GStreamer 
i=server.sh 
t=0 0 
a=tool:GStreamer 
a=type:broadcast 
m=video 4444 RTP/AVP 96 
c=IN IP4 127.0.0.1 
a=rtpmap:96 H264/90000 

peut être utilisé pour lire le flux comme celui-ci:

gst-launch -vvv playbin uri=file://`pwd`/stream.sdp 

Pour être complet: J'utilise VLC pour envoyer des données. C'est la commande:

vlc -I rc /usr/local/movies/sample.mp4 \ 
    --screen-fps=10 :screen-caching=100 \ 
    --sout='#transcode{vcodec=h264,venc=x264{bframes=0,keyint=40},vb=512}:\ 
        rtp{mux=ts,dst=127.0.0.1,port=4444}' 

Est-ce que quelqu'un pourrait m'aider à comprendre pourquoi le script gst-launch échoue? L'erreur "reason not-linked" me fait penser que le lien entre gstrtpbin et les éléments de rtph264depay est cassé. Mais je ne sais pas comment le réparer.

Modifier
Selon les suggestions de Raof je fixe quelques erreurs dans ma commande. Cependant, je me sers ffdec_h264 et autovideosink parce que mon système Windows je n'ai pas les plug-ins d'évier fluh264dec et xvimage installés:

gst-launch-0.10 udpsrc port=4444 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" ! .recv_rtp_sink_0 gstrtpbin ! rtpmp2tdepay ! mpegtsdemux ! ffdec_h264 ! autovideosink 

Ce qui conduit à de nouvelles erreurs:

0:00:00.743000000 516 024070A8 ERROR     ffmpeg .:0:: non-existing PPS referenced 
0:00:00.744000000 516 024070A8 ERROR     ffmpeg .:0:: non-existing PPS referenced 
0:00:00.745000000 516 024070A8 ERROR     ffmpeg .:0:: decode_slice_header error 
0:00:00.745000000 516 024070A8 ERROR     ffmpeg .:0:: no frame! 
0:00:00.812000000 516 024070A8 ERROR     ffmpeg .:0:: non-existing PPS referenced 
0:00:00.813000000 516 024070A8 ERROR     ffmpeg .:0:: non-existi 
... 
ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data flow 
error. 
Additional debug info: 
..\Source\gstreamer\libs\gst\base\gstbasesrc.c(2378): gst_base_src_loop(): /Gst 
Pipeline:pipeline0/GstUDPSrc:udpsrc0: 
streaming task paused, reason not-negotiated (-4) 
Execution ended after 4790000000 ns. 
Setting pipeline to PAUSED ... 
Setting pipeline to READY ... 
Setting pipeline to NULL ... 
Freeing pipeline ... 

Je suis encore à essayer pour comprendre comment résoudre ce problème. Si vous pouvez aider, alors n'hésitez pas à le faire.

Edit2
J'ai testé à nouveau en utilisant la solution SDP et a observé que les erreurs « PPS non-existante » se produisent également, mais la vidéo ne joue. D'autre part, l'erreur fatale de flux interne de données n'apparaît que lors de l'utilisation de la solution de pipeline personnalisée. Je soupçonne que les erreurs "PPS inexistant" sont causées par le codeur x264. L '"erreur de flux de données interne" doit être causée par une erreur dans mon pipeline, ou peut-être un bug dans certains plugins Windows. Je vais donc quelques recherches ...

Répondre

10

Pour autant que je peux dire, vous avez deux problèmes là-bas:

Tout d'abord, il semble que l'ordre de spécification de puits est important: plutôt que ... ! gstrtpbin .recv_rtp_sink_0 ! ... vous avez besoin avoir ... ! .recv_rtp_sink_0 gstrtpbin ! .... Ensuite, vlc envoie un flux de transport MPEG2 - vous avez mux=ts dans le descripteur de sortie de flux rtp - mais vous essayez de décharger un flux h264 brut. Vous devez dépayer le flux ts, puis le démultiplexer pour obtenir les données du flux h264.

Ainsi, enfin, le pipeline

gst-launch-0.10 -v udpsrc port=4444 \ 
caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" \ 
! .recv_rtp_sink_0 gstrtpbin ! rtpmp2tdepay \ 
! mpegtsdemux ! fluh264dec ! xvimagesink 

fonctionne pour moi, en utilisant le démultiplexeur TS (de mpegtsdemux) et décodeur H264 (fluh264dec).

+1

Merci pour votre aide. Je suis un peu plus près maintenant, voir ma modification. – StackedCrooked

+0

J'ai maintenant installé gstreamer-ffmpeg et essayé avec ffdec_h264 et autovideosink. Mon pipeline fonctionne pour moi avec ces éléments au lieu de fluh264dec et xvimagesink. Je ne suis pas sûr de savoir où se situe votre problème, maintenant. – RAOF

+0

Je pense que c'est un problème spécifique à Windows, je vais tester avec ma machine Linux. Dans le cas où vous êtes intéressé, je vais mettre à jour mes progrès dans ce post. Merci, vous avez été très utile. – StackedCrooked

1

gst-lancement-0.10 -vvvv rtspsrc emplacement = rtsp: //192.168.250.100: 554 temps de latence = 100! application/x-rtp, media = "video", charge utile = 99, fréquence d'horloge = 90000, encoding-name = "H264"! rtph264depay! ffdec_h264! ffmpegcolorspace! xvimagesink

cela fonctionne pour moi avec un "Grandtec électronique Megapixel WIFI CAM"

0

Vous pouvez également essayer celui-ci.

gst-launch-0.10 -v rtspsrc location="rtsp://10.107.2.217/StreamingSetting?version=1.0&action=getRTSPStream&ChannelID=1&ChannelName=Channel1" user-id=admin user-pw=admin123 caps=" application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96,ssrc=(uint)237526004,clock-base=(uint)1584170994,seqnum-base=(uint)42626" port=554 ! rtph264depay queue-delay=0 ! h264parse ! decodebin2 ! queue leaky=1 ! autovideosink

Son travail aussi lorsque votre diffusion en continu sur le réseau est sécurisé, et ses travaux sur

rtsp://10.107.2.217

RTSP Port : 554

Video Codec : H.264

Espoir, son utile les gars.