2013-08-22 127 views
0

我是gstreamer的新手。我只想在rtp端口上流式傳輸音頻/視頻。我嘗試以下命令從MPEG文件流僅視頻:如何使用gstreamer只從mpeg文件流式傳輸音頻/視頻?

$ gst-launch-1.0 -v rtpbin name=rtpbin filesrc location=KRSNA.mpg ! decodebin ! 'video/mpeg' ! rtpmpvpay ! udpsink host=127.0.0.1 port=9078 

以下是詳細的命令:

Setting pipeline to PAUSED ... 
Pipeline is PREROLLING ... 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/mpeg, systemstream=(boolean)true, mpegversion=(int)1 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/mpeg, systemstream=(boolean)true, mpegversion=(int)1 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegPSDemux:mpegpsdemux0.GstPad:sink: caps = video/mpeg, systemstream=(boolean)true, mpegversion=(int)1 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_0: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_0: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegvParse:mpegvparse0.GstPad:sink: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_1: caps = audio/mpeg, mpegversion=(int)1 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_1: caps = audio/mpeg, mpegversion=(int)1 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_1: caps = audio/mpeg, mpegversion=(int)1 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegAudioParse:mpegaudioparse0.GstPad:src: caps = audio/mpeg, mpegversion=(int)1, mpegaudioversion=(int)1, layer=(int)2, rate=(int)48000, channels=(int)2, parsed=(boolean)true 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpg123AudioDec:mpg123audiodec0.GstPad:sink: caps = audio/mpeg, mpegversion=(int)1, mpegaudioversion=(int)1, layer=(int)2, rate=(int)48000, channels=(int)2, parsed=(boolean)true 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegvParse:mpegvparse0.GstPad:src: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, parsed=(boolean)true, width=(int)720, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)16/15, codec_data=(buffer)000001b32d0240830c352398 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/avdec_mpeg2video:avdec_mpeg2video0.GstPad:sink: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, parsed=(boolean)true, width=(int)720, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)16/15, codec_data=(buffer)000001b32d0240830c352398 
Redistribute latency... 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpg123AudioDec:mpg123audiodec0.GstPad:src: caps = audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/avdec_mpeg2video:avdec_mpeg2video0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)720, height=(int)576, pixel-aspect-ratio=(fraction)16/15, interlace-mode=(string)progressive, colorimetry=(string)bt601, framerate=(fraction)25/1 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-buffers = 5 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-time = 0 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-bytes = 2097152 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-buffers = 5 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-time = 0 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-bytes = 2097152 
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1: caps = video/mpeg 
/GstPipeline:pipeline0/GstCapsFilter:capsfilter2: caps = video/mpeg 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpg123AudioDec:mpg123audiodec0.GstPad:src: caps = audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_1: caps = audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_1.GstProxyPad:proxypad8: caps = audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/avdec_mpeg2video:avdec_mpeg2video0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)720, height=(int)576, pixel-aspect-ratio=(fraction)16/15, interlace-mode=(string)progressive, colorimetry=(string)bt601, framerate=(fraction)25/1 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0: caps = video/x-raw, format=(string)I420, width=(int)720, height=(int)576, pixel-aspect-ratio=(fraction)16/15, interlace-mode=(string)progressive, colorimetry=(string)bt601, framerate=(fraction)25/1 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0.GstProxyPad:proxypad9: caps = video/x-raw, format=(string)I420, width=(int)720, height=(int)576, pixel-aspect-ratio=(fraction)16/15, interlace-mode=(string)progressive, colorimetry=(string)bt601, framerate=(fraction)25/1 
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegPSDemux:mpegpsdemux0: Internal data stream error. 
Additional debug info: 
gstmpegdemux.c(2871): gst_flups_demux_loop(): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegPSDemux:mpegpsdemux0: 
stream stopped, reason not-linked 
ERROR: pipeline doesn't want to preroll. 
Setting pipeline to NULL ... 
Freeing pipeline ... 

如何從MPEG文件中使用的GStreamer流只有音頻/視頻?

appriciated任何幫助/指針...

回答

0

請儘量不要使用decodebin。使用兼容的demuxer元素,然後使用所需的解析器和解碼器元素。

如果要從容器格式中運行基本(僅視頻/只有音頻),請使用所需的元素(用於音頻流的視頻流/音頻元素的視頻元素)。

gst-launch-0.10 filesrc location=sample.mkv ! matroskademux ! h264parse ! ffdec_h264 ! ffmpegcolorspace ! autovideosink 

上面的語句例如會給視頻輸出忽略音頻,音頻也可以達到同樣的效果。

希望這會有所幫助,也期待here

0
gst-launch-0.10 filesrc location=c:/test.mpg ! mpegpsdemux ! mpegvideoparse ! mpeg2dec ! rtpvrawpay ! udpsink port=9078 

這條管道工程對我來說,雖然我不得不替代mpegpsdemux爲tsdemux,因爲我只用了前安裝。

相關問題