Gstreamer:无法将视频和音频复制到rtmpsink中

时间:2016-04-01 16:27:08

标签: gstreamer

我正在尝试将视频和音频测试源复用到rtmpsink中。这个管道不起作用:

gst-launch-1.0 \
videotestsrc ! queue ! x264enc ! \
flvmux name=mux ! \
rtmpsink location="rtmp://... live=1" \
audiotestsrc ! queue ! audioconvert ! mux.

我收到了这个控制台结果:

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

如果我单独推送音频和视频,它可以工作:

gst-launch-1.0 \
videotestsrc ! queue ! x264enc ! \
flvmux name=mux ! \
rtmpsink location="rtmp://... live=1"

-v logs

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = "video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = "video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = "video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
/GstPipeline:pipeline0/GstAudioTestSrc:audiotestsrc0.GstPad:src: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)44100\,\ channels\=\(int\)1"
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)44100\,\ channels\=\(int\)1"
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)44100\,\ channels\=\(int\)1"
/GstPipeline:pipeline0/GstAudioConvert:audioconvert0.GstPad:src: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)44100\,\ channels\=\(int\)1"
/GstPipeline:pipeline0/GstFlvMux:mux.GstPad:audio: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)44100\,\ channels\=\(int\)1"
/GstPipeline:pipeline0/GstAudioConvert:audioconvert0.GstPad:sink: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)44100\,\ channels\=\(int\)1"
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:sink: caps = "video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
Redistribute latency...
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src: caps = "video/x-h264\,\ codec_data\=\(buffer\)01640014ffe1001967640014acd94141fb0110000003001000000303c8f142996001000568ebecb22c\,\ stream-format\=\(string\)avc\,\ alignment\=\(string\)au\,\ level\=\(string\)2\,\ profile\=\(string\)high\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ framerate\=\(fraction\)30/1"
/GstPipeline:pipeline0/GstFlvMux:mux.GstPad:video: caps = "video/x-h264\,\ codec_data\=\(buffer\)01640014ffe1001967640014acd94141fb0110000003001000000303c8f142996001000568ebecb22c\,\ stream-format\=\(string\)avc\,\ alignment\=\(string\)au\,\ level\=\(string\)2\,\ profile\=\(string\)high\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ framerate\=\(fraction\)30/1"
/GstPipeline:pipeline0/GstFlvMux:mux: streamable = true
/GstPipeline:pipeline0/GstFlvMux:mux.GstPad:src: caps = "video/x-flv\,\ streamheader\=\(buffer\)\<\ ... buffer data ... \>"
/GstPipeline:pipeline0/GstRTMPSink:rtmpsink0.GstPad:sink: caps = "video/x-flv\,\ streamheader\=\(buffer\)\<\ ... buffer data .. \>"
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

2 个答案:

答案 0 :(得分:0)

只是遇到了类似的问题,并通过将音频重新编码为MPEG来使其工作。

gst-launch-1.0 videotestsrc is-live=true ! videoconvert ! queue ! \
x264enc bitrate=2000 ! \
flvmux name=mux ! \
rtmpsink location="rtmp://localhost/test/test live=1" \
audiotestsrc is-live=true ! queue ! faac ! mux.

针对NGINX RTMP服务器和VLC作为客户端测试此管道。我不完全确定为什么原始音频不起作用。

答案 1 :(得分:0)

您可以使用 rtmpsrc

示例:

gst-launch-1.0 rtmpsrc location="rtmp://<location> live=1" ! decodebin name=decoder decoder. ! queue ! videoconvert ! queue ! xvimagesink

你可以通过这个pip开发

相关问题