0

We have a video we need to play at variable speeds for an iPhone app. But you're only able to change the video playback speed between .5X-2X or so. We needed more control than that.

Instead we broke our videos into a consecutive series of PNG's that we "flip through" on a timer.

The size of all these PNG's is making the app unwieldy to download over the wire. How can I best use this flipbook approach while being smart about respecting the iPhones own built-in compression routines? How can we avoid both space and memory hits from this approach, especially on older iOS devices?

Right now, the app is too large at almost 50 MB. It also takes a bit of time during startup to grab all the images and put it in an NSMutableArray.

rd108
  • 631
  • 2
  • 7
  • 14
  • 1
    Are the images bundled with the app? Why use PNG, will JPEG provide the quality you need? What are the actual problems, in detail, with your current solution (running out of memory)? – Wain Apr 26 '13 at 10:38
  • I converted the images to jpg's and the total filesize of all images went from about 28 MB to ~9 MB. I may be able to get more out of it with some compression. This method means I'm going to have to mess around with the other art in the app, since some things overlap (the transparency was there for a reason originally.) I used `(image=Image.open('file.png') non_transparent=Image.new('RGB',image.size,(0,0,0)) non_transparent.paste(image,(0,0),image))` using Python's PIL library to do the conversion after trying a few different methods. – rd108 May 03 '13 at 01:34

2 Answers2

0

I ended up using jpg's instead.

rd108
  • 631
  • 2
  • 7
  • 14
0

First off, please have a look at my blog post related to memory usage for images video-and-memory-usage-on-ios-devices. It actually will not matter if you use JPEG or PNG in terms of the amount of memory consumed by the decompressed images. What could end up making a difference is the app size and that is something that can be addressed by using h.264 instead of JPEG to compress the video frames. Anyway, if you only hold 1 or 2 frames in memory at the same time then you do not have to worry about crashing on the device. But, you could still get faster execution times by using a library built specifically for this purpose. Please have a look at my library linked in the above glob post if you want to reduce app size further and speed up loading time for each frame.

MoDJ
  • 4,309
  • 2
  • 30
  • 65
  • A new approach for better than PNG size with near lossless compression is described this SO answer. http://stackoverflow.com/a/40255615/763355 – MoDJ Oct 26 '16 at 21:59