如何在上传服务器之前以 Angular 压缩视频? [英] How To Compress Video in Angular Before Upload Server?

查看:49
本文介绍了如何在上传服务器之前以 Angular 压缩视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Angular 应用程序,它通过 Spring Boot Server 将视频上传到 S3 存储桶.但是,我需要减小视频的大小,因为我需要从移动设备上传 30MB 的视频.

I have an Angular App that uploads videos through Spring Boot Server to S3 bucket. However, I need to reduce the size of videos since I need to upload 30MB videos from mobile devices.

  • 有没有办法在将视频上传到我的服务器之前降低视频质量?

  • Is there a way I can reduce the quality of the video before uploading it to my server?

或者您是否推荐其他一些可以减少等待时间的策略?了解视频最终将托管在 S3 存储桶中,也许在我的 Spring Boot 服务器上执行压缩?

Or do you recommend some other strategy that allows to reduce the waiting time? With the understanding that the videos are finally going to be hosted in a S3 bucket, perhaps performing the compression on my Spring Boot server?

在这一点上,我想澄清一下,当我的 Angular 应用程序将视频发送到 Spring Boot 服务器时,它是否会作为MultipartFile"到达.通过使用 Angular 的 HTTPClient 的 POST 请求.

At this point, I would like to clarify if when sending the video from my Angular App to the Spring Boot server, it would arrive as a "MultipartFile" through a POST request using Angular's HTTPClient.

认为在 Spring Boot 服务器上压缩视频的策略可以减少视频的加载时间是否有意义,因为视频是从 Spring Boot 加载到 S3 的?.

Does it make sense to think that the strategy of compressing the video on the Spring Boot server can reduce the loading time of the video, since from Spring Boot the video is loaded to S3?.

有经验的可以帮我解释一下吗?

Can someone with experience please clarify this for me?

推荐答案

有没有办法在上传前降低视频质量到我的服务器?

Is there a way I can reduce the quality of the video before uploading it to my server?

请注意,压缩视频是一项繁重且耗时的操作,需要使用客户端编程语言 (javascript) 通过网络浏览器完成.您可能会发现像 videoconverter.js 这样的 javascript 库似乎无法正常工作.但是,在发送到服务器之前通过 Web 浏览器对 图像 执行的相同操作是有意义的,您可以为它找到工作库.

Note that compressing a video is a heavy and time consuming operation to be done through a web browser using client side programming languages (javascript). You may find javascript libraries like videoconverter.js which doesn't seem to work properly. But, the same action for images through the web browser before sending to the server makes sense and you can find working libraries for it.

或者您是否推荐其他一些可以减少等待时间?了解视频终于要开始了托管在 S3 存储桶中,可能对我的Spring Boot 服务器?

Or do you recommend some other strategy that allows to reduce the waiting time? With the understanding that the videos are finally going to be hosted in a S3 bucket, perhaps performing the compression on my Spring Boot server?

即使在服务器端,也不建议执行如此繁重的操作.一种可能的客户端解决方案是修剪按秒排序的视频文件以制作嵌套视频文件,然后将它们发送到服务器.之后,您可以部分使用它们或连接起来再次制作单个视频文件.

This is not recommended to do such heavy operation even on server-side. A possible client-side solution is trimming the video file ordered by seconds to make nested video files and then send them to the server. After that, you can use them partially or concatenate to make a single video file again.

认为压缩视频的策略有意义吗?在 Spring Boot 服务器上可以减少视频的加载时间,因为从 Spring Boot 视频被加载到 S3?.

Does it make sense to think that the strategy of compressing the video on the Spring Boot server can reduce the loading time of the video, since from Spring Boot the video is loaded to S3?.

这取决于您如何执行操作.按需压缩不是一个好的选择.使用后台工作进程在服务前生成新文件的压缩是一个不错的选择.

It depends on how you perform the operation. On demand compression is not a good choice. The compression using background worker process to produce new files before serving is a good choice.

这篇关于如何在上传服务器之前以 Angular 压缩视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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