在观看时将 HTTP 实时流视频录制到文件?

发布于 2024-11-19 21:04:35 字数 820 浏览 12 评论 0原文

我正在尝试在我正在开发的应用程序中创建类似流视频 DVR 的功能。我有一个 HTTP Live Stream,我已成功在 iPad 上播放它。我希望用户能够按下“录制”按钮,并从该点开始录制当前正在播放的视频。该视频文件可以从应用程序或相机胶卷访问。目前,我正在使用 MPMoviePlayerController 对象来播放视频流。我在Apple的文档中没有看到任何从对象访问数据的方法。以下是我对解决这个问题的一些想法。

1) 以某种方式从 MPMoviePlayerController 访问视频数据,并将其写入文件。或者使用另一种类型的播放器对象,它允许我播放视频并访问当前播放的数据。

2) 实现某种屏幕捕获记录,获取 iPad 屏幕的视频捕获。这将使我能够以“屏幕截图”的方式录制视频。

3) 找到 MPMoviePlayerController 存储的 HTTP Live Streaming 视频片段。据推测,它们需要存储在 iPad 上的某个位置才能播放。有没有办法访问这些文件?

4) 在流式传输文件时通过 http 手动下载流式视频片段。这似乎并不理想,因为必须下载两次流。

5)这可行。定期将视频片段下载到 iPhone。在 iPhone 上设置本地 http 服务器并将视频服务器到 MPMoviePlayerController。这样,视频片段就可以被标记为录制并组合成视频。

6)我确实可以控制流媒体服务器。我可以编写一些服务器端代码来在服务器端录制视频,然后将视频发送到 iPad。我宁愿不这样做。

有人做过这些事情吗?理想情况下,iPhone 能够以某种方式访问​​视频数据并轻松录制。如果不需要,我宁愿不选择选项 4、5 或 6(上文)。

提前致谢。

I am trying to create a streaming video DVR like functionality in an app I am developing. I have an HTTP Live Stream that I have successfully gotten to play on the iPad. I want the user to be able to push the "Record" button, and begin recording the video that is currently playing from that point. This video file will be accessible from the app or from the camera roll. Currently, I am using the MPMoviePlayerController object to play the video stream. I do not see any methods of accessing the data from the object in Apple's documentation. Here are some thoughts I had on ways of going about this.

1) Somehow access the video data from MPMoviePlayerController, and write this to a file. Or use another type of player object that will allow me to play the video and access the currently playing data.

2) Implement some sort of screen capture recording that gets a video capture of the iPad's screen. This would allow me to record the video in a "screenshot" sort of way.

3) Locate the HTTP Live Streaming video segments where they are stored by MPMoviePlayerController. Presumably they need to be stored somewhere on the iPad for playback. Is there a way of accessing these files?

4) Manually download the stream video segments over http while streaming the file. This seems like its not ideal since the stream would have to be downloaded twice.

5) This could work. Periodically download the video segments to the iPhone. Set up a local http server on the iPhone and server the videos to the MPMoviePlayerController. This way the video segments could be marked for recording and assembled into a video.

6) I do have control of the streaming server. I could write some server side code to record the video on the server end, then send the video to the iPad after the fact. I would rather not do this.

Has anyone done any of these things? Ideally the iPhone would just be able to access the video data somehow and easily record it. I would rather not get into options 4, 5, or 6 (above) if I don't have to.

Thanks in advance.

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

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

发布评论

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

评论(1

墨离汐 2024-11-26 21:04:36

由于可用空间有限以及其他因素(例如电池寿命、处理能力、用户停止 dvr 后的清理程序等),不鼓励在设备上安装 DVR。

如果您想在 iOS 设备(或其他设备)上实现 DVR 播放使用 HLS),我建议您保留视频服务器端。直播流已经在服务器端捕获并分段,您所要做的就是将分段保留更长一点,而不是删除它们。通过使用 EXT-X -播放列表类型EXT-X-MEDIA-SEQUENCE< /a> 标签,您可以向玩家建议他正在打开一个有 DVR(早期)视频可用的直播。

或者,您可以使用开箱即用的服务器,例如 Wowza。 这里有一篇关于如何使用 Wowza 实现此目标的文章

DVR on the device is somewhat not encouraged, due to the limited space available and other factors like battery life, processing power, cleanup procedures after the user stops the dvr, etc.

If you want to achieve DVR playback on iOS devices (or other devices using HLS), I suggest you keep the video server side. The live stream is already captured and segmented server side, all you would have to do is keep the segments a bit longer, instead of deleting them. By using the EXT-X-PLAYLIST-TYPE and EXT-X-MEDIA-SEQUENCE tags, you can suggest to the player that he's opening a live stream which has DVR (earlier) video available.

Alternatively, you can use a server that does that out of the box, for example Wowza. Here's an article on how to achieve this with Wowza

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