在相机拍摄期间分割视频以提高上传效率 [英] Segmenting videos during camera capture for higher upload efficiency

查看:42
本文介绍了在相机拍摄期间分割视频以提高上传效率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个 Android 应用,用手机的摄像头拍摄视频,然后将视频(作为单个文件)上传到云端.然后我想通过将录制的视频分割成小块(比如 5 秒)并将这些块上传到云来提高效率.然后根据 这个博客.

I want to develop an Android app that captures a video with the phone's camera, then uploads the video (as a single file) to cloud. And then I want to make it more efficient by segmenting the recorded video into small chunks (say 5 seconds) and upload the chunks to the cloud. And then compare the two approach and show that the second approach is more efficient and provides faster upload according to this blog.

分块方法是否更有效?以什么方式?我该如何实施?我是要等到视频完成后再将它们组合起来,还是可以随着拍摄的进行实时进行?任何这样做的提示或经验肯定会有所帮助.

Is the chunking approach more efficient? In what ways? And how can I implement this? Shall I wait until the video is finished, then chunk them up, or can we do it in real-time as capturing progresses? Any tips or experience doing this would certainly help.

推荐答案

将视频分成多个块并并行执行处理,例如编码或打包,是目前 VOD 视频非常常用的技术.

Breaking a video into chunks and performing processing, such are encoding or packaging, in parallel is a very common technique for VOD video at this time.

只要您拥有并行处理任务的计算资源,它就可以实现更快的处理,许多多核计算机和云确实拥有这种资源.

It allows for faster processing so long as you have the computing resources to tackle tasks in parallel, which many multi core computers and the cloud do have.

它还可以让您安排在您的资源最可用时进行处理,例如在其他作业的低负载时期,或者在它们最便宜的时候安排处理,这有助于降低云计算成本.

It can also allow you to to schedule the processing when your resources are most available, in a period of low load from other jobs for example, or when they are cheapest which can help with cloud computing costs.

很难说这是否更有效,因为它取决于您正在测量的内容 - 如果您将总计算指令或周期加起来,很可能实际上需要更多这种方式,但由于上述原因,通常无论如何都是首选方法.

Its hard to say if that is more efficient as it depends on what you are measuring - if you added up the total compute instructions or cycles it is quite likely it actually takes more this way, but for the reasons above it is often the preferred approach anyway.

对于视频传输或传输,如果您能够在不同的路径上发送不同的块,每个块都有一个可以填充该段的限制,那么它确实可以节省时间或提高效率.

For video transfer or transport, if you were able to send the different chunks on different paths, each of which had a limit that you could fill with that segment, it might indeed provide time savings or efficiency.

但是,如果您的设备只有一个传输路径,例如它的 WiFi IP 连接,那么除了发送数据包时已经发生的视频分解"之外,还不清楚分割视频的好处无论如何都是通过 IP 网络的数据包.

However, If your device has a single transmission path, for example it's WiFi IP connection, then the its not clear that segmenting the video would have benefit beyond the 'breaking up' of the video that already happens when you send it packet by packet over an IP network anyway.

如果您的目标是快速视频传输,那么可能值得查看一些用于快速高效实时视频传输的专业协议.其中一些可能基于 UDP 而不是 TCP,如果是这样,您可能需要检查您的目标网络防火墙和路由规则是否支持它们.SRT 将是一个很好的例子,如下所示,其他一些存在,例如专有的 ZiXi:

If you goal is fast video transmission then it would likely be worth taking a look at some of the specialist protocols which exist for fast and efficient live video transmission. Some of these may be UDP based rather than TCP and if so you may need to check that your target network firewalls and routing rules will support them. SRT would be a good example to look, see like below, bit others exists such as ZiXi which is proprietary:

专注于传输,互联网视频流实际上被分解成块,因为它们是通过分组网络传输的.除了编码和容器(例如 mp4)分组外,视频流也将经常在更高级别分块",以支持 ABR 协议,该协议对视频进行分段以允许在不同的比特率再现之间切换(请参阅:https://stackoverflow.com/a/42365034/334402).

Focusing on transmission, internet Video streams are actually broken into chunks anyway, because they are delivered over packet networks. The video stream will also be 'chunked' at a higher level also frequently, in addition to encoding and container (e.g. mp4) groupings, to support ABR protocols which segment the video to allow different bitrate renditions be switched between (see: https://stackoverflow.com/a/42365034/334402).

如果视频块可以在整个视频下载之前开始播放,那么将视频分成多个块也有助于播放——这也是互联网上大多数流式视频的典型做法.

Breaking a video into chunks can also help with playback if the chunks can start playing before the entire video is downloaded - again this is typical of most streamed videos on the internet.

如果我们忽略不同协议重试、丢包等策略的任何影响,并且如果您有一个设置容量的单个传输管道",则将视频分成块并不会使其传输速度更快.

If we ignore any effect of different protocols retry, packet loss etc strategies, and if you have a single transmission 'pipe' of a set capacity, breaking the video into chunks does not make it faster to transfer.

但是,如果您有多个传输管道",那么将视频分解并通过不同管道并行发送不同部分确实可以加快速度.重要的是要记住,即使是这样,如果视频是实时流,您也会受到实际实时视频速率本身的限制 - 即您不能以比源生成它的速度更快地传输视频.

If, however, you have multiple transmission 'pipes' then breaking the video up and sending different parts in parallel across the different pipes may indeed speed it up. It important to remember that, even then, you are limited if the video is a live stream, by the actual live video rate itself - i.e. you can't transfer the video faster than the source is producing it.

这篇关于在相机拍摄期间分割视频以提高上传效率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆