如何使用android媒体记录器输出基本流?

发布于 2024-12-22 21:49:12 字数 189 浏览 3 评论 0原文

我想使用 android 中的媒体记录器输出基本视频流,以便使用 live555 进行流式传输。本质上,我想让媒体记录器输出 MPEG-4 视频基本流文件(.m4e 文件)或 H.264 视频基本流文件(.264 文件)。是否可以使用 Android 上的媒体记录器来做到这一点?或者还有其他方法让它发挥作用吗?

I want to output elementary video streams with media recorder in android for the purpose of streaming with live555. In essence, I want to get media recorder to output an MPEG-4 Video Elementary Stream file (an .m4e file) or an H.264 Video Elementary Stream file (an .264 file). Is it possible to do that with media recorder on android? Or is there any other way to get it work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时间海 2024-12-29 21:49:12

从 MediaRecorder API 中,我发现您必须在调用 prepare() 之前调用 setOutputFormat(),这限制您选择可用选项之一 - 3GP/MP4。因此,您可以使用自己的解析器来操作来自媒体记录器的转储,这可以为您提供基本流。

From the MediaRecorder APIs I see that you have to call the setOutputFormat() before calling prepare(), this limits you to select one of the available options - 3GP/MP4. Hence you can use your own parser to operate on the dump from the mediarecorder, which can give you elementary streams.

影子的影子 2024-12-29 21:49:12

据我了解,答案是,在录制时使用 MediaRecorder 来做到这一点并不容易。录制视频后,您可以使用 ffmpeg 轻松完成此操作。原因是,MediaPlayer 无法录制为基本流。即使我们只录制视频,也会将其放入 3GPP 或 MP4 等容器格式中。现在,对于像 ffmpeg 这样的工具来处理这些文件,它们需要 3GPP 或 MP4 标头信息必须存在于录制的文件中。但是,MediaPlayer 仅在完成录制后才会将这些标头写入文件。

The answer is, as I understand, that it is not easy to do that with MediaRecorder while recording. You may do that without much difficulty, using ffmpeg once the video is recorded. The reason is that, MediaPlayer cannot record as elementary streams. Even if we record video only, it will be put in a container format such as 3GPP or MP4. Now, for tools like ffmpeg to work on these files, they need the 3GPP or MP4 header information must be present on the recorded file. But, MediaPlayer will write those headers to the file only after it finished recording.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文