avfoundation

Exporting time lapse with AVAssetExportSession results in black video

我怕爱的太早我们不能终老 提交于 2020-12-25 01:08:14
问题 I need to be able to merge videos taken with the time lapse function in the Camera app on iOS and export as a single video. However, even if I try to export a single, unchanged time lapse video to the Photo Library, it saves as a completely black video (with the correct duration). Here is the sample code I wrote to just export a single, unchanged video (most of which is adapted from a Ray Wenderlich tutorial): @IBAction func saveVideo(_ sender: UIBarButtonItem) { // 1 - Early exit if there's

Exporting time lapse with AVAssetExportSession results in black video

那年仲夏 提交于 2020-12-25 01:02:13
问题 I need to be able to merge videos taken with the time lapse function in the Camera app on iOS and export as a single video. However, even if I try to export a single, unchanged time lapse video to the Photo Library, it saves as a completely black video (with the correct duration). Here is the sample code I wrote to just export a single, unchanged video (most of which is adapted from a Ray Wenderlich tutorial): @IBAction func saveVideo(_ sender: UIBarButtonItem) { // 1 - Early exit if there's

Exporting time lapse with AVAssetExportSession results in black video

半腔热情 提交于 2020-12-25 01:01:17
问题 I need to be able to merge videos taken with the time lapse function in the Camera app on iOS and export as a single video. However, even if I try to export a single, unchanged time lapse video to the Photo Library, it saves as a completely black video (with the correct duration). Here is the sample code I wrote to just export a single, unchanged video (most of which is adapted from a Ray Wenderlich tutorial): @IBAction func saveVideo(_ sender: UIBarButtonItem) { // 1 - Early exit if there's

Swift -check if url asset has sound

我与影子孤独终老i 提交于 2020-12-15 07:17:10
问题 My screen cracked and my phone has no sound capabilities. I recorded a video using the camera. When I select the video url from didFinishPickingMediaWithInfo I tried to check if the video has sound or not but player.currentItem?.asset.tracks says the video does have sound (the device and recorded video definitely has no sound). func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { // ... guard let url =

What's the range of the TrueDepth camera?

好久不见. 提交于 2020-12-15 05:14:40
问题 What's the minimum and maximum distance that the front facing TrueDepth camera can detect? When detecting depth data, if the value returned was normalized to the range 0 to 1, I'd be able to convert it to a grayscale image pretty easily. However, since the values returned are distance in meters, I could easily get a value such as 2.5. Therefore, knowing the theoretical minimum and maximum could help me normalize the values into the range of 0 to 1. Update: Very inaccurate estimates using

Video with no audio crashes app on AVMutableComposition()

六月ゝ 毕业季﹏ 提交于 2020-12-12 06:07:16
问题 My app takes a video from a URL and allows you to add text to it, etc. It seems to crash when the video doesn't have any audio to begin with, can't seem to figure this out. This is what I have when the video is being composed: let asset = AVAsset(url: URL(string: self.videoURL)!) let mixComposition = AVMutableComposition() let videoTrack = mixComposition.addMutableTrack(withMediaType: .video, preferredTrackID: kCMPersistentTrackID_Invalid) try! videoTrack?.insertTimeRange(CMTimeRangeMake