UIVideoEditorController canEditVideoAtPath returns false on assets from library - iphone

on assets from library i.e: assets-library://asset/asset.mov?id=0399CB6D-D3D9-4F4C-82B9-AC93CCE2FB16&ext=mov
[UIVideoEditorController canEditVideoAtPath:videoPath] returns always NO
i see this error in the console:
<Warning>: Video assets-library://asset/asset.mov?id=0399CB6D-D3D9-4F4C-82B9-AC93CCE2FB16&ext=mov cannot be saved to the saved photos album: Error Domain=NSOSStatusErrorDomain Code=2 "This movie could not be played." UserInfo=0x6f7b90 {NSLocalizedDescription=This movie could not be played.}
help?

apparently there is no way to edit library assets with UIVideoEditController.
i ended up copying the file using AVAssetWriter to the app sandbox and then i was able to use UIVideoEditController.

I am able to write video tracks successfully.I am able to save that file to gallery as well.Video gets played with all the quality of original file .But not able to copy audio bufers and hence video gets played without sound.
But if I try to write audio track first and then video track then the writing fails for video buffers .That is BOOL appended = [assetWriterInput appendSampleBuffer:buffer]; fails by returning NO .
Buffers get appended while writing audio track.Then I cancel reader for audio track and start wrting reading video track.Appending the video buffers fails.For both writtes I am setting startSessionAtSourceTime:KCMTimeZero .
If I write only video buffers then video gets played without audio.
I want to make it possible to copy that .MOV file present inside gallery with all audio+video tracks inside it.
***Purpoose : Finally I want to edit the file copied using UIVideoEditorController.We can not directly edit file inside gallery.Hence I am first copying it inside sandbox and then editing it.

Related

How to play MP3 url in AVaudioPlayer without loading buffer

I'm trying to play in my app mp3 file from url ... But the problem is the file size is big 120 MB ... So i said why not making it load same as youtube since i heard we can control the buffer and not loading the full audio file to the player ... instead we can play small sizes same as youtube for example ... i search and tried to get a way or a code but i couldn't find anything.
So is it possible to play mp3 file using AVaudioPlayer immediately without loading the full audio file?
Not with AVAudioPlayer. Use AVPlayer instead.

Can I preload mp4 before play with MPMoviePlayerController?

Can I preload mp4 before play with MPMoviePlayerController ?
I have a local mp4 video. I fount it stop at the first frame little time. I'm sure it don't matter to network. Can it preload to memry before play with MPMoviePlayerController?
I'm assuming by "local" you mean "on a machine in the same room as you". And if that is true, then the short answer is: "Yes you can."
The way I would do this is to save (or cache) a copy of the movie file to your Documents or Cache directory on your iPhone and then when you create your MPMoviePlayerController object, you can refer to the file saved on the device (via a NSURL pointing to the file saved).
Take a look at Apple's documentation for MPMoviePlayerController's initWithContentURL: method (which I have linked for you).
If by "local" you mean the file is already on the device and it is inexplicably freezing, then there is likely another problem with the mp4 you are trying to play.

Recording video with option of manipulating the pixels before writing to file

I know that I can access raw video images from the iPhone's camera with AVCaptureVideoDataOutput. I also know that I can record video to a file with AVCaptureMovieFileOutput. But how can I first access the raw video images, manipulate them and then write the manipulated ones into the video file? I've already seen apps in the app store, which do this, so it must be possible.
Ok, I now know, that it's done with AVAssetWriter.

record and play the same file

I am trying to record the audio using AVAudioRecorder. My problem is i want to play the file while it is being recorded. Is there any way i can do this? I have set the category to PlayAndRecord. I have created the file for recording.
I have tried to initialize both the recorder and the player for the URL and tried to play the file after the record function. But it seems that only one chunk of the file gets played.
I seriously doubt you can do this with AVAudioRecorder and AVAudioPlayer convenience classes.
The AVAudioPlayer assumes that the file it plays is static and complete. For example, it has no method to dynamically update the track length. It reads the track length once at startup and that is why only the initial chunk of the file gets played. Any modifications to the file made after the AVAudioPlayer instances opens the file are ignored.
You'll need to set up a custom audio queue if you want to get fancy.
As an aside, how do you plan on getting around feedback problem of caused by recording what you are playing? You have nothing but a shrieking squeal in very short order.

Play audio and video at a same time in iPhone application

Is it possible to play audio and video file at a same time? I want to play different audio file and video file at a same time and also want control for both, so is it possible?
Sorry, not that I know of. The movie view automatically stops all audio files and takes up the whole screen, so you are forced to listen to the audio for the video.
If the audio is part of the video file, yes.
If it's an MP3 file or some other external type how are you planning on playing it? The phone might allow this to happen depending on what you're up too.
You might be in luck soon though...
Another helpful link is here.