avfoundation

Subtitles won't display if closed caption is off in system settings

一世执手 提交于 2021-02-20 00:41:29
问题 I am trying to get subtitles to display regardless of what the device has set under the accessibilities. Currently, if the device is set to English with closed captioning enabled in settings, English subtitles will play, and if the device is set to Spanish, Spanish subtitles will play. I would like subtitles to play regardless of whether or not closed captioning is on. I attempted to add this code from apple's documentation, but it did not help. It seems to be reading the options fine,

How to resume audio playing of other apps after dismissing AVPlayerViewController?

放肆的年华 提交于 2021-02-18 18:09:13
问题 I use AVPlayerViewController to play short videos in my app. If there is an app playing audio in background before user plays a video in my app, I want the background audio playing of the other app to resume after my video player is dismissed. I currently use AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation) to do that. Even though Apple's Music app and Podcasts app do resume playing after I call AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation) —won't resume

How to resume audio playing of other apps after dismissing AVPlayerViewController?

馋奶兔 提交于 2021-02-18 18:06:08
问题 I use AVPlayerViewController to play short videos in my app. If there is an app playing audio in background before user plays a video in my app, I want the background audio playing of the other app to resume after my video player is dismissed. I currently use AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation) to do that. Even though Apple's Music app and Podcasts app do resume playing after I call AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation) —won't resume

Can't able to get Video Tracks from AVURLAsset for HLS videos(.m3u8 format) for AVPlayer?

a 夏天 提交于 2021-02-18 17:40:08
问题 I am developing a custom video player to stream HLS videos from server. I can successfully play HLS videos using AVPlayerItem and AVPlayer. After that I want to add subtitle track and audio tracks for my video player. So I used AVMutableComposition to do so. So now the issue is when I am creating AVURLAsset for HLS Videos, I can't able to get video tracks from AVURLAsset. It is giving me always 0 tracks. I tried "loadValuesAsynchronously" of AVURLAsset and I tried adding KVO for "tracks" of

Is it possible to merge two video files to one file, one screen in iOS?

∥☆過路亽.° 提交于 2021-02-18 12:11:42
问题 I'm new to video programming. I'm trying to exercise it but I'm having trouble, which merges two video files to one. The merge I mean is as follows.. I have first video like this Second video also like this I want them to merge like this I didn't want to use 2 video players because I want to send the merged video file to someone. I searched all day to solve this, but I could't find how to. I wrote code referencing this link but it shows first video only, not merged. My Code: NSURL *firstURL =

Recording gapless audio with AVAssetWriter

陌路散爱 提交于 2021-02-18 02:50:15
问题 I'm trying to record segments of audio and recombine them without producing a gap in audio. The eventual goal is to also have video, but I've found that audio itself creates gaps when combined with ffmpeg -f concat -i list.txt -c copy out.mp4 If I put the audio in an HLS playlist, there are also gaps, so I don't think this is unique to ffmpeg. The idea is that samples come in continuously, and my controller routes samples to the proper AVAssetWriter . How do I eliminate gaps in audio? import

Very slow framerate with AVFoundation and Metal in MacOS

送分小仙女□ 提交于 2021-02-17 05:56:47
问题 I'm trying to adapt Apple's AVCamFilter sample to MacOS. The filtering appears to work, but rendering the processed image through Metal gives me a framerate of several seconds per frame. I've tried different approaches, but have been stuck for a long time. This is the project AVCamFilterMacOS - Can anyone with better knowledge of AVFoundation with Metal tell me what's wrong? I've been reading the documentation and practicing getting the unprocessed image to display, as well as rendering other

Very slow framerate with AVFoundation and Metal in MacOS

眉间皱痕 提交于 2021-02-17 05:56:15
问题 I'm trying to adapt Apple's AVCamFilter sample to MacOS. The filtering appears to work, but rendering the processed image through Metal gives me a framerate of several seconds per frame. I've tried different approaches, but have been stuck for a long time. This is the project AVCamFilterMacOS - Can anyone with better knowledge of AVFoundation with Metal tell me what's wrong? I've been reading the documentation and practicing getting the unprocessed image to display, as well as rendering other

Referencing `self` from within a VTCompressionOutputCallback [duplicate]

。_饼干妹妹 提交于 2021-02-16 21:07:30
问题 This question already has answers here : How to use instance method as callback for function which takes only func or literal closure (2 answers) Closed 1 year ago . I'm currently trying to use VideoToolbox to encode video data from an AVCaptureVideoDataOutput , but I'm having an issue referencing self from within the VTCompressionOutputCallback . My code is as follows: ... var sessionRef: VTCompressionSession? let outputCallback: VTCompressionOutputCallback = { _, _, status, _, sampleBuffer

Transform wrong when using both AVComposition and AVVideoComposition

非 Y 不嫁゛ 提交于 2021-02-11 07:39:18
问题 I am creating an AVMutableComposition . I need the asset to be flipped horizontally, so I am setting the transform of the composition track like this: compositionTrack.preferredTransform = assetTrack.preferredTransform.scaledBy(x: -1, y: 1) If I export this (I use AVAssetPreset960x640 as my preset), this works as expected. However, I also need to add an AVMutableVideoComposition overlay to be rendered with this copmosition. This overlay shouldn't be flipped horizontally. I specify this like