Мне нужно сделать " медленное движение" в видеофайле вместе со звуком, между некоторыми кадрами и потребовать сохранить увеличенное видео в качестве нового видео.
Ссылка: http://www.youtube.com/watch?v=BJ3_xMGzauk (смотреть от 0 до 10 с)
Из моего анализа я обнаружил, что может быть полезно AVFoundation.
Скопируйте и вставьте по ссылке выше:
" редактирование AV Foundation использует композиции для создания новых активов из существующих фрагментов медиа (как правило, один или несколько видео- и аудиодорожек). Вы используете изменяемую композицию для добавления и удаления треков и корректировки их временных порядков. Вы также можете установить относительные объемы и линейные изменения звуковых дорожек; и установите прозрачность и непрозрачность рамп видеодорожек. Композиция представляет собой совокупность кусочков носителя, хранящихся в памяти. Когда вы экспортируете композицию с использованием сеанса экспорта, она сворачивается в файл. На iOS 4.1 и более поздних версиях вы также можете создать ресурс с носителей, таких как буферы выборки или неподвижные изображения, с помощью записи объекта.
"
Вопросы: Могу ли я сделать "замедленное" видео/аудиофайл с помощью AVFoundation? Или есть ли другой доступный пакет? Если я хочу обрабатывать аудио и видео отдельно, пожалуйста, помогите мне, как это сделать?
Обновление:: Код для сеанса экспорта AV:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *outputURL = paths[0];
NSFileManager *manager = [NSFileManager defaultManager];
[manager createDirectoryAtPath:outputURL withIntermediateDirectories:YES attributes:nil error:nil];
outputURL = [outputURL stringByAppendingPathComponent:@"output.mp4"];
// Remove Existing File
[manager removeItemAtPath:outputURL error:nil];
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:self.inputAsset presetName:AVAssetExportPresetLowQuality];
exportSession.outputURL = [NSURL fileURLWithPath:outputURL]; // output path;
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
[exportSession exportAsynchronouslyWithCompletionHandler:^(void) {
if (exportSession.status == AVAssetExportSessionStatusCompleted) {
[self writeVideoToPhotoLibrary:[NSURL fileURLWithPath:outputURL]];
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeVideoAtPathToSavedPhotosAlbum:[NSURL fileURLWithPath:outputURL] completionBlock:^(NSURL *assetURL, NSError *error){
if (error) {
NSLog(@"Video could not be saved");
}
}];
} else {
NSLog(@"error: %@", [exportSession error]);
}
}];