Recording HD video with filtered screen preview

5 replies [Last post]
codeslaw
User offline. Last seen 9 years 29 weeks ago. Offline
Joined: 05/14/2012
Posts:

I understand that MovieWriter is fast enough to record 640x480 video straight to disk, but does that mean it will not handle the higher resolutions? Is currently possible to record 1080p video to disk, while displaying a filtered preview version on screen?

Thanks in advance, this library is great overall.

Brad Larson
Brad Larson's picture
User offline. Last seen 4 years 50 weeks ago. Offline
Joined: 05/14/2008
Posts:

Given that you're talking about 1080p video, I assume you're referring to doing this on the iPhone 4S and / or new iPad. In my benchmarks, those devices are fully capable of filtering, displaying, and recording 1080p video at 30 FPS. You can tweak the SimpleVideoFilter example to see this in action.

However, certain filters can slow this down because of how demanding they are in terms of processing resources. Dropping down to 720p might be required to apply certain filters at a solid 30 FPS framerate while recording video.

codeslaw
User offline. Last seen 9 years 29 weeks ago. Offline
Joined: 05/14/2012
Posts:

Awesome, thanks for the reply Brad.

Yes, sorry if I wasn't clear, definitely talking about the 4s+. I must have mis-read (or made a poor assumption based upon) the documentation where it states:


GPUImageMovieWriter is also fast enough to record video in realtime from an iPhone 4's camera at 640x480

Thanks again for the timely response!

badelappen
User offline. Last seen 9 years 20 weeks ago. Offline
Joined: 05/29/2012
Posts:

Since this thread is more or less about the question i have i didn't start a new one:

What would be the best way to show a live filtered preview but recording the unfiltered video at full resolution (just 720p in my case) for post processing?

I tried to add a second output AVCaptureMovieFileOutput but didn't receive any video on the AVCaptureVideoDataOutput. Is this the right way to go or am i on the wrong track anyway.

What i try to accomplish is to present a live preview of the filtered video but not use the GPUImageMovieWriter due to performance "issues" of not being able to record filtered 720p video on iPhone 4. I would then like to post process the video file as shown in the SimpleVideoFileFilter project.

Camera -> Filter -> Preview & Camera -> File at the same time

Do you have any hints for this?

Brad Larson
Brad Larson's picture
User offline. Last seen 4 years 50 weeks ago. Offline
Joined: 05/14/2008
Posts:

The most performant approach would probably be to set up a video camera input at 720p, add both the movie writer and your display filter to that, and then add the view as the target for the filter. With the filter, use -forceProcessingAtSizeRespectingAspectRatio: to cause it to only process at the resolution you want to display (for performance). This is effectively

Camera -> Filter -> View
|-> Writer

This way, you record the untouched 720p video while displaying the filtered video to the screen at a lower resolution. You should be able to approach 20 FPS with this on an iPhone 4, but I haven't benchmarked things lately since I optimized part of the pipeline.

badelappen
User offline. Last seen 9 years 20 weeks ago. Offline
Joined: 05/29/2012
Posts:

Thank you for the fast response. I will try this....seems like a great idea. I missed forceProcessingAtSizeRespectingAspectRatio before! ;-)

Syndicate content