javascript 在客户端 Web 上压缩视频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31316791/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Compress a video on client side web
提问by Safari
I have to upload a video from front-end web to my Django back-end.
我必须将视频从前端 Web 上传到我的 Django 后端。
I need to compress the video before to upload it.
我需要在上传之前压缩视频。
So, I need some libraries (for example javascript libraries) to use on client-side (browser) to compress the video and call my ajax function to upload it.
因此,我需要在客户端(浏览器)上使用一些库(例如 javascript 库)来压缩视频并调用我的 ajax 函数来上传它。
Is possible this?
这可能吗?
Can we suggest me something like javascript libraries to make this?
我们可以建议我使用 javascript 库之类的东西来做这个吗?
回答by riofly
I found this project. It is a conversion of FFMPEG decoder in javascript language. So you can use it to work images, video and audio files without upload file to server.
我找到了这个项目。它是 JavaScript 语言中 FFMPEG 解码器的转换。因此,您可以使用它来处理图像、视频和音频文件,而无需将文件上传到服务器。
Homepage: https://bgrins.github.io/videoconverter.js/
主页:https: //bgrins.github.io/videoconverter.js/
GitHub: https://github.com/bgrins/videoconverter.js
GitHub:https: //github.com/bgrins/videoconverter.js
I have not tried yet, but the demo page says that it works: https://bgrins.github.io/videoconverter.js/demo/
我还没有尝试过,但演示页面说它有效:https: //bgrins.github.io/videoconverter.js/demo/
回答by kieranpotts
No. No browser offers a video encoding API, for JavaScript to tap into. Perhaps one day there will be an official MediaEncoding API - wouldn't that be something?!
不。没有浏览器提供视频编码 API,供 JavaScript 使用。也许有一天会有一个官方的 MediaEncoding API - 那不是什么东西吗?!