简体   繁体   English

同时在Android上流式传输和录制视频

[英]Streaming and recording video on android at the same time

I am searching for a library which offer ability for streaming video from android device (5.1+) and recording it at the same time. 我正在寻找一个能够从Android设备(5.1+)流式传输视频并同时录制它的库。

I tried MediaRecorder - the usual way to record videos on android - but with it I am not able to stream it over webrtc or rtsp because camera is busy. 我尝试了MediaRecorder - 在Android上录制视频的常用方法 - 但有了它我无法通过webrtc或rtsp流式传输,因为相机很忙。

Currently I am using libstreaming . 目前我正在使用libstreaming With little modification done app can record and stream over rtsp concurrently. 通过很少的修改,app可以同时记录和流式传输rtsp。 But this lib lacks support for hardware codec in MTK and SPRG chipsets. 但是这个lib缺乏对MTK和SPRG芯片组中硬件编解码器的支持。

I am wonder if you can recommend a solution or another lib which. 我很想知道你是否可以推荐一个解决方案或其他的lib。 By the moment lib works only on nexus 4 with qcom chipset. 到目前为止,lib仅适用于带有qcom芯片组的nexus 4。

After several days of research, I came to the decision to use a combination of FFMpeg and MediaCodec. 经过几天的研究,我决定使用FFMpeg和MediaCodec的组合。

It seems that the only way to get frames from camera at high rate is to use Android MediaCodec API. 似乎从相机以高速率获取帧的唯一方法是使用Android MediaCodec API。 But MediaCodec supports only mp4 file formats, which is not an option for me (I need ts), while FFMpeg can process\\create any kind of human known video formats. 但是MediaCodec只支持mp4文件格式,这对我来说不是一个选项(我需要ts),而FFMpeg可以处理\\创建任何类型的人类已知视频格式。

Currently I am trying to make it work together (read ByteBuffer from MediaCodec and feed FFMpeg recorder with it). 目前我正在努力让它一起工作(从MediaCodec读取ByteBuffer并用它提供FFMpeg记录器)。

Useful links: 有用的链接:

ContinuousCapture and Show + record are the most interesting parts to check ContinuousCapture和Show +记录是最值得检查的部分

Has example with recording and streaming. 有记录和流媒体的例子。

The library which makes two mentioned above tools works together and also is open sourced. 使上述两个工具一起工作的库也是开源的。 Sadly it doesn't solve my problem fully. 可悲的是,它并没有完全解决我的问题。 The feature I need is requested but not already implemented: https://github.com/bytedeco/javacv/issues/95 我需要的功能是请求但尚未实现: https//github.com/bytedeco/javacv/issues/95

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM