Merging animation and video at runtime in objective c - ios

I wanna merge animation and dynamic video i.e video recording taken using camera and also the animation must be shown in the screen when the video is taken . How to do this i simply have no idea from where to start. I have seen video given in the below mentioned site :
http://www.raywenderlich.com/30200/avfoundation-tutorial-adding-overlays-and-animations-to-videos
but here in the above case animation is added at to an existing video but i want to add animation at runtime while the video is recorded and the video should have the animation recorded in it. Hope to get a lead so that i can get started to it..

Related

How to add trick play to custom iOS video player build on top of AVPlayer to play .m3u8 files?

Goal:
To add youtube like preview feature when user seeks manually using the player seek bar.
From what I understand so far is that I will have to add "I-Frame only playlist" to my stream to enable trick play but I am not able to figure out how I will be using this to show the preview view on the video player?
Other solutions I considered:
AVAssetImageGenerator: It does not work on streams. Explained here.
This says if my .m3u8 file contains "I-Frame only playlist", AVAssetImageGenerator will start returning the snapshot, but even if it does, generating thumbnails of a complete 1 hour video upfront is just not optimal.
AVPlayerItemVideoOutput This also seems like a very brut force way to approach the problem as I need thumbnails of almost complete video.
Current player implementation:
I have added AVPlayerLayer as a sublayer to my view controller's view and added custom controls on top of it.
I am thinking of using something like this https://github.com/pbs/iframe-playlist-generator to add the I-Frame playlist.
PS: I am new to this, so if I have made any wrong assumption, please let me know.
Also, any links or references to some reading material I can use to dive in deeper are appreciated. Thanks.

How to implement screen recording with audio in iOS programmatically?

I have a requirement where I have screen recording with audio as well. I have done some Google and got to know about how can we implement screen recording but I am wondering how to save audio while screen recording.
Is there any possibility that we can merge the video and audio and then save the final data on disk?
But I am not sure that will it be feasible because there will be difference in syncing with audio and video frames.
For screen recording I got a link of ScreenCaptureView which actually lets you save the screen recording.
On iOS9 there is ReplayKit it's a framework that can be used to make screen recording on video games. It seems that you can use also for common screen capture.
For lower platforms it's a kind of big deal, video screen capturing exists but is a private framework ( I guess IOSurface). There are some work arounds as in this project , basically it starts to grab sigle screenshot and append them into a movie file, without audio

Playing interactive videos with finger gestures in iOS

I am working on a kids ABC learning app which will be somewhat like this app.
Petting Zoo
The user can do these gestures... Swipe UP, DOWN, LEFT , RIGHT and TOUCH and each gesture has a small animation clip (approx duration 1 -3 secs each ) linked to it like the character jumping on Swipe UP, etc. There will also be an IDLE loopable movie which will be playing continuously when there is no input from user.
So I am trying to use videos in MP4 and M4V format for these gestures but the problem is that the videos are lagging just before playing. Means they dont play instantly upon doing a gesture but take a time of say micro second to load and play.
I am looking for output like the video above. You can see that the animations are so responsive and do not hang even for little time.
My developer once achieved such smooth output with the MP4 video clips but those clips didnt have audio embedded in them and then when he used videos with audio embedded in them, they were lagging again.
Can audio be the issue for lag here ? Or anything else you experts will like to suggest.
Please help guys. Yours inputs will be very valuable for me.
You can use - (void)replaceCurrentItemWithPlayerItem:(AVPlayerItem *)item of AVPlayer.
This methods helps you to load the new item to an existing AVPlayer.
Here is the important reference for playing multiple videos using single AVPlayer.

Capture Video Frames

I have written the code to capture video frames from here.
https://developer.apple.com/library/ios/qa/qa1702/_index.html.
In -(void)CaptureOutout() delegate function, I am displaying the image in UIimageView by simply adding this line of code [self.uiimage setImage:image]. All is working fine but
the problem is that I want to continuously capture the video frames, but it captures only one video frames and display's it. The other video frame is captured when I close and reopens the app. This means the CaptureOutout() function is called only once, but I want to get the continuous video frames and display them as a continuously on image view. Can anybody solve this problem?

iOS SDK AVFoundation ... How do I compose a video asset with a drawing asset

What I have achieved so far:
Using AVFoundation services, I have placed a video in a UIView that a user can play, pause, etc (using AVPlayer, AVPlayerItem, AVPlayerLayer, etc)
I have placed a UIView (with transparent/clear background color) on top of the view that is supposed to show the playing video. I have also handled UIKit touch events to draw lines based on user interaction.
Now when I play the video and touch the UIView which is overlayed on that view, I can see lines drawn on the playing video.
What I want to do:
After the user is done with the drawing (which he thinks is overlayed on the video), I want my app to compose the original video and what the user interaction (lines being drawn, removed, etc) and export the result as another video file.
Any help or sample code will be highly appreciated.
For compositing the content together, have a look at AVVideoCompositionCoreAnimationTool. It lets you add animations to a movie using CALayer objects.
For exporting, once you have your composition built and the CALayers rendering together, you can pass it straight to an AVAssetExportSession which will write it out to a video file.

Resources