Import Any Video to iPhone

From Zanecorpwiki

Jump to: navigation, search

You must have recent versions of ffmpeg and various necessary libraries. With earlier versions, one would sometimes get files that failed to play on the iPhone (even though they could be played by any regular application). The iPhone's limited processing capabilities put hard limits on the types of files that can be played, and Apple has added their own (probably somewhat arbitrary) restrictions as well. The file can't just be small enough and simple enough, it has to be just right.

With the following bash script, you should be good to go:

#!/bin/bash

i=$1
THREADS=`cat /proc/cpuinfo | grep processor | wc -l`
ffmpeg -y -i $i -an -v 1 -threads $THREADS -vcodec libx264 -b 500k -bt 175k -refs 1 -loop 1 -deblockalpha 0 -deblockbeta 0 /
    -parti4x4 1 -partp8x8 1 -me full -subq 1 -me_range 21 -chroma 1 -slice 2 -bf 0 -level 30 -g 300 -keyint_min 30 -sc_threshold 40 /
    -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.7 -qmax 51 -qdiff 4 -i_qfactor 0.71428572 -maxrate 768k -bufsize 2M -cmp 1 -s 480x320 /
    -f mp4 -pass 1 /dev/null
ffmpeg -y -i $i -v 1 -threads $THREADS -vcodec libx264 -b 500k -bt 175k -refs 1 -loop 1 -deblockalpha 0 -deblockbeta 0 -parti4x4 1 /
    -partp8x8 1 -me full -subq 6 -me_range 21 -chroma 1 -slice 2 -bf 0 -level 30 -g 300 -keyint_min 30 -sc_threshold 40 /
    -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.7 -qmax 51 -qdiff 4 -i_qfactor 0.71428572 -maxrate 768k -bufsize 2M -cmp 1 -s 480x320 /
    -acodec libfaac -ab 96 -ar 48000 -ac 2 -f mp4 -pass 2 ${i:0:$((${#i} - 3))}mp4

You can throw a for loop in their for batch processing.

You may also be interested in transcoding in general.

Personal tools