将视频从 Android 相机流式传输到服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2550847/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:17:41  来源:igfitidea点击:

Streaming video from Android camera to server

androidvideostreamingvideo-streaming

提问by JCL

I've seen plenty of info about how to stream video from the server to an android device, but not much about the other way, ala Qik. Could someone point me in the right direction here, or give me some advice on how to approach this?

我已经看到了很多关于如何将视频从服务器流式传输到 android 设备的信息,但关于其他方式的信息并不多,ala Qik。有人可以在这里指出我正确的方向,或者就如何解决这个问题给我一些建议?

回答by Zhou Chang

I have hosted an open-source project to enable Android phone to IP camera:

我主持了一个开源项目,以启用 Android 手机到 IP 摄像头:

http://code.google.com/p/ipcamera-for-android

http://code.google.com/p/ipcamera-for-android

Raw video data is fetched from LocalSocket, and the MDAT MOOV of MP4 was checked first before streaming. The live video is packed in FLV format, and can be played via Flash video player with a build in web server :)

原始视频数据是从 LocalSocket 获取的,并且在流式传输之前首先检查 MP4 的 MDAT MOOV。实时视频以 FLV 格式打包,可以通过内置网络服务器的 Flash 视频播放器播放:)

回答by Simon

Took me some time, but I finally manage do make an app that does just that. Check out the google code page if you're interested: http://code.google.com/p/spydroid-ipcamera/I added loads of comments in my code (mainly, look at CameraStreamer.java), so it should be pretty self-explanatory. The hard part was actually to understand the RFC 3984 and implement a proper algorithm for the packetization process. (This algorithm actually turns the mpeg4/h.264 stream produced by the MediaRecorder into a nice rtp stream, according to the rfc)

我花了一些时间,但我终于设法制作了一个可以做到这一点的应用程序。如果您有兴趣,请查看谷歌代码页:http: //code.google.com/p/spydroid-ipcamera/我在我的代码中添加了大量注释(主要是查看 CameraStreamer.java),所以它应该是不言自明。困难的部分实际上是理解 RFC 3984 并为打包过程实施适当的算法。(根据 rfc,该算法实际上将 MediaRecorder 生成的 mpeg4/h.264 流转换为不错的 rtp 流)

Bye

再见

回答by ObsidianX

I'm looking into this as well, and while I don't have a good solution for you I did manage to dig up SIPDroid's video code:

我也在研究这个,虽然我没有一个好的解决方案,但我确实设法挖掘了 SIPDroid 的视频代码:

http://code.google.com/p/sipdroid/source/browse/trunk/src/org/sipdroid/sipua/ui/VideoCamera.java

http://code.google.com/p/sipdroid/source/browse/trunk/src/org/sipdroid/sipua/ui/VideoCamera.java

回答by dbro

I've built an open-source SDK called Kickflipto make streaming video from Android a painless experience.

我已经构建了一个名为Kickflip的开源 SDK,以使来自 Android 的流视频成为一种轻松的体验。

The SDK demonstrates use of Android 4.3's MediaCodecAPI to direct the device hardware encoder's packets directly to FFmpeg for RTMP(with librtmp) or HLSstreaming of H.264 / AAC. It also demonstrates realtime OpenGL Effects (titling, chroma key, fades) and background recording.

SDK 演示了使用 Android 4.3 的MediaCodecAPI 将设备硬件编码器的数据包直接定向到 FFmpeg,用于RTMP(使用 librtmp)或H.264/AAC 的HLS流。它还演示了实时 OpenGL 效果(标题、色度键、淡入淡出)和背景记录。

Thanks SO, and especially, fadden.

谢谢 SO,尤其是fadden

回答by Minion

Here is complete article about streaming android camera video to a webpage.

这是关于将 android 相机视频流式传输到网页的完整文章。

Android Streaming Live Camera Video to Web Page

Android 将实时摄像头视频流式传输到网页

  1. Used libstreamingon android app
  2. On server side Wowza Media Engineis used to decode the video stream
  3. Finally jWplayeris used to play the video on a webpage.
  1. 在 android 应用程序上使用libstreaming
  2. 在服务器端,Wowza Media Engine用于解码视频流
  3. 最后jWplayer用于在网页上播放视频。

回答by Venkat

I am able to send the live camera video from mobile to my server.using this link see the link

Refer the above link.there is a sample application in that link. Just you need to set your service url in RecordActivity.class.

我可以将实时摄像头视频从手机发送到我的服务器。使用此链接 查看链接

请参阅上面的链接。该链接中有一个示例应用程序。只是你需要在 RecordActivity.class 中设置你的服务 URL。

Example as: ffmpeg_link="rtmp://yourserveripaddress:1935/live/venkat";

例如: ffmpeg_link="rtmp://yourserveripaddress:1935/live/venkat";

we can able to send H263 and H264 type videos using that link.

我们可以使用该链接发送 H263 和 H264 类型的视频。

回答by theicfire

This is hardly a full answer, but webRTC may be what you're looking for. Here's some quick examples of webRTC in action: http://www.webrtc.org/reference-apps

这不是一个完整的答案,但 webRTC 可能是您正在寻找的。以下是 webRTC 的一些快速示例:http: //www.webrtc.org/reference-apps

If you want Android specific code, it exists! http://www.webrtc.org/native-code/android

如果你想要Android特定的代码,它就存在!http://www.webrtc.org/native-code/android

回答by Hamed Ghadirian

Check Yasealibrary

检查Yasea图书馆

Yasea is an Android streaming client. It encodes YUV and PCM data from camera and microphone to H.264/AAC, encapsulates in FLV and transmits over RTMP.

Yasea 是一个 Android 流媒体客户端。它将来自摄像头和麦克风的 YUV 和 PCM 数据编码为 H.264/AAC,封装在 FLV 中并通过 RTMP 传输。

Feature:

特征:

  1. Android mini API 16.
  2. H.264/AAC hard encoding.
  3. H.264 soft encoding.
  4. RTMP streaming with state callback handler.
  5. Portrait and landscape dynamic orientation.
  6. Front and back cameras hot switch.
  7. Recording to MP4 while streaming.
  1. 安卓迷你 API 16。
  2. H.264/AAC 硬编码。
  3. H.264 软编码。
  4. RTMP 流与状态回调处理程序。
  5. 纵向和横向动态定向。
  6. 前后摄像头热切换。
  7. 流式传输时录制为 MP4。

回答by heff

Mux (my company) has an open source android appthat streams RTMP to a server, including setting up the camera and user interactions. It's built to stream to Mux's live streaming API but can easily stream to any RTMP entrypoint.

Mux(我的公司)有一个开源 Android 应用程序,可以将 RTMP 流式传输到服务器,包括设置相机和用户交互。它旨在流式传输到 Mux 的实时流式传输 API,但可以轻松流式传输到任何 RTMP 入口点。

回答by Ezu

Depending by your budget, you can use a Raspberry Pi Camera that can send images to a server. I add here two tutorials where you can find many more details:

根据您的预算,您可以使用可以将图像发送到服务器的 Raspberry Pi 相机。我在这里添加了两个教程,您可以在其中找到更多详细信息:

This tutorial show you how to use a Raspberry Pi Cameraand display images on Android device

本教程向您展示如何使用 Raspberry Pi 相机并在 Android 设备上显示图像

This is the second tutorial where you can find a series of tutorial about real-time video streaming between camera and android device

这是第二个教程,您可以在其中找到有关相机和 Android 设备之间实时视频流的系列教程