2016-08-16 5 views
1

Ich muss eine mpeg-ts-Videodatei mit gstreamer senden, ohne sie zu transkodieren. Das Video wird codiert in: H264 - MPEG-4 AVC (Teil 10) (H264)Streamen einer lokalen mpeg-ts-Datei zu udp mit gstreamer

Ich habe versucht, mit

gst-launch-1.0 filesrc location=my_video.ts ! h264parse ! rtph264pay ! udpsink host=127.0.0.1 port=49444 

und spielen mit

gst-launch-1.0 udpsrc caps=" application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96,ssrc=(uint)2674837201,clock-base=(uint)2959668548,seqnum-base=(uint)14300" port=49444 ! rtph264depay ! decodebin ! autovideosink 

zu streamen, aber die Video, das ich auf receaver Seite habe, ist corrusted (aber es ist immer noch ein bisschen ähnlich wie das Original-Video): enter image description here

Und es ist eine Menge von wa in der Empfängerkonsole:

WARNING: from element /GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0: Could not decode stream. 
Additional debug info: 
gstrtph264depay.c(1205): gst_rtp_h264_depay_process(): /GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0: 
Undefined packet type 

Was mache ich falsch? Ich schätze, das Problem ist in der caps Parameter von udpsrc Element, weil ich es gerade aus einem Beispiel im Web kopierte. Wenn es das Problem ist, wie kann ich einen günstigeren Wert für den Parameter caps herausfinden?

Antwort

2

Sie können nicht direkt von ts-Datei zu h264parse gehen, Sie müssen zuerst den ts-Stream demuxen - dies geschieht mit tsdemux.

Das ist die Magie Rohr:

gst-launch-1.0 filesrc location=dummy_h264.ts ! tsparse set-timestamps=true ! video/mpegts ! tsdemux ! video/x-h264 ! h264parse disable-passthrough=true ! rtph264pay ! udpsink -v host=127.0.0.1 port=9999 

Ohne tsparse Set-Zeitstempel es nicht funktionieren kann, weil die timestamping Informationen in Ihrer ts-Datei nicht vorhanden sein können - Sie haben es zu überprüfen, ob die richtige ist PCR-Rahmen - vielleicht mit einigen mpeg ts analyzer.

Und Debug-Ausgabe - nehmen Sie die Kappen von der Linie über udpsink sprechen:

Setting pipeline to PAUSED ... 
Pipeline is PREROLLING ... 
/GstPipeline:pipeline0/MpegTSParse2:mpegtsparse2-0.GstPad:src: caps = "video/mpegts\,\ systemstream\=\(boolean\)true\,\ packetsize\=\(int\)188" 
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = "video/mpegts\,\ systemstream\=\(boolean\)true\,\ packetsize\=\(int\)188" 
/GstPipeline:pipeline0/GstTSDemux:tsdemux0.GstPad:sink: caps = "video/mpegts\,\ systemstream\=\(boolean\)true\,\ packetsize\=\(int\)188" 
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = "video/mpegts\,\ systemstream\=\(boolean\)true\,\ packetsize\=\(int\)188" 
/GstPipeline:pipeline0/GstCapsFilter:capsfilter2: caps = video/x-h264 
/GstPipeline:pipeline0/GstCapsFilter:capsfilter2.GstPad:src: caps = "video/x-h264\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)nal" 
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = "video/x-h264\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)nal" 
/GstPipeline:pipeline0/GstCapsFilter:capsfilter2.GstPad:sink: caps = "video/x-h264\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)nal" 
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = "video/x-h264\,\ stream-format\=\(string\)avc\,\ alignment\=\(string\)au\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ parsed\=\(boolean\)true\,\ profile\=\(string\)high\,\ level\=\(string\)2\,\ codec_data\=\(buffer\)01640014ffe1001967640014acd94141fb0110000003001000000303c8f142996001000568ebecb22c" 
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H264\,\ packetization-mode\=\(string\)1\,\ profile-level-id\=\(string\)640014\,\ sprop-parameter-sets\=\(string\)\"Z2QAFKzZQUH7ARAAAAMAEAAAAwPI8UKZYA\\\=\\\=\\\,aOvssiw\\\=\"\,\ payload\=\(int\)96\,\ ssrc\=\(uint\)3030226714\,\ timestamp-offset\=\(uint\)3947899684\,\ seqnum-offset\=\(uint\)32736" 
------------TAKE THIS ONE:-------------- 
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H264\,\ packetization-mode\=\(string\)1\,\ profile-level-id\=\(string\)640014\,\ sprop-parameter-sets\=\(string\)\"Z2QAFKzZQUH7ARAAAAMAEAAAAwPI8UKZYA\\\=\\\=\\\,aOvssiw\\\=\"\,\ payload\=\(int\)96\,\ ssrc\=\(uint\)3030226714\,\ timestamp-offset\=\(uint\)3947899684\,\ seqnum-offset\=\(uint\)32736" 
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:sink: caps = "video/x-h264\,\ stream-format\=\(string\)avc\,\ alignment\=\(string\)au\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ parsed\=\(boolean\)true\,\ profile\=\(string\)high\,\ level\=\(string\)2\,\ codec_data\=\(buffer\)01640014ffe1001967640014acd94141fb0110000003001000000303c8f142996001000568ebecb22c" 
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: timestamp = 3947910934 
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: seqnum = 32736 
Pipeline is PREROLLED ... 
Setting pipeline to PLAYING ... 
New clock: GstSystemClock 
^Chandling interrupt. 
Interrupt: Stopping pipeline ... 
Execution ended after 0:00:03.631302966 
Setting pipeline to PAUSED ... 
Setting pipeline to READY ... 
Setting pipeline to NULL ... 
Freeing pipeline ... 

Dann es so spielen:

gst-launch-1.0 udpsrc port=9999 ! application/x-rtp\,\ media\=\... ! queue ! rtph264depay ! decodebin ! videoconvert ! glimagesink 

Beachten Sie, dass Sie auf seine nicht hinzufügen "um Kappen bereits entkommen ..

+0

Vielen Dank! Ihre magische Pfeife funktioniert gut! Allerdings hatte ich einige Störungen bei empfangenen Video, bis ich ein 'queue' Element hinzugefügt in der Pipeline des Spielers – Paboka

+0

@Paboka ok Ich bearbeitete Antwort .. Es ist gut, Warteschlangen überall dort zu haben, wo es Sinn macht .. aber ich denke, dass decoderbin bereits einige Warteschlangen intern verwendet .. – nayana