Using FFMPEG to Encode Video for iPod, iPhone Streaming, and Flash 9

Read on to learn how to encode videos in to H264 for use by Flash 9, and also to stream to an iPhone in Safari, and be able to sync them onto an iPod.

First, you need FFMPEG compiled with H264 support. This is the thread I followed for Ubuntu:

Next, you can use this command to encode the video:

ffmpeg -y -i INPUT -vcodec libx264 -acodec libfaac -ab 128k -ac 2 -b 640k -threads 4 -flags +loop -cmp +chroma -partitions 0 -me epzs -subq 1 -trellis 0 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -maxrate 10M -bufsize 10M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 OUPUT

The -vcodec and -acodec options specify the h264 encoder with aac audio. -ab is audio bitrate, if you want to change that, and -b is the video bitrate. You can also specify a size with "-s widthxheight" for instance "-s 640x480". The -threads option gives you multithreading, I run a quad-core so I have it at 4. All the other flags are h264 options for higher quality. I don't understand many of them, but it looks nicer with them on.

If you want, you can add "-pass 1" to the command and run it, and it will generate a log file. Then run it again with "-pass 2" and it will use the log file for superior variable bitrate results. I highly suggest this.

Lastly, you should pack up the file for iPhone and iPod compatibility:

AtomicParsley OUTPUT -iPod-uuid 1200 --overWrite

Where OUTPUT is the file that you generated with FFMPEG.

You've successfully subscribed to SmartLogic Blog
Great! Next, complete checkout for full access to SmartLogic Blog
Welcome back! You've successfully signed in.
Unable to sign you in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Error! Billing info update failed.