I know ffMpeg has been ported to iPhone before. I only need a very limited implementation.
I don't even want all the codecs - just the MP4 implementation - MPEG-4/H.264 video with AAC and Apple Lossless audio.
Note, if must handle video-only and audio-only encoding, as well as video/audio encoding.
You will write a wrapper class like this:
Mp4Encoder
- (id)init;
- (void)setVideoCodec:(NSString *)codec; // MPEG-4 or H.264
- (void)setAudioCodec:(NSString *)codec; // AAC or Apple Lossless
- (bool)start:(NSString *)path videoWidth:(long)width videoHeight:(long)height videoFramerate:(double)framerate audioSampleRate:(long)sampleRate audioChannelCount:(short)channel;
- (bool)addVideoFrame:(BYTE *)buffer startTime:(double)start duration:(double)duration;
- (bool)addAudio:(BYTE *)buffer startTime:(double)start;
- (bool)end;
Note, the input video will always be 32-bit. Audio will always be 16-bit.
You will write a demo app. It doesn't need to get the data from live input. Instead, generate the video frames randomly (for example, fill the video frame with the same color, which changes from frame to frame) and read a WAV/PCM file from bundle.
The demo app must has the following:
video resolution (width and height)
video framerate
audio sample rate
audio channel
video codec
audio codec
encoding file name. (the file will be written to the app document directory)
The demo app must have a start button, which generate the video frame and read the WAV file to send to the encoder. Upon completion, it will use the standard iPhone player UI to play the encoded video.
## Deliverables
Please test it on both simulator and device, so you should have your own iPhone developer certificate.
When you send binary for testing, use Ad Hoc signing.