久久久久久久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>

                        • 主站蜘蛛池模板: 亚洲欧美激情精品一区二区 | 欧洲一级黄 | 91视频88av| 日本色婷婷| av在线一区二区三区 | 岛国精品| 国产乱码精品一区二区三区中文 | 日本不卡在线观看 | 伊人春色在线观看 | 午夜影院在线 | 精品久久网| 欧美中文 | 成人精品| 欧美精品在线看 | 成人免费视频 | 成人做爰www免费看视频网站 | 成人三级在线播放 | 国产 欧美 日韩 一区 | 欧美日韩一区二区三区四区五区 | 国产精品欧美一区二区 | 亚洲日本一区二区三区四区 | 国产精品日韩在线观看 | 亚洲在线久久 | 久久久久久久国产 | 天天操天天天干 | 午夜免费av | 欧美日韩一区二区三区不卡视频 | 国内精品一区二区三区 | 综合久久久 | 久久久久久久国产精品 | 国产一区二区三区免费 | 亚洲一区二区三区在线播放 | 在线国产一区 | 欧美日韩在线精品 | 国产成人久久av免费高清密臂 | 天堂网av在线 | 国产激情在线 | 日韩午夜 | 美女在线视频一区二区三区 | 欧美一级电影免费 | 精品永久 |