In my Application I need to capture a video and Put a watermark on that video. The watermark should be Text(Time and Notes). I saw a code using “QTKit” Frame work. However I read that the framework is not available for iPhone.
Thanks in Advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use
AVFoundation. I would suggest grabbing frames withAVCaptureVideoDataOutput, then overlaying the captured frame with the watermark image, and finally writing captured and processed frames to a file userAVAssetWriter.Search around stack overflow, there are a ton of fantastic examples detailing how to do each of these things I have mentioned. I haven’t seen any that give code examples for exactly the effect you would like, but you should be able to mix and match pretty easily.
EDIT:
Take a look at these links:
iPhone: AVCaptureSession capture output crashing (AVCaptureVideoDataOutput) – this post might be helpful just by nature of containing relevant code.
AVCaptureDataOutputwill return images asCMSampleBufferRefs.Convert them to
CGImageRefs using this code:From there you would convert to a UIImage,
Then use
to draw the frame to a context, draw a PNG of the watermark over it, and then add the processed images to your output video using
AVAssetWriter. I would suggest adding them in real time so you’re not filling up memory with tons of UIImages.How do I export UIImage array as a movie? – this post shows how to add the UIImages you have processed to a video for a given duration.
This should get you well on your way to watermarking your videos. Remember to practice good memory management, because leaking images that are coming in at 20-30fps is a great way to crash the app.