Android的 - 流相机RTMP流 [英] Android - Stream camera as RTMP stream

查看:603
本文介绍了Android的 - 流相机RTMP流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Android设备捕捉摄像头流,并将其传输到与RTMP服务器(服务器的退出我的控制)。我还没有想出但如何从相机本身的数据流,但这是以后的问题。

I want to capture the camera stream from an Android device and stream it to a server with RTMP (the server is out of my control). I have not figured out yet how to create a stream of data from the camera itself, but that is for a later concern.

目前有两个问题:我想支持API 9+和RTMP是不是原生搭载Android支持

At the moment there are two problems: I wish to support API 9+ and RTMP is not native supported by Android.

我已经采取环顾四周,发现这个SO发布<一个href="http://stackoverflow.com/questions/10123498/streaming-rtmp-stream-live-from-android-camera-to-fms-or-wowza-or-red5-convert">Streaming RTMP流过,从Android摄像头,以柔性制造系统或Wowza或Red5的 - 转换视频输入流RTMP 和的https:/ /github.com/yixia/VitamioBundle 。前者建议有很少或几乎没有文档。后者的大概的支持它(?),但它需要的API 14 +

I've taken a look around and found this SO post Streaming RTMP stream live from Android Camera to FMS or Wowza or Red5 - Convert video Input Stream to RTMP and https://github.com/yixia/VitamioBundle. The former suggested a library that has little to no documentation. The latter probably supports it (?), but it requires API 14+.

有没有像样的例子或库在那里,支持RTMP流从Android设备?我也看到了一些有关转换RTSP或FFMPEG,如果是那么一个可行的办法,我想这就够了。

Are there decent examples or libraries out there, that that supports RTMP streaming from an Android device? I've also read something about converting RTSP or FFMPEG, if that is a viable way then I guess it will suffice too.

我发现这个库(它有很多相似性上面提到的)并试图与合作。我在Android的工作室进口,并写了一些code,但它似乎有一个 java.lang.NoClassDefFoundError的RTSP codeC厂错误内部崩溃。因此很明显,这并不在Android上工作也很好。

I've found this library (It has a lot of resemblance to the one mentioned above) and tried to work with. I imported it in Android Studio and wrote some code, but it appears to crash internally with a java.lang.NoClassDefFoundError RTSP Codec Factory error. So apparently that doesn't work too well on Android.

另外,我以前遇到过好几次的Adobe AIR。我不想code在行动脚本3(AS3),因为这个库将仅仅是一个本机应用程序(小)的一部分。如果没有Adobe Air拥有它,我不知道一个图书馆,那么我会愉快地整合,如果这是可能的。

Also, I've encountered several times Adobe air. I do not want to code in Action Script 3 (AS3) as this library will just be a (small) part of a native app. If Adobe Air has a library which I am unaware of, then I would happily integrate it if that is possible.

推荐答案

在<一个href="http://stackoverflow.com/questions/10123498/streaming-rtmp-stream-live-from-android-camera-to-fms-or-wowza-or-red5-convert">accepted这个问题的答案您链接有人建议使用JavaCV。

In the accepted answer of the question you linked someone suggests using JavaCV.

它需要API 8或更高版本,并配有 FFmpegFrameRecorder 类。

It requires API 8 or newer and features a FFmpegFrameRecorder class.

链接到github上:

Link to github:

https://github.com/bytedeco/javacv

他们甚至有捕获FLV(这是相当大的,所以我会在这里不糊)的全样本: https://github.com/bytedeco/javacv/blob/master/samples /RecordActivity.java

They even have a full sample of capturing flv (it's rather large so I won't paste it here): https://github.com/bytedeco/javacv/blob/master/samples/RecordActivity.java

在你的情况,你可能需要更换:

In your case you probably need to replace:

private String ffmpeg_link = "/mnt/sdcard/stream.flv";

private String ffmpeg_link = "rtmp://<server>:<port>/stream";

这篇关于Android的 - 流相机RTMP流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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