久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='S6FQY'></tfoot>

<small id='S6FQY'></small><noframes id='S6FQY'>

    <legend id='S6FQY'><style id='S6FQY'><dir id='S6FQY'><q id='S6FQY'></q></dir></style></legend>

    • <bdo id='S6FQY'></bdo><ul id='S6FQY'></ul>

    1. <i id='S6FQY'><tr id='S6FQY'><dt id='S6FQY'><q id='S6FQY'><span id='S6FQY'><b id='S6FQY'><form id='S6FQY'><ins id='S6FQY'></ins><ul id='S6FQY'></ul><sub id='S6FQY'></sub></form><legend id='S6FQY'></legend><bdo id='S6FQY'><pre id='S6FQY'><center id='S6FQY'></center></pre></bdo></b><th id='S6FQY'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='S6FQY'><tfoot id='S6FQY'></tfoot><dl id='S6FQY'><fieldset id='S6FQY'></fieldset></dl></div>

      如何使用 iOS SDK 修剪視頻文件并轉換為 15 秒視頻

      How to trim the video file and convert to 15 seconds video with iOS SDK?(如何使用 iOS SDK 修剪視頻文件并轉換為 15 秒視頻?)
      • <bdo id='VgCTf'></bdo><ul id='VgCTf'></ul>
      • <legend id='VgCTf'><style id='VgCTf'><dir id='VgCTf'><q id='VgCTf'></q></dir></style></legend>
      • <tfoot id='VgCTf'></tfoot>
        <i id='VgCTf'><tr id='VgCTf'><dt id='VgCTf'><q id='VgCTf'><span id='VgCTf'><b id='VgCTf'><form id='VgCTf'><ins id='VgCTf'></ins><ul id='VgCTf'></ul><sub id='VgCTf'></sub></form><legend id='VgCTf'></legend><bdo id='VgCTf'><pre id='VgCTf'><center id='VgCTf'></center></pre></bdo></b><th id='VgCTf'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VgCTf'><tfoot id='VgCTf'></tfoot><dl id='VgCTf'><fieldset id='VgCTf'></fieldset></dl></div>

            <small id='VgCTf'></small><noframes id='VgCTf'>

              <tbody id='VgCTf'></tbody>

                本文介紹了如何使用 iOS SDK 修剪視頻文件并轉換為 15 秒視頻?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我想修剪視頻文件.我只想從畫廊中挑選視頻并將其轉換為 15 秒視頻.如果我使用選擇器視圖控制器進行正常修剪,它不會指定時間而只顯示幀,但我需要固定 15 秒.我怎樣才能做到這一點?

                I want to trim a video file. I want to just pick the video from a gallery and convert it to a 15-second video. If I use normal trimming with picker view controller, it does not specify a time and just shows the frames, but I need to be fixed for 15 seconds. How can I achieve this?

                推薦答案

                Objective-C

                -(void)cropVideo:(NSURL*)videoToTrimURL{
                    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:videoToTrimURL options:nil];
                    AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetHighestQuality];
                
                    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];
                
                
                    exportSession.outputURL = [NSURL fileURLWithPath:outputURL];
                    exportSession.shouldOptimizeForNetworkUse = YES;
                    exportSession.outputFileType = AVFileTypeQuickTimeMovie;
                    CMTime start = CMTimeMakeWithSeconds(1.0, 600); // you will modify time range here
                    CMTime duration = CMTimeMakeWithSeconds(15.0, 600);
                    CMTimeRange range = CMTimeRangeMake(start, duration);
                    exportSession.timeRange = range;
                    [exportSession exportAsynchronouslyWithCompletionHandler:^(void)
                     {
                         switch (exportSession.status) {
                             case AVAssetExportSessionStatusCompleted:
                                 [self writeVideoToPhotoLibrary:[NSURL fileURLWithPath:outputURL]];
                                 NSLog(@"Export Complete %d %@", exportSession.status, exportSession.error);
                                 break;
                             case AVAssetExportSessionStatusFailed:
                                 NSLog(@"Failed:%@",exportSession.error);
                                 break;
                             case AVAssetExportSessionStatusCancelled:
                                 NSLog(@"Canceled:%@",exportSession.error);
                                 break;
                             default:
                                 break;
                         }
                
                         //[exportSession release];
                     }];
                }
                

                在 Swift 4.0 中

                    static func cropVideo(atURL url:URL) {
                    let asset = AVURLAsset(url: url)
                    let exportSession = AVAssetExportSession.init(asset: asset, presetName: AVAssetExportPresetHighestQuality)!
                    var outputURL = URL(string:NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last!)
                
                    let fileManager = FileManager.default
                    do {
                        try fileManager.createDirectory(at: outputURL!, withIntermediateDirectories: true, attributes: nil)
                    } catch {
                
                    }
                
                    outputURL?.appendPathComponent("output.mp4")
                    // Remove existing file
                    do {
                        try fileManager.removeItem(at: outputURL!)
                    }
                    catch {
                
                    }
                
                    exportSession.outputURL = outputURL
                    exportSession.shouldOptimizeForNetworkUse = true
                    exportSession.outputFileType = AVFileTypeQuickTimeMovie
                    let start = CMTimeMakeWithSeconds(1.0, 600) // you will modify time range here
                    let duration = CMTimeMakeWithSeconds(15.0, 600)
                    let range = CMTimeRangeMake(start, duration)
                    exportSession.timeRange = range
                    exportSession.exportAsynchronously {
                        switch(exportSession.status) {
                        case .completed: break
                            //
                        case .failed: break
                            //
                        case .cancelled: break
                            //
                        default: break
                        }
                    }
                }
                

                這篇關于如何使用 iOS SDK 修剪視頻文件并轉換為 15 秒視頻?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                How to animate a UIImageview to display fullscreen by tapping on it?(如何通過點擊動畫 UIImageview 以顯示全屏?)
                To stop segue and show alert(停止 segue 并顯示警報)
                iOS 5 storyboard, programmatically determine path(iOS 5 故事板,以編程方式確定路徑)
                Icon already includes gloss effects(圖標已經包含光澤效果)
                How does UIEdgeInsetsMake work?(UIEdgeInsetsMake 是如何工作的?)
                UIProgressView and Custom Track and Progress Images (iOS 5 properties)(UIProgressView 和自定義跟蹤和進度圖像(iOS 5 屬性))

                  <tbody id='Yyr9L'></tbody>
                    <bdo id='Yyr9L'></bdo><ul id='Yyr9L'></ul>
                  • <tfoot id='Yyr9L'></tfoot>
                    <legend id='Yyr9L'><style id='Yyr9L'><dir id='Yyr9L'><q id='Yyr9L'></q></dir></style></legend>

                      <small id='Yyr9L'></small><noframes id='Yyr9L'>

                      <i id='Yyr9L'><tr id='Yyr9L'><dt id='Yyr9L'><q id='Yyr9L'><span id='Yyr9L'><b id='Yyr9L'><form id='Yyr9L'><ins id='Yyr9L'></ins><ul id='Yyr9L'></ul><sub id='Yyr9L'></sub></form><legend id='Yyr9L'></legend><bdo id='Yyr9L'><pre id='Yyr9L'><center id='Yyr9L'></center></pre></bdo></b><th id='Yyr9L'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Yyr9L'><tfoot id='Yyr9L'></tfoot><dl id='Yyr9L'><fieldset id='Yyr9L'></fieldset></dl></div>

                        • 主站蜘蛛池模板: 国产人成精品一区二区三 | 日韩在线免费视频 | 女同久久另类99精品国产 | 久久久久国产精品 | 久久免费精品视频 | 天天操网| 亚洲伦理自拍 | 欧美不卡一区二区 | 91秦先生艺校小琴 | 亚洲逼院 | 久久99精品久久久久久狂牛 | 国产精品日日夜夜 | 国产精品久久久久久久久久久久 | 欧美在线小视频 | 久久免费精品视频 | 国产精品日韩欧美一区二区 | 午夜视频一区二区三区 | 欧美日韩亚洲在线 | 精品一区二区电影 | 99re6热在线精品视频播放 | 黄色免费网站在线看 | 欧美日韩国产一区二区三区 | 欧美国产精品 | 久久久www成人免费精品张筱雨 | 久久久久久免费毛片精品 | 国产日产久久高清欧美一区 | 亚洲免费视频网站 | 国产精品无码久久久久 | 亚洲福利| 国产成人一区二区三区电影 | 91精品国产色综合久久不卡98 | 欧美日韩视频在线播放 | 中文字幕免费中文 | 久久久久久成人 | 麻豆av片 | 精品自拍视频在线观看 | 亚洲国产一区二区视频 | 欧美乱大交xxxxx另类电影 | 女朋友的闺蜜3韩国三级 | 浮生影院免费观看中文版 | 亚洲国产精品久久久久秋霞不卡 |