Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-08-2010, 05:33 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 115
Question Create video of OpenGL

Anyone know if it's possible to create a video of an OpenGL layer and save it out to an .mp4 on the device?

I want to see if it's possible for the user to record a video of a playthrough and then upload it to YouTube from within a game. It looks as though it's possible to do the uploading part through the Objective-C version of the Google YouTube API... I'm just not sure if it's possible to actually create the video at runtime.

Any ideas / suggestions?
RegularKid is offline   Reply With Quote
Old 02-08-2010, 07:20 PM   #2 (permalink)
Registered Member
 
Mr Jack's Avatar
 
Join Date: Nov 2009
Location: Coventry, UK
Posts: 283
Default

Yes, it is possible, although it's not entirely easy. Most app footage is actually recorded from the simulator, rather than the device itself.

However, I did it for Alien Swing by using glReadPixels to store frames saving it to the documents, transferring the data to the Mac and then using OpenCV to convert the stills into video.

Although, actually it's a bit more complicated than that because glReadPixels is slow, and you rack up a lot of data quite quickly so if you're at all tight on memory you'll need to write to disk frequently which slows things down making it hard to play. Now, with Alien Swing I'm fortunate in that most of the screen doesn't change, so I could store which parts were changing and only capture these parts keeping the storage requirements down to sensible levels and mean I could keep running at 60fps with only the occasional slowdowns when it has to write out to disk while recording at 20 fps.

You can see some resulting footage here (cut together with iMovie) and here - obviously this method doesn't record sound so I had to patch that in afterwards, although I suspect it could be automated with a little more work.

I posted about this on my blog as well.

Now, if you wanted to do it on the device, you'd have to do the coding on the device and I don't know of any good libraries to do that so you might have to write your own. Otherwise I suppose you could upload data to a server and have the server process and pass it on to YouTube - although that would add server costs.
__________________


Visit Mr Jack Games for my blog and more about my games

Last edited by Mr Jack; 02-09-2010 at 11:31 AM. Reason: grammar fail
Mr Jack is offline   Reply With Quote
Old 02-09-2010, 11:27 AM   #3 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 115
Default

Quote:
Originally Posted by Mr Jack View Post
Yes, it is possible, although it's not entirely easy. Most app footage is actually recorded from the simulator, rather than the device itself.

However, I did it for Alien Swing by using glReadPixels to store frames saving it to the documents, transferring the data to the Mac and then using OpenCV to convert the stills into video.

Although, actually it's a bit more complicated than that because glReadPixels is slow, and you rack up a lot of data quite quickly so if you're at all tight on memory you'll need to write to disk frequently which slows things down making it hard to play. Now, with Alien Swing I'm fortunate in that most of the screen doesn't change, so I could store which parts were changing and only capture these parts keeping the storage requirements down to sensible levels and mean I could keep running at 60fps with only the occasional slowdowns when it has to write out to disk while recording at 20 fps.

You can see some resulting footage here (cut together with iMovie) and here - obviously this method doesn't record sound so I had to patch that in afterwards, although I suspect it could be automated with a little more work.

I posted about this on my blog as well.

Now, if you wanted to do it on the device, you'd have to do the coding on the device and I don't know of any good libraries to do that so you might have to right your own. Otherwise I suppose you could upload data to a server and have the server process and pass it on to YouTube - although that would add server costs.
Thanks for the info!

I hope this is possible ALL on the iPhone. I'd like this to be a feature of the app itself. So when the user does something they can record and upload a video to YouTube all from within the app itself.

I'm going to have to look into OpenCV a little.... any suggestions on some good tutorials on this subject ( ie. using OpenCV to create a video file )?
RegularKid is offline   Reply With Quote
Old 02-09-2010, 11:30 AM   #4 (permalink)
Registered Member
 
Mr Jack's Avatar
 
Join Date: Nov 2009
Location: Coventry, UK
Posts: 283
Default

Quote:
Originally Posted by RegularKid View Post
I'm going to have to look into OpenCV a little.... any suggestions on some good tutorials on this subject ( ie. using OpenCV to create a video file )?
I'm afraid OpenCV won't help you if you want it all on the iPhone because the iPhone port of OpenCV doesn't include any sensible video codecs. If you still want to investigate, just google for OpenCV and cvVideoWriter.
__________________


Visit Mr Jack Games for my blog and more about my games
Mr Jack is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,102
Threads: 38,878
Posts: 170,553
Top Poster: smasher (2,563)
Welcome to our newest member, michelneel42
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:56 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0