avasset

How to merge multiple videos using AVAsset in iOS?

为君一笑 提交于 2019-12-12 10:17:00
问题 I want to merge multiple videos into one. But i don't know how to do this so please help me for this issue. Below is my code but its not working for me. AVMutableComposition* mixComposition = [AVMutableComposition composition]; AVMutableCompositionTrack *compositionCommentaryTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; [compositionCommentaryTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset.duration) ofTrack:[

How can I extract metadata from mp3 file in ios development

回眸只為那壹抹淺笑 提交于 2019-12-12 07:38:09
问题 I am working on an ios music player with cloud storage. I need to extract the music information such as title, artist, artwork. I have an action called playit which plays and pauses the mp3 file. It should also populate some UILables and UIImage with the metadtaa that is associated with the mp3 file. The problem is that I could not get the metadata extracted from more than different 25 mp3 files. Here is my code: The file url is correct because the audio player is able to find and play it,

Error Domain=NSOSStatusErrorDomain Code=-12780 \“(null)\”

放肆的年华 提交于 2019-12-12 05:49:13
问题 When I try to export the asset with AVAssetExport I get the following error only on videos received through whatsapp probably. I could not find a working solution. I've also tried implementing code to fix video duration, but I did not fix it. Error is : Error Domain=NSOSStatusErrorDomain Code=-12780 \"(null)\" Here code PHCachingImageManager().requestAVAsset(forVideo: asset.phAsset!, options: nil, resultHandler: { (AVAssetRecivied, audioMix, info) in let AVAssetMy = AVAssetRecivied!

How to fix empty asset issue with PHImageManager in AssetsPickerController iOS?

一个人想着一个人 提交于 2019-12-11 23:54:42
问题 I am working on AssetsPickerController in Swift to select multiple Videos from Device gallery . Problem: When I am selecting multiple Videos or sometimes single video then sometimes my App is crashing due to Empty Video Asset . This is happening 5-10 times, out of 100 times of testing. Code: @IBAction func openAssetsAction(_ sender: UIButton) { let rootListAssets = AssetsPickerController() rootListAssets.didSelectAssets = {(assets: Array<PHAsset?>) -> () in for i in 0..<assets.count { let

How to get video duration in Document Directory

守給你的承諾、 提交于 2019-12-11 15:22:22
问题 It might be duplicate question but I spent to much time for solution. I download a mp4 file to documentary directory. I can get all file names with this function: func listFilesFromDocumentsFolder() -> [String]? { let fileMngr = FileManager.default; let docs = fileMngr.urls(for: .documentDirectory, in: .userDomainMask)[0].path return try? fileMngr.contentsOfDirectory(atPath:docs) } And I want to get all of these file's time length. Let me show what I try: var downs =

AVAssetTrack with alpha channel?

一世执手 提交于 2019-12-11 14:56:37
问题 I am trying to layer AVAssetTracks in an AVMutableComposition where the AVAssetTracks have an alpha channel in the video. I have successfully exported an video AVAsset with pixel buffers than have an alpha channel and transparency, but when I try to add that into an AVMutableCompositionTrack and layer it, it doesnt display correctly. Is this possible? Is the magic performed when the AVAsset is created or in a the AVMutableComposition or AVVideoComposition? Any clues would be a huge help. 回答1:

AVMutableComposition - Only Playing First Track (Swift)

情到浓时终转凉″ 提交于 2019-12-11 13:43:05
问题 I have an array of [AVAsset], and I am trying to combine all of those Assets into a single Asset so that I can play back the video seamlessly (I tried using an AVQueuePlayer, but that does not play back the assets seamlessly). Below is what I have so far, but when I try to play the final composition, it only plays the first track, even though it shows that it has all tracks and the total duration equals all of the tracks together. Am I missing a step, even though it appears that all the

Video TableViewCell Cause Memory Error in Swift

断了今生、忘了曾经 提交于 2019-12-11 10:29:38
问题 I am trying to build a tableview cell that include videos in it. I am keeping my cell in nscache as I saw in another post in stack overflow. There goes my code: Firstly I am calling this in viewDidload() and when index path.row %5=0 cache = NSMutableDictionary() do { // create post request let url = NSURL(string: "http://molocate.elasticbeanstalk.com/video/api/explore/all/")! let request = NSMutableURLRequest(URL: url) request.HTTPMethod = "GET" // insert json data to the request //print

UIActivity and AVAsset data type usage

孤者浪人 提交于 2019-12-11 09:28:30
问题 According to the UIActivity Class documentation it is possible to add AVAsset objects as a datasource to UIActivityTypePostToFacebook activity. Does it mean that we can post videos using the standard UIActivityTypePostToFacebook activity type? If not then what kind of items can I post using AVAsset activity item? 回答1: Well.. According to UIActivity.h UIKIT_EXTERN NSString *const UIActivityTypePostToFacebook NS_AVAILABLE_IOS(6_0); // text, images, URLs UIKIT_EXTERN NSString *const

Modifying Metadata from PHAsset with mediaType Video fails

≡放荡痞女 提交于 2019-12-11 05:21:56
问题 I try adding/modifying the Metadata from an PHAsset with mediaType == .video I found some Questions refering to a similar problem: How to change video metadata using AVAssetWriter? Add custom metadata to video using AVFoundation Regarding to the Answers in these Questions I build the following snippet which is a extension of a PHAsset: let options = PHVideoRequestOptions() options.version = .original PHImageManager.default().requestAVAsset(forVideo: self, options: options, resultHandler: {