简体   繁体   English

如何缩小视频文件大小(swift 5)

[英]How to Shrink a Video File Size (swift 5)

i'm shocked that such a common problem have so little posts/tutorials about it!我很震惊这样一个常见的问题有这么少的帖子/教程! (google it your self and see) (自己google一下看看)

input: video url (probably from photo lib.) output: video url (compressed, low quality)输入:视频 url(可能来自照片库) output:视频 url(压缩,低质量)

all the solutions i found were either too old/in Obj C/wrong even!我发现的所有解决方案要么太旧/在 Obj C 中/甚至是错误的!

thank you for taking the time to help me:)谢谢你花时间帮助我:)

i found a very helpful post here:我在这里找到了一个非常有用的帖子:

https://medium.com/samkirkiles/swift-using-avassetwriter-to-compress-video-files-for-network-transfer-4dcc7b4288c5 https://medium.com/samkirkiles/swift-using-avassetwriter-to-compress-video-files-for-network-transfer-4dcc7b4288c5

the version used is swift 3, but xcode with fix all the problems.使用的版本是 swift 3,但 xcode 修复了所有问题。

but it only compress.mov files, which is okay since this is the format used by apple (iPhones, macs, etc..)但它只压缩 .mov 文件,这没关系,因为这是苹果(iPhone、Mac 等)使用的格式

hope it helps.希望能帮助到你。

(to adjust the compression degree, multiply the bitrate by some constant) (调整压缩程度,将比特率乘以某个常数)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM