AVAssetWriter How to create mov video with no compression?

痞子三分冷 提交于 2019-11-29 05:12:55

Try using AVVideoCodecJPEG with the AVVideoQualityKey value set to a NSNumber of 1.0. Another method is to specify H264, set the bit rate to something very very high, and specify a key frame interval of 1 (i.e. all key frames).

that key is not for disabling compression, is to specify specific compression values for certain codecs, like jpg or h264 .I.e.

    [videoSettings addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys:
                                                 AVVideoCodecH264, AVVideoCodecKey,
                                                 nil]];

        NSMutableDictionary* videoCompressionSettings = [NSMutableDictionary dictionary];

        if ([[Preferences instance] recordingH264Keyframes] > 0) {
            [videoCompressionSettings addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys:
                                                     [NSNumber numberWithInt:[[Preferences instance] recordingH264Keyframes]], AVVideoMaxKeyFrameIntervalKey,
                                                     nil]];
        }

        if ([[Preferences instance] recordingH264Bitrate] > 0) {
            [videoCompressionSettings addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys:
                                                     [NSNumber numberWithInt:[[Preferences instance] recordingH264Bitrate]*1000], AVVideoAverageBitRateKey,
                                                     nil]];
        }

        if ([videoCompressionSettings count]) {
            [videoSettings addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys:videoCompressionSettings,AVVideoCompressionPropertiesKey,nil]];
        }

The ProRes4444 video codec is the closest thing Apple supplies to an uncompressed codec. This codec is not available on iOS for writing video content only OS X.

It is not possible on iOS to export video content uncompressed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!