如何在Android中通过保存到SD卡来保存流媒体视频?

发布于 2024-08-17 03:02:48 字数 37 浏览 3 评论 0原文

我需要从 URL 流式传输视频,然后将视频保存到 SD 卡。

I need to stream videos from an URL and then i want to save the video to SDcard.

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

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

发布评论

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

评论(2

星軌x 2024-08-24 03:02:48

对于视频流,请查看以下示例/项目:
Android 上的音频和视频 - 官方文档
Vidtry 是 Mark Murphy 的一个开源项目
Davanum 的视频流示例(这可能已过时)

保存到 SDcard:我不太确定,但是一旦您的代码中有视频流(抽象为 InputStream),您应该能够使用正常的文件 I/O 操作将其保存在 SD 卡上。

For video streaming take a look at the following example/projects:
Audio and Video on Android- Official Documentation
Vidtry an Open Source Project by Mark Murphy
Video Streaming Example by Davanum(this might be out of date)

Saving to SDcard: I am not very sure, but once you have the video stream(abstracted as InputStream) in your code you should be able to save it on SD card using normal File I/O operations.

何以畏孤独 2024-08-24 03:02:48

准备要流式传输的视频时要小心。 MediaPlayer 类的文档表示,仅当满足以下 2 个条件时,它才接受通过 HTTP 的视频流:

  1. “moov”原子必须位于“mdat”原子之前。
  2. 剪辑必须合理地交错。

虽然第一个条件非常简单,但关于第二个条件,我找不到关于剪辑“合理交错”意味着什么的明确答案。

Be careful when you prepare your videos for streaming. The documentation on the MediaPlayer class says it is accepting video streaming over HTTP only if the following 2 conditions are true:

  1. The 'moov' atom has to be before the 'mdat' atom.
  2. The clip has to be reasonably interleaved.

While the first condition is quite straightforward, about the 2nd one I couldn't find a definitive answer on what does it mean for a clip to be "reasonably interleaved".

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