I am trying to mux video and audio test sources into rtmpsink. This pipeline will not work:
我正在尝试将视频和音频测试的源代码转换成rtmpsink。这条管道将不起作用:
gst-launch-1.0 \
videotestsrc ! queue ! x264enc ! \
flvmux name=mux ! \
rtmpsink location="rtmp://... live=1" \
audiotestsrc ! queue ! audioconvert ! mux.
I am getting this console result:
我得到这个控制台结果:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
If I push audio and video separately it works:
如果我把音频和视频分开,它可以工作:
gst-launch-1.0 \
videotestsrc ! queue ! x264enc ! \
flvmux name=mux ! \
rtmpsink location="rtmp://... live=1"
-v logs
- v日志
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
1 个解决方案
#1
0
Was just having a similar issue, and made it work by re-encoding the audio to MPEG.
只是有一个类似的问题,并通过将音频重新编码到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.
Tested this pipeline against NGINX RTMP server, and VLC as client. I'm not entirely sure why raw audio isn't working.
对NGINX RTMP服务器和VLC作为客户端进行了测试。我不完全确定为什么原始音频不能工作。
#1
0
Was just having a similar issue, and made it work by re-encoding the audio to MPEG.
只是有一个类似的问题,并通过将音频重新编码到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.
Tested this pipeline against NGINX RTMP server, and VLC as client. I'm not entirely sure why raw audio isn't working.
对NGINX RTMP服务器和VLC作为客户端进行了测试。我不完全确定为什么原始音频不能工作。