gstreamer flvmux 和 rtmp 错误 [英] gstreamer flvmux and rtmp error

查看:25
本文介绍了gstreamer flvmux 和 rtmp 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I trying to stream rtmp from rasberrypi, the omx hardware encoder worked really nice, by the way, so I'm running:

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 问题或诸如此类的问题,但后来我尝试编写简单的 mpegts 并且它奏效了:

First of all i thought that there is some alsa problems or such, but then I tried to write simple mpegts and it worked:

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' 因为我会收到错误:

But i can't just change "filesink location=1.ts" to rtmpsink location='rtmp://my_rtmp_for_ustream.tv_url' because i'll get an error:

警告:错误的管道:无法将多路复用器链接到 rtmpsink0

WARNING: erroneous pipeline: could not link mux to rtmpsink0

那么,我该怎么做才能让它发挥作用?谢谢.

So, what can I do to get it work? Thanks.

推荐答案

真正的问题是 rtmpsync 需要原始 aac,所以我添加了 aacparse 并且它解决了,像这样:

Real problem was that rtmpsync need raw aac, so I added aacparse and it worked out, something like this:

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"

这篇关于gstreamer flvmux 和 rtmp 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆