Implementing an audio/video iOS application means learning which tools are already available and which ones you should learn to use to best get the job done. This document describes utility audio and video software you will need and provides ready to use binaries for MacOSX. You do not need to go through all the pain of finding, downloading, and building these tools from scratch. All of the utilities described below are already included in the AVAnimator utils download. Download the utils archive and save the file into your
- AVAnimatorUtils.tgz (5.9 megs)
Extract the archive with the following command, and then take a look at
AVAnimatorUtils/README.txt for instruction on how to set your PATH.
$ cd ~/bin $ tar -xzf AVAnimatorUtils.tgz
AVAnimator makes it easy to playback audio and video content in your iOS app, but you the developer still need to properly prepare content and incorporate the files into your iOS application. The integration process is made easier by using the right tool for the job. Sometimes Quicktime Pro does everything you need. But, you may run into situations where integrating video means doing the same series of complex import and compression steps over and over again. It can be very useful to use the command line to automate steps in the video production process, so that an import can be executed via a script instead of a of manual series of steps in a GUI application.
No tool is perfect for every job, but you will be able to solve all your audio and video production problems by learning how to use available tools in combination with each other. A useful function in one tool can be executed and then the results can be exported and then imported into another tool to finish the job. With that in mind it is now time to introduce a new command line tool for MaxOSX named
mvidmoviemaker. The binary is already included in the utils download and the full source can be found on github at MvidMovieMaker.
mvidmoviemakerutility is useful for:
- Converting a Quicktime Animation video into a Maxvid video
- Converting a series of images into a Maxvid video
- Converting a Maxvid video into a Quicktime video
- Cropping, Resizing, or Changing the bit depth of a video
The full manual for
mvidmoviemaker is available in PDF format:
- MvidMovieMakerManual.pdf (107 Kb)
- Convert Quicktime to Maxvid
- Convert to Animation Codec
- APNG utilities
- ffmpeg + x264
- H.264 + alpha channel script
Convert Quicktime to MaxvidThe
mvidmoviemakerutility should be used to convert a Quicktime movie that contains Animation codec data into a Maxvid file. A significant amount of work has been put into
mvidmoviemaker, and it should be able to import any type of Quicktime movie that makes use of the Animation codec. Quicktime movies created by other programs like After Effects should import correctly as long as the lossless Animation codec is used. Note that attempting to import video encoded with any other codec is not supported and will not be supported. The QTKit and ICMCompressionSession related Quicktime APIs are simply too buggy and cannot be counted on to decode and encode correctly in all cases (believe me I tried). In addition, one should not be using video in the production process that has already been encoded into a delivery codec. Video should be processed with a lossless codec and then only be compresses with a delivery codec at the end of the process.
$ mvidmoviemaker Superwalk_ANI.mov Superwalk.mvid wrote Superwalk.mvid
Convert to Animation CodecNote that this is normally a bad idea, but there may be times when you need to import from an existing Quicktime file in a format other than the Animation codec. Perhaps a video exists only in an old Sorenson codec format. In a case like this, one cannot convert the Quicktime movie to Maxvid directly with
mvidmoviemaker. The solution to this problem is to make use of the qt_tools package to convert the Quicktime movie to a second Quicktime movie that uses the Animation codec. One can do this conversion by hand with Quicktime Pro, but it is also easy to do with the
qt_toolsfrom the command line.
qtexportani script invokes the command line converter with the proper arguments
so that a movie file with a single Animation codec track is generated.
A typical usage might be to convert a Quicktime PNG movie to the Animation codec,
and then convert the .mov to the iOS optimized .mvid format, like so:
$ qtexportani Superwalk_PNG.mov Superwalk_ANI.mov wrote Superwalk_ANI.mov $ mvidmoviemaker Superwalk_ANI.mov Superwalk.mvid wrote Superwalk.mvid
APNG utilities : Advanced Lossless Compression
Working with APNG files can sometimes prove tricky, because the format is rather new and poorly supported in many tools. Some of the most useful utilities are:
ffmpeg + x264 : Best H.264 encoder around
Included in the utility download is a binary of ffmpeg compiled with x264 support that can encode a H.264 movie for any iOS device. Also included is a handy script that accepts a Quicktime file as input and writes a M4V video file (.m4v contains H.264 video). The script can be run like this:
$ ext_ffmpeg_encode_crf.sh IN.mov OUT.m4v CRF
The command accepts an optional CRF value to indicate the quality of the lossy encoding in the range 1 to 50. The default CRF is 23. The useful encoding range is typically something in the 20 to 45 range, you will need to experiment to find the best quality vs size tradeoff for your specific video content.
H.264 + alpha channel script
Included in the utility download is a very useful script that will automatically split a Maxvid file (must be 32BPP with an alpha channel) into RGB and alpha components and then encode as a pair of H.264 videos. This script splits video components with
mvidmoviemaker and then exports Quicktime files to ffmpeg to do the H.264 encoding. A number of files are created during this process, so each is saved into a subdirectory named after the CRF values passed in. The named subdirectory makes it possible to run the encoding logic several times with different CRF values and examine the different results in different subdirectories. The H.264 + alpha channel split logic on the desktop combined with decoder logic that will join the results back together on the client is very exciting.
$ ext_ffmpeg_splitalpha_encode_crf.sh IN.mvid CRF