Raspberry pi gstreamer flvmux和rtmp错误

Raspberry pi gstreamer flvmux和rtmp错误,raspberry-pi,gstreamer,flv,Raspberry Pi,Gstreamer,Flv,我尝试从rasberrypi流式传输rtmp,顺便说一句,omx硬件编码器工作得非常好,所以我运行: gst-launch-1.0 v4l2src ! «video/x-raw,width=640,height=480,framerate=30/1» !\ omxh264enc target-bitrate=1000000 control-rate=variable !\ video/x-h264,profile=high ! h264parse ! queue ! \ flvmux nam

我尝试从rasberrypi流式传输rtmp,顺便说一句,omx硬件编码器工作得非常好,所以我运行:

gst-launch-1.0 v4l2src ! «video/x-raw,width=640,height=480,framerate=30/1» !\
 omxh264enc target-bitrate=1000000 control-rate=variable !\
 video/x-h264,profile=high ! h264parse ! queue ! \
flvmux name=mux alsasrc device=plughw:1 ! audioresample ! \
audio/x-raw,rate=48000,channels=1 ! queue ! voaacenc bitrate=32000 ! queue ! mux. mux. !\
 rtmpsink location='rtmp://my_rtmp_for_ustream.tv_url'
还有一个错误:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstAudioSrcClock
ERROR: from element /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2812): gst_base_src_loop (): /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 535913298 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
libv4l2: warning v4l2 mmap buffers still mapped on close()
Freeing pipeline ...
首先,我认为存在一些alsa问题,但后来我尝试编写简单的MPEGT,它成功了:

gst-launch-1.0 v4l2src ! «video/x-raw,width=640,height=480,framerate=30/1» ! \
omxh264enc target-bitrate=1000000 control-rate=variable !\
 video/x-h264,profile=high ! h264parse ! queue ! \
 mpegtsmux name=mux alsasrc device=plughw:1 ! audioresample !\
 audio/x-raw,rate=48000,channels=1 ! queue ! voaacenc bitrate=32000 ! \
queue ! mux. mux. ! filesink location=1.ts
但我不能仅仅将“filesink location=1.ts”更改为rtmpsink location=rtmp://my_rtmp_for_ustream.tv_url'因为我将得到一个错误:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstAudioSrcClock
ERROR: from element /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2812): gst_base_src_loop (): /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 535913298 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
libv4l2: warning v4l2 mmap buffers still mapped on close()
Freeing pipeline ...
警告:错误管道:无法将mux链接到rtmpsink0


那么,我该怎么做才能让它工作呢?谢谢。

rtmpsink需要“视频/x-flv”格式的数据。您的第一条管道清楚地显示协商错误。您可以通过在命令行中添加-v来获取管道的转储信息。

真正的问题是rtmpsync需要原始aac,所以我添加了aacparse,结果是这样的:

gst-launch-1.0 v4l2src ! \
   "video/x-raw, framerate=25/1, width=320, height=240" ! \
   omxh264enc target-bitrate=300000 control-rate=variable ! \
   h264parse ! queue ! flvmux name=muxer alsasrc device=hw:1 ! \
   audioresample ! "audio/x-raw,rate=48000" ! queue ! \
   voaacenc bitrate=32000 ! aacparse ! queue ! muxer. muxer. ! \
   rtmpsink location="$RTMP_URL"