avfoundation

How to stop a video in AVPlayer?

纵然是瞬间 提交于 2019-12-29 04:34:07
问题 I am using this code to play video file using avplayer how do I stop it [videoView setHidden:NO]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path2 = [documentsDirectory stringByAppendingPathComponent:saveFileName]; NSURL *url1 = [[NSURL alloc] initFileURLWithPath: path2]; videoPlayer = [AVPlayer playerWithURL:url1] ; self.avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer

420YpCbCr8BiPlanarVideoRange To YUV420 ?/How to copy Y and Cbcr plane to Single plane?

Deadly 提交于 2019-12-29 03:33:28
问题 i have captured video using AVFoundation .i have set (video setting )and get in outputsamplebuffer kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange format. But i need YUV420 format for further processing . My doubt is 1.difference among 420YpCbCr8BiPlanarVideoRange,420YpCbCr8BiPlanarFULLRange, 420YpCbCr8PlanarFullRange,420YpCbCr8Planar and YUV420 ? 2.how can i convert 420YpCbCr8BiPlanarVideoRange to YUV420 ? 3. How to Convert YUV420 To 32BGRA ? 4) or some other Way to do this??? that is Any

Writing video + generated audio to AVAssetWriterInput, audio stuttering

时光毁灭记忆、已成空白 提交于 2019-12-29 03:31:50
问题 I'm generating a video from a Unity app on iOS. I'm using iVidCap, which uses AVFoundation to do this. That side is all working fine. Essentially the video is rendered by using a texture render target and passing the frames to an Obj-C plugin. Now I need to add audio to the video. The audio is going to be sound effects that occur at specific times and maybe some background sound. The files being used are actually assets internal to the Unity app. I could potentially write these to phone

Subtitles for AVPlayer/MPMoviePlayerController

三世轮回 提交于 2019-12-29 02:52:47
问题 I am using m3u8 video format for streaming the video and now I need to display subtitles for the same. I searched in Apple Documentation and found that I can achieve this by using the closedCaptionDisplayEnabled property of AVPlayer . I am interested to know what should be the format of subtitles? Will the .srt format do? Also can I achieve the same using MPMoviePlayerController ? Any help is appreciated. 回答1: Update 10/30/2018: It's worth checking this answer by an Apple engineer (Thanks to

How do I control AVAssetWriter to write at the correct FPS

那年仲夏 提交于 2019-12-28 15:26:48
问题 Let me see if I understood it correctly. At the present most advanced hardware, iOS allows me to record at the following fps: 30, 60, 120 and 240. But these fps behave differently. If I shoot at 30 or 60 fps, I expect the videos files created from shooting at these fps to play at 30 and 60 fps respectively. But if I shoot at 120 or 240 fps, I expect the video files creating from shooting at these fps to play at 30 fps, or I will not see the slow motion. A few questions: am I right? is there a

AVAudioSession .defaultToSpeaker changes mic input

徘徊边缘 提交于 2019-12-28 06:33:08
问题 I have an app taps the microphone and also play sounds depending on mic input(don't have to be simultaneously tho) This code below works. But one problem is the output plays on the small top speaker and not the bottom real loud speakers. I could solve this problem strangely by putting the 3 lines below just before the player starts , Then I can hear the sound on speakers. But then the microphone stops listening ! Even after the player stops playing. Basically mic does not like when it is

AVFoundation (AVPlayer) supported formats? No .vob or .mpg containers?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-28 06:00:27
问题 Using AVPlayer in a Mac app here to play random videos in fullscreen from a folder, but when I try to play .vob files or .mpg files I just get a black screen that lasts as long as the video lasts. Does AVFoundation not support playback from these containers? I figured that since they were playable with stock QuickTime Player they would also work with AVPlayer. 回答1: The AVURLAsset class has a static methods that you can query for supported video UTIs: + (NSArray *)audiovisualTypes On 10.9.1 it

Maintaining good scroll performance when using AVPlayer

冷暖自知 提交于 2019-12-28 03:18:07
问题 I'm working on an application where there is a collection view, and cells of the collection view can contain video. Right now I'm displaying the video using AVPlayer and AVPlayerLayer . Unfortunately, the scrolling performance is terrible. It seems like AVPlayer , AVPlayerItem , and AVPlayerLayer do a lot of their work on the main thread. They are constantly taking out locks, waiting on semaphores, etc. which is blocking the main thread and causing severe frame drops. Is there any way to tell

iOS: Get pixel-by-pixel data from camera

家住魔仙堡 提交于 2019-12-28 02:39:18
问题 I'm aware of AVFoundation and its capture support (not too familiar though). However, I don't see any readily-accessible API to get pixel-by-pixel data (RGB-per-pixel or similar). I do recall reading in the docs that this is possible, but I don't really see how. So: Can this be done? If so, how? Would I be getting raw image data, or data that's been JPEG-compressed? 回答1: AV Foundation can give you back the raw bytes for an image captured by either the video or still camera. You need to set up

How to Play Audio in Background Swift?

╄→гoц情女王★ 提交于 2019-12-27 10:40:39
问题 As you see I'm streaming an audio broadcast. But when I press the home button and exit the app streaming stops or I cannot hear. How can I continue streaming in background and listen it from lock screen? ViewController.Swift import UIKit import AVFoundation import MediaPlayer import GoogleMobileAds class ViewController: UIViewController, GADInterstitialDelegate { @IBOutlet weak var exitMapButton: UIButton! @IBOutlet weak var radarMap: UIWebView! var interstitial: GADInterstitial! func