Fullscreen GIF animation in Cocos2D - ios

I have an animation (images serie) to do on the entire screen of the iPhone (retina and no retina)
Normally I do that with zwoptex using a similary technique to this http://gamedev.sugartin.info/2012/05/09/69/
But this time the size of images doesn't allow that.
I have also a 5sec-length video of the serie.
Is there any other solution?

any kind of images, that you want to display, must be placed in memory first of all. so, you cannot play animation, if you have too many frames to be loaded to memory. if you want to play such big animation, you can try to create video file and play it over your openGL view

Related

Export portrait video to square but with scaleAspectFit ratio

In my app I allow users to record videos in portrait mode. I use that within the app and that is fine. However, I'm implementing a feature to share the videos on Instagram, where videos must be square.
Cropping the video to square, lets say the center part, is an option, however as the user doesn't consider this when taking the video, it usually turns out bad.
Therefore, I'd like to export the video square, but with an aspect fit ratio and with two bars left and right. Optimally, is there any way to define the colors of the background (either by code or by UIImage).
The closest thing I was able to find is this, however I can't make much use of it as I'm unclear on how to set up the transformation.
Example (red box just to mark the image bounds):
Beside trying to add black bars and re-render the video you can use the cameraOverlayView property of UIImagePickerController.
So you can create a view that has 2 black bars in OR you can create a view that has a square frame over the camera view so they know to frame it in there because it will share to instagram.

AVMutableVideoComposition image overlay low quality

I am creating a feature where a user can record a video of themselves, and superimposed on this video is a view that displays an image and some text. When they are done recording, I am using AVFoundation's composition classes to composite the video and the view (as an image) into one video file, and output this in the next scene in a custom video player. The problem is that while the view's resolution is crystal clear in the record scene, after the composition (and after the AVExportSession completes) the resulting video's overlayed view quality is not clsoe to the actual view quality. I am converting the view to an image, and then setting the contents of an overlay layer as this image's CGImage, which, as I have checked, still has the same quality as the original view. The problem occurs when I apply the composition, and the image becomes blurry. Does anyone have any idea why this might be happening?
If you need to see the code, please feel free to ask! I can also provide screenshots.
Thank you!
It could happen when initiating your UIImage, iOS automatically pick #2x or #3x image source for you corresponding to your device.
Let say you get image size using size property like image.size, it gives you #1x size, and you might reduce your image size from #2x or #3x to #1x, you get a bad quality image output, because JPEG or PNG resize algorithms.

How to set up the video size so that it works on all ios devices without black bars

I'm just wondering what size the video should be so that there won't be black bars on iphone 4/5 or ipad? Any suggestion will be appreciated. Thanks!
Since the iPhone 4, iPhone 5, and iPad all have different screen aspect ratios it's impossible to have a single size of video which in full-screen mode won't have black bars on some devices.
Instead, you can use the scalingMode property of MPMoviePlayerController to keep your video zoomed in to fit the screen (assuming that's what you're using to play back your video - similar analogues exist in other video playback classes). You probably want to use the MPMovieScalingModeAspectFill scaling mode, which will fill the video to fit the screen without distorting it.

iPad retina screen recording

Two parts:
Correct me if I'm wrong, but there isn't a standard video file format that holds 2048 x 1536 frames? (i.e. recording the full resolution of the iPad retina is impossible?)
My app uses a glReadPixels call to record the screen, and appends the pixel buffers to an AVAssetWriterInputPixelBufferAdaptor. If the video needs to be resized to export, what's the best way to do this? I'm trying right now with AVMutableVideoCompositionLayerInstructions and CGAffineTransforms, but it's not working. Any ideas?
Thanks
Sam
Yes , it is possible. My app is also taking big frame video .
Don't use glReadpixels it causes a lot of delay especially if you record big frames as 2048 x 1536
Since iOS 5.0 you can use a faster way using texture cash (link)

Retina Display images looks fuzzy and blurred. No Reason why?

I am a Cocos2d game developer. I am developing a game using retina display images.
I have created texture files with and without HD suffix using zwoptex.
I have added those zwoptex plist texture files in app-delegate like [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:#"Background.plist"];
I have enabled the retina display to YES [director enableRetinaDisplay:YES];.
I have used the png files from the plist wherever i want using ccsprite *background = [CCSprite spriteWithSpriteFrameName:#"sample.png"];.
All those png files which I have included are high resolution images with both sizes 960*640 and 480 * 320. But in no reason the images look blurry and fuzzy when i run the game in simulator or iPhone. Anyone please help me to solve this issue …..
(The following image was posted as an example in a comment.)
cocos2d applies anti-aliasing to sprites by default. You need to turn that off:
[background.texture setAliasTexParameters];
hope this helps.
The screenshot you posted (I took the liberty of adding it to your question) shows that it was taken from the iPhone Simulator and not the iPhone (Retina) Simulator. Therefore it will not use the HD images.
With the iPhone Simulator running go to the Hardware -> Device menu and select iPhone (Retina) as the device. Then restart your app.
Note also that the iPhone Simulator will only render the game with a color depth of 16-Bit, regardless of settings in cocos2d or your Mac. The iOS Simulator renderer is limited to 16-Bit rendering for performance reasons (it only uses software rendering, no hardware acceleration). Only by looking at the game on an actual device can you make judgement calls about image quality.
To test whether the game is actually loading the HD assets or for some reason just loads the SD images, try running it without the SD images. If the game tries to load the SD images it will cause an error. If not, it is loading the HD images and the "blur issue" has a different cause. You could also log which files are loaded by adding a NSLog statement to the CCFileUtil class method fullPathFromRelativePath which performs the file name changes to load -hd images whenever possible.
You'll find that even miniscule amount of scaling or rotation applied to a sprite may have it look blurred, so check if you happen to do that. Any change in blend modes (using ccBlendFunc) could also cause blurred images. Also check that your images are fully opaque (opacity == 255).

Resources