使用GStreamer通过UDP将Android摄像机作为H264 mpeg-ts流式传输 [英] Stream Android camera as H264 mpeg-ts over UDP using GStreamer
问题描述
我在gstreamer上没有太多经验,而且我在网上找不到能解决它的东西.
I don't have much experience with gstreamer, and I couldn't find something online to figure it out.
我正在使用此开源开发一个Android应用程序以通过UDP将摄像机作为H264 mpegts流式传输.
I'm using this open-source to develop an Android app to stream camera as H264 mpegts over UDP.
我受困于管道,在那里有两个工作管道,但我无法合并在一起一起工作.原始的开源管道:
I got stuck with the pipeline, where I have two working pipelines I just can't merge to work together. The original opensource's pipeline :
"ahcsrc ! queue ! glimagesink name=vsink sync=false"
(当ahcsrc代表android-hardware-camera-src时)
(when ahcsrc stands for android-hardware-camera-src)
我的测试管道:
"videotestsrc ! decodebin ! x264enc bframes=2 ! mpegtsmux ! udpsink host=192.168.102.74 port=1234"
两者都能很好地工作.
我的目标是进入测试管道,并将videotestsrc切换为ahcsrc,如下所示:
My goal is to take my test pipeline, and switch the videotestsrc to the ahcsrc as in:
"ahcsrc ! decodebin ! x264enc bframes=2 ! mpegtsmux ! udpsink host=192.168.102.74 port=1234"
不幸的是,那里没有运气.非常感谢任何帮助!
Unfortunately no luck there. Would really appreciate any kind of help !
我尝试到处添加日志,然后看到没有错误,只是每个模块将其状态从udpsink更改为PAUSED到PLAYING.
I tried to add logs everywhere, and then saw there are no errors, except that every module changed it's status from PAUSED to PLAYING except the udpsink.
我在其中添加了"udpsink async = false",使其变为PLAYING,但没有发送数据包,也没有明显的错误.也许接收器没有任何数据?
I added to it "udpsink async=false" which made it become PLAYING, yet no packet sent and no noticeable errors. Maybe the sink doesn't get any data ?
Edit2:经过一切尝试,我发现它认为ahcsrc可能有问题,如下所示:
After trying everything I could have found it think it might be a problem with the ahcsrc, as this pipeline :
ahcsrc ! video/x-raw-yuv, framerate=25/1, width=640, height=360 ! videoconvert.....
无法将ahcsrc0链接到videoconvert0
Could not link ahcsrc0 to videoconvert0
毕竟,它是gst-plugins-bad的一部分.任何没收都会很棒.
After all, it is part of the gst-plugins-bad. Any confimation would be great.
推荐答案
您的意思是没有运气吗?有什么错误吗?
What you mean no luck? any error?
The output from ahcsrc seem to be raw yuv - maybe there is no need to use decodebin, just videoconvert.
您可以在src之后添加队列以获得更好的性能,不确定是否可以使用,但是就是这样:
You can add queue after src for better performance, not sure if it will work, but this is it:
ahcsrc ! queue ! videoconvert ! x264enc bframes=2 ! mpegtsmux ! udpsink host=192.168.102.74 port=1234
请在使用环境变量 GST_LAUNCH = 4 ./your-app
的应用程序运行时添加一些日志,并将其粘贴到某处.
Please add some logs with running your app with env variable GST_LAUNCH=4 ./your-app
and paste them somewhere..
这篇关于使用GStreamer通过UDP将Android摄像机作为H264 mpeg-ts流式传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!