Max Golovanchuk
Max Golovanchuk

Reputation: 747

Gstreamer: can't mux video and audio into rtmpsink

I am trying to mux video and audio test sources into rtmpsink. This pipeline will not work:

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

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

Upvotes: 0

Views: 3071

Answers (2)

Ali G&#246;kkaya
Ali G&#246;kkaya

Reputation: 488

You can use rtmpsrc

Example:

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

you can develop through this pip

Upvotes: 0

Ezequiel Garcia
Ezequiel Garcia

Reputation: 1057

Was just having a similar issue, and made it work by re-encoding the audio to 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.

Upvotes: 1

Related Questions