avassetwriter

AVAssetWriter How to write down-sampled/compressed m4a/mp3 files

筅森魡賤 提交于 2019-12-20 12:38:58
问题 I'm trying to take a local m4a or mp3 file and compress/down-sample this file (for the purposes of making a smaller file). Originally, I was using the AVAssetExportSession to export an AVAsset to a temp directory, but I didn't have any control over compression/down-sampling (you can only use presets, which of them, only .wav file formats support quality degradation). Then, following several examples here on SO, I tried using AVAssetReader/AVAssetWriter to preform this 'export'. I create my

Record and play audio with AVAssetWriter

时光毁灭记忆、已成空白 提交于 2019-12-20 05:32:05
问题 I have reduced this question quite a bit and am hoping for some help. Basically this class has two methods, one to start recording audio ( -recordMode ) and the other to play audio ( playMode ). I currently have this class in a project with a single view controller with two buttons that call the corresponding methods (rec, play). There are no other variables, the class is self-contained. However it will not play/rec anything and I cannot figure out why. When I try to play the file I get a

Record and play audio with AVAssetWriter

好久不见. 提交于 2019-12-20 05:31:15
问题 I have reduced this question quite a bit and am hoping for some help. Basically this class has two methods, one to start recording audio ( -recordMode ) and the other to play audio ( playMode ). I currently have this class in a project with a single view controller with two buttons that call the corresponding methods (rec, play). There are no other variables, the class is self-contained. However it will not play/rec anything and I cannot figure out why. When I try to play the file I get a

avassetwriter with greenscreen or chromakey

不羁的心 提交于 2019-12-19 11:38:05
问题 Is it possible to composite green screen images -- an animated actor against a green background, with a backdrop photo and make a video of that using avassetwriter on the iPhone. I have an application that creates a sequence of screenshots of an animated character against a green background. I'd like to composite those with a photograph from their library. Is there some way to composite the two into a video on the iPhone? Thanks, 回答1: Yes, there is. I just added a chroma key filter to my

Simulate AVLayerVideoGravityResizeAspectFill: crop and center video to mimic preview without losing sharpness

岁酱吖の 提交于 2019-12-19 10:47:38
问题 Based on this SO post, the code below rotates, centers, and crops a video captured live by the user. The capture session uses AVCaptureSessionPresetHigh for the preset value, and the preview layer uses AVLayerVideoGravityResizeAspectFill for video gravity. This preview is extremely sharp. The exported video, however, is not as sharp, ostensibly because scaling from the 1920x1080 resolution for the back camera on the 5S to 320x568 (target size for the exported video) introduces fuzziness from

AVCaptureSession only got video buffer

牧云@^-^@ 提交于 2019-12-19 04:06:04
问题 I am trying to capture the video and audio from iphone camera and output as a video file by avassetwriter, but the output video file only contains the first frame with audio. I have inspected AVCaptureSession delegate method, - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection { it seems only the delegate method only got one video sample buffer at the first, then receive audio sample

Change AVMetadataItem

风格不统一 提交于 2019-12-18 16:52:56
问题 I have some files, -m4a -mp4 -mp3 etc. I want to change these details AVMetadataItem AVMetadataCommonKeyArtwork AVMetadataCommonKeyArtist I can do with AVAssetExportSession , But I need to change the directory. Is there a way I can write directly on the file please? I found this program, but does not work :( NSError *error; AVAssetWriter *assetWrtr = [[AVAssetWriter alloc] initWithURL:[NSURL fileURLWithPath:self.path] fileType:AVFileTypeAppleM4A error:&error]; NSLog(@"%@",error); NSArray

AVAssetWriterInput and readyForMoreMediaData

时光总嘲笑我的痴心妄想 提交于 2019-12-18 16:34:19
问题 Is AVAssetWriterInput's readyForMoreMediaData updated in a background thread? If readyForMoreMediaData is NO, can I block in the main thread and wait until the value changes to YES? I'm using an AVAssetWriterInput by pushing data to it (i.e. without using requestMediaDataWhenReadyOnQueue) and I've set expectsMediaDataInRealTime, and 99.9% of the time I can just call appendSampleBuffer (or appendPixelBuffer) on it as fast as my app can generate frames. This works fine unless you put the device

Completion handler is not called on iOS7 GM

北慕城南 提交于 2019-12-18 12:14:32
问题 I'm using AVAssetWriter, and it is perfectly working on iOS6. The problem is, when I called finishWritingWithCompletionHandler , the completion handler is not called on iOS7 GM. I called markAsFinished , and even endSessionAtSourceTime before I call finishWritingWithCompletionHandler. It works fine on iOS6. And even more, on iOS7, it works some times, and then it doesn't work again. I don't know why, but it works if I call the method using alert view. So I tried performSelectorOnMainThread

how to record screen video as like Talking Tomcat application does in iphone?

馋奶兔 提交于 2019-12-18 11:43:05
问题 hey i m trying the record the gameplay of my game so that i can upload its video to youtube from device itself...m trying to do same thing as Talking tomcat app for iphone..recording the video then playing it ,etc... i m using glReadPixels() for reading framebuffer data and then writing it to video with the help of AVAssetWriter in AVFoundation framwork. But reading the data on each drawing decreases the FPS from around 30-35 to 2-3 only while using glReadPixels. i think Talking tomcat is