Coder Social home page Coder Social logo

coderhenry66 / wavideobox Goto Github PK

View Code? Open in Web Editor NEW
814.0 814.0 179.0 18.33 MB

秒级! 三行代码实现iOS视频压缩、变速、混音、合并、GIF水印、旋转、换音、裁剪 ! 支持不同分辩率,支持你能想到的各种混合操作! 扩展性强...更多功能不断增加中... iOS 8.0 + 有需要的功能或错误欢迎issue,笔者会及时更新

License: Apache License 2.0

Objective-C 100.00%
avfoundation compression gearbox gif remix rotate video watermark

wavideobox's People

Contributors

coderhenry66 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wavideobox's Issues

如何设置某一段的速率(变速)呢?

感谢您的分享!

demo中修改速率(变速)是整体修改,如何分开修改呢?看demo大概是使用这个函数

  • (void)performWithAsset:(AVAsset *)asset models:(NSArray <WAAVSEGearboxCommandModel *> *)gearboxModels;

如果是这样,WAAVSEGearboxCommandModel 这个对象的参数应该如何传递呢?
感激不尽~

可能存在某些视频无法裁剪,希望您有时间看下,麻烦您了

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-12780), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x600000c9c1b0 {Error Domain=NSOSStatusErrorDomain Code=-12780 "(null)"}}
错误信息,视频格式MP4,并且视屏经过微信后就能裁剪 ,希望可以讨论下

拼接ffmpeg crop过的视频失败

报错:
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-12780), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x280f43870 {Error Domain=NSOSStatusErrorDomain Code=-12780 "(null)"}}

触发条件:
ffmpeg剪切后的视频片头+录屏视频-->失败(报错如上)
正常的视频片头+录屏视频-->成功

视频附件:
videos.zip

屏幕快照 2019-11-30 上午10 53 38

videoQuality 无效

1、videoQuality 设为0.1
2、ratio 为 High
压缩后视频大小不变呀

非常感谢作者大大

之前网上找了很多关于AVFoundation拼接多视频的代码没有一个可用, 后来发现作者的这个项目真心牛逼, 后来研究了一下代码发现每次合成必定需要导出生成,然而我现在项目没有必要实时导出生成文件,所以我改了一下代码,预览时仅仅只输出mutableVideoComposition以及mutableAudioMix, 因为项目涉及到混音,只输出mutableVideoComposition 混音音量大小无法调整, 后来又发现多分辨率视频生成的时候会因为第一个视频的分辨率和后续视频分辨率不同导致出现黑边,目前正在研究如何去掉黑边或者生成毛玻璃效果的,初学视频这块不懂很多,感谢作者的分享!

无法解码

Error Domain=AVFoundationErrorDomain Code=-11821 "无法解码" UserInfo={NSLocalizedFailureReason=媒体数据无法被解码,可能已损坏。, NSLocalizedDescription=无法解码, NSUnderlyingError=0x283f9f420 {Error Domain=NSOSStatusErrorDomain Code=-16977 "(null)"}} @CoderHenry66 大佬,给你发邮件了,视频在附件里

关于进度问题

首先感谢您的开源精神,考虑到实际使用场景能不能加个进度呢?

给MOV视频增加配乐,报异常

Error Domain=AVFoundationErrorDomain Code=-11800 "这项操作无法完成" UserInfo={NSLocalizedFailureReason=发生未知错误(560100710), NSLocalizedDescription=这项操作无法完成, NSUnderlyingError=0x281ae41e0 {Error Domain=NSOSStatusErrorDomain Code=560100710 "(null)" UserInfo={AVErrorFourCharCode='!buf'}}}
奇怪的是有的视频可以,有的却不行

视频倍速异常

4倍速处理原视频后,在应用内播放正常。导入系统相册后,首尾几秒钟倍速处理了,中间部分还是原始的视频速度。

例如,一个32s的视频,4倍速处理后,预览是想要的效果,保存到系统后,视频显示8s,但是传到其他的设备后显示24s,播放也异常。
IMG_3702

压缩体积不变化

指定ratio为WAVideoExportRatio960x540,改变videoQuality的大小,输出的视频还是一样的,没有清晰度和体积变化

崩溃

点击 合并+水印+旋转+... 按钮 崩溃 (我自己添加的视频 ) 视频链接http://pic.iyoufou.com/2CDF41EB-D762-4B52-B744-99159A16AD84/L0/001201910211032557202.mp4

2019-10-21 10:27:34.733467+0800 WAVideoBox[2578:206414] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This method does not support multi-video processing for the time being.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23baa1ee __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50864b20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23ba9f68 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff25614de9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 WAVideoBox 0x000000010f362de4 -[WAAVSERotateCommand performWithAsset:degress:] + 660
5 WAVideoBox 0x000000010f3699c6 __35-[WAVideoBox rotateVideoByDegress:]_block_invoke + 518
6 libdispatch.dylib 0x000000010f6a3df8 _dispatch_call_block_and_release + 12
7 libdispatch.dylib 0x000000010f6a4d6c _dispatch_client_callout + 8
8 libdispatch.dylib 0x000000010f6ab613 _dispatch_lane_serial_drain + 788
9 libdispatch.dylib 0x000000010f6ac1a3 _dispatch_lane_invoke + 422
10 libdispatch.dylib 0x000000010f6b7a64 _dispatch_workloop_worker_thread + 719
11 libsystem_pthread.dylib 0x00007fff518cd611 _pthread_wqthread + 421
12 libsystem_pthread.dylib 0x00007fff518cd3fd start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

libsystem_kernel.dylib`__pthread_kill:
0x7fff518292bc <+0>: movl $0x2000148, %eax ; imm = 0x2000148
0x7fff518292c1 <+5>: movq %rcx, %r10
0x7fff518292c4 <+8>: syscall
-> 0x7fff518292c6 <+10>: jae 0x7fff518292d0 ; <+20>
0x7fff518292c8 <+12>: movq %rax, %rdi
0x7fff518292cb <+15>: jmp 0x7fff51823457 ; cerror_nocancel
0x7fff518292d0 <+20>: retq

能否自定义码率呢

项目中想要自定义码率,但是看了自定义码率只能使用AVAssetReader和AVAssetWriter,但这个视频导出又是队列方式,没有找到处理视频的进度progress

两个视频合并时添加转场可以实现吗?

我看到现在2个视频合并是在一条视频轨道上的,苹果官方的demo用的是2个视频轨道来合并去实现添加转场效果,我尝试用2个视频轨道后发现如果视频尺寸不一致时,转场那部分进行缩放操作会和用于转场效果的transform操作有冲突。大神知道有什么办法解决吗?

压缩一直报错

error NSError * domain: @"AVFoundationErrorDomain" - code: 18446744073709539811 0x0000000282d2d4a0

压缩失败

            self.videoBox.clean()
            self.videoBox.appendVideo(byPath: self.videoPath)
            self.videoBox.ratio = .ratioMediumQuality
            self.videoBox.asyncFinishEdit(byFilePath: self.ouputVideoPath(), progress: { (progress) in
                DispatchQueue.main.async {
                     Toast.showProgress(progress)
                }
               
            }) { (error) in
                DispatchQueue.main.async {
                    if error == nil {
                        Toast.showMessage("压缩成功")
                    }else {
                        Toast.showMessage("压缩失败")
                    }
                }
            }

打印出来的两个路径

Printing description of self.videoPath:
"/var/mobile/Containers/Data/Application/16A0A00D-A4F6-4658-844A-0D83F85D4CE5/Documents/TXUGC/TXUGCRecord.mp4"
Printing description of self.videoOutputPath:
"/private/var/mobile/Containers/Data/Application/16A0A00D-A4F6-4658-844A-0D83F85D4CE5/tmp/tempVideo.mp4"

这是控制台报出来的相关错误

error:Optional("The operation couldn’t be completed. (AVFoundationErrorDomain error -11805.)")

CUICatalog: Invalid asset name supplied: ''

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.