保持preVIEW回调的同时录制视频?回调、视频、preVIEW

2023-09-05 01:29:19 作者:叼著奶瓶去蹦迪

我目前使用的previewCallback这样我就可以从相机捕获帧时preVIEW,并通过HTTP流他们。

I'm currently using onPreviewCallback so I can capture frames from camera when in preview and stream them via http.

这是工作,但后来我发出一个命令开始录制和,看来,我没有一个preVIEW回调了。

That works but then I issue a command to start recording and, it seems, I do not have a preview callback anymore.

那么,我该如何保持preVIEW回调,所以我可以同时发送从表面帧到我的服务器和记录设备上的视频?

So, how do I keep the preview callback so I can both send the frames from the surface to my server AND record the video on the device?

推荐答案

我没有了相当长的时间了An​​droid摄像头的工作。不过,我记得

I didn't work for quite long time with Android Camera. However, as I remember

1)previewCallback正在录制不叫

1) onPreviewCallback isn't called while you are recording

它提到了几个问题:

相机上previewFrame不叫 How显示实时滤波相机preVIEW同时录制视频?

2)我看到它在SipDroid和下列方式对夫妇的其他Android SIP客户端(这是1 - 2年以前,因此这种方法可能是outdates)处理:

2) I saw that it was handled in SipDroid and couple of other Android SIP clients following way (this was a 1-2 years ago, so this method could be outdates):

在一个管道创建 管道的接收座被包裹在当前FileDescriptor并传递给MediaRecorder setOutputFile 管道发送套接字不断读入主题。 这样,您就可以收到被写入到一个文件中的内容 现在,问题是如何处理该内容(因为,它的H.263或H.264连接codeD和可以与声音相混合,如果用声音记录视频)。 有一些其解析的内容(但是,它的屁股痛)启发式算法

3)您可以在previewFrame使用+启动AudioRecorder和连接code它自己(使用ffmpeg的或类似的东西)的MP4文件。这样,您就不需要启动MediaRecorder记录。

3) You can use onPreviewFrame + start AudioRecorder and encode it yourself (using ffmpeg or something like that) to mp4 file. This way you don't need to start MediaRecorder recording.