From 55a73414527f35eb2b5e20e17f6a9631d3b037b7 Mon Sep 17 00:00:00 2001 From: kintanwang Date: Wed, 6 Dec 2017 21:24:54 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=94=B9=E6=88=90=E5=8F=AF=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SDAVAssetExportSession.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDAVAssetExportSession.h b/SDAVAssetExportSession.h index b954132..865cd78 100644 --- a/SDAVAssetExportSession.h +++ b/SDAVAssetExportSession.h @@ -123,7 +123,7 @@ * * If there is no error to report, the value of this property is nil. */ -@property (nonatomic, strong, readonly) NSError *error; +@property (nonatomic, strong) NSError *error; /** * The progress of the export on a scale from 0 to 1. From 51b8829487c3bedfd0f693478db576c06ac8e8ff Mon Sep 17 00:00:00 2001 From: kintanwang Date: Wed, 6 Dec 2017 21:57:55 +0800 Subject: [PATCH 2/5] no message --- SDAVAssetExportSession.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SDAVAssetExportSession.h b/SDAVAssetExportSession.h index 865cd78..0cc7c3f 100644 --- a/SDAVAssetExportSession.h +++ b/SDAVAssetExportSession.h @@ -37,6 +37,8 @@ @property (nonatomic, weak) id delegate; +@property (nonatomic, strong) AVAssetReader *reader; +@property (nonatomic, strong) AVAssetWriter *writer; /** * The asset with which the export session was initialized. */ From fc01e7db1f8a7f84d5166b4bae9783dbf6df181e Mon Sep 17 00:00:00 2001 From: kintanwang Date: Wed, 6 Dec 2017 22:02:47 +0800 Subject: [PATCH 3/5] no message --- SDAVAssetExportSession.h | 2 ++ SDAVAssetExportSession.m | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/SDAVAssetExportSession.h b/SDAVAssetExportSession.h index 0cc7c3f..0d5ed68 100644 --- a/SDAVAssetExportSession.h +++ b/SDAVAssetExportSession.h @@ -39,6 +39,8 @@ @property (nonatomic, strong) AVAssetReader *reader; @property (nonatomic, strong) AVAssetWriter *writer; +@property (nonatomic, strong) dispatch_queue_t inputQueue; + /** * The asset with which the export session was initialized. */ diff --git a/SDAVAssetExportSession.m b/SDAVAssetExportSession.m index e99993b..e5c07ec 100755 --- a/SDAVAssetExportSession.m +++ b/SDAVAssetExportSession.m @@ -16,15 +16,11 @@ @interface SDAVAssetExportSession () @property (nonatomic, assign, readwrite) float progress; - -@property (nonatomic, strong) AVAssetReader *reader; @property (nonatomic, strong) AVAssetReaderVideoCompositionOutput *videoOutput; @property (nonatomic, strong) AVAssetReaderAudioMixOutput *audioOutput; -@property (nonatomic, strong) AVAssetWriter *writer; @property (nonatomic, strong) AVAssetWriterInput *videoInput; @property (nonatomic, strong) AVAssetWriterInputPixelBufferAdaptor *videoPixelBufferAdaptor; @property (nonatomic, strong) AVAssetWriterInput *audioInput; -@property (nonatomic, strong) dispatch_queue_t inputQueue; @property (nonatomic, strong) void (^completionHandler)(void); @end From 8bf6a5d3d6075cd39b69d470f1e51e20c5955631 Mon Sep 17 00:00:00 2001 From: kintanwang Date: Wed, 27 Dec 2017 13:26:55 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=A3=B0=E9=9F=B3=E9=87=87=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SDAVAssetExportSession.h | 9 +++++---- SDAVAssetExportSession.m | 18 +++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/SDAVAssetExportSession.h b/SDAVAssetExportSession.h index 0d5ed68..33aec49 100644 --- a/SDAVAssetExportSession.h +++ b/SDAVAssetExportSession.h @@ -37,14 +37,15 @@ @property (nonatomic, weak) id delegate; -@property (nonatomic, strong) AVAssetReader *reader; -@property (nonatomic, strong) AVAssetWriter *writer; -@property (nonatomic, strong) dispatch_queue_t inputQueue; +@property (nonatomic, strong, readonly) AVAssetReader *reader; +@property (nonatomic, strong, readonly) AVAssetWriter *writer; +@property (nonatomic, strong, readonly) dispatch_queue_t inputQueue; /** * The asset with which the export session was initialized. */ -@property (nonatomic, strong, readonly) AVAsset *asset; +@property (nonatomic, strong) AVAsset *asset; +@property (nonatomic, copy) AVAudioTimePitchAlgorithm audioTimePitchAlgorithm NS_AVAILABLE(10_9, 7_0); /** * Indicates whether video composition is enabled for export, and supplies the instructions for video composition. diff --git a/SDAVAssetExportSession.m b/SDAVAssetExportSession.m index e5c07ec..35cd9c1 100755 --- a/SDAVAssetExportSession.m +++ b/SDAVAssetExportSession.m @@ -21,6 +21,9 @@ @interface SDAVAssetExportSession () @property (nonatomic, strong) AVAssetWriterInput *videoInput; @property (nonatomic, strong) AVAssetWriterInputPixelBufferAdaptor *videoPixelBufferAdaptor; @property (nonatomic, strong) AVAssetWriterInput *audioInput; +@property (nonatomic, strong) AVAssetReader *reader; +@property (nonatomic, strong) AVAssetWriter *writer; +@property (nonatomic, strong) dispatch_queue_t inputQueue; @property (nonatomic, strong) void (^completionHandler)(void); @end @@ -141,13 +144,14 @@ - (void)exportAsynchronouslyWithCompletionHandler:(void (^)(void))handler // NSArray *audioTracks = [self.asset tracksWithMediaType:AVMediaTypeAudio]; if (audioTracks.count > 0) { - self.audioOutput = [AVAssetReaderAudioMixOutput assetReaderAudioMixOutputWithAudioTracks:audioTracks audioSettings:nil]; - self.audioOutput.alwaysCopiesSampleData = NO; - self.audioOutput.audioMix = self.audioMix; - if ([self.reader canAddOutput:self.audioOutput]) - { - [self.reader addOutput:self.audioOutput]; - } + self.audioOutput = [AVAssetReaderAudioMixOutput assetReaderAudioMixOutputWithAudioTracks:audioTracks audioSettings:nil]; + self.audioOutput.audioTimePitchAlgorithm = self.audioTimePitchAlgorithm; + self.audioOutput.alwaysCopiesSampleData = NO; + self.audioOutput.audioMix = self.audioMix; + if ([self.reader canAddOutput:self.audioOutput]) + { + [self.reader addOutput:self.audioOutput]; + } } else { // Just in case this gets reused self.audioOutput = nil; From 223770a3d639d4e3a7666b821cf2c59f8012d618 Mon Sep 17 00:00:00 2001 From: kintanwang Date: Fri, 29 Dec 2017 18:55:21 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A9=BA=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SDAVAssetExportSession.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SDAVAssetExportSession.m b/SDAVAssetExportSession.m index 35cd9c1..61f99c3 100755 --- a/SDAVAssetExportSession.m +++ b/SDAVAssetExportSession.m @@ -145,7 +145,9 @@ - (void)exportAsynchronouslyWithCompletionHandler:(void (^)(void))handler NSArray *audioTracks = [self.asset tracksWithMediaType:AVMediaTypeAudio]; if (audioTracks.count > 0) { self.audioOutput = [AVAssetReaderAudioMixOutput assetReaderAudioMixOutputWithAudioTracks:audioTracks audioSettings:nil]; - self.audioOutput.audioTimePitchAlgorithm = self.audioTimePitchAlgorithm; + if (self.audioTimePitchAlgorithm) { + self.audioOutput.audioTimePitchAlgorithm = self.audioTimePitchAlgorithm; + } self.audioOutput.alwaysCopiesSampleData = NO; self.audioOutput.audioMix = self.audioMix; if ([self.reader canAddOutput:self.audioOutput])