You can now make stop frame animations with ffmpeg native on the phone
See test10frame.m4v above (drunknbass of #iphone provided the frames to test this!)
So, assume you have a bunch of pictures that you have taken on your
iPhone, in some sort of sequence:
iPhone:~/Media root# ls -C1 /var/mobile/Media/DCIM/100APPLE/IMG_000*.JPG
/var/mobile/Media/DCIM/100APPLE/IMG_0001.JPG
/var/mobile/Media/DCIM/100APPLE/IMG_0002.JPG
/var/mobile/Media/DCIM/100APPLE/IMG_0003.JPG
/var/mobile/Media/DCIM/100APPLE/IMG_0004.JPG
/var/mobile/Media/DCIM/100APPLE/IMG_0005.JPG
You can use this simple one liner:
iPhone:~/Media root# ../ffmpeg -f image2 -i \
/var/mobile/Media/DCIM/100APPLE/IMG_000%d.JPG -s 320x240 -f mp4 ./test.m4v
Input #0, image2, from '/var/mobile/Media/DCIM/100APPLE/IMG_000%d.JPG':
Duration: 00:00:00.3, start: 0.000000, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj420p, 1600x1200, 25.00 fps(r)
PIX_FMT_YUV420P will be used as an intermediate format for rescaling
Output #0, mp4, to './test.m4v':
Stream #0.0: Video: mpeg4, yuv420p, 320x240, q=2-31, 200 kb/s, 25.00 fps(c)
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 8 fps= 1 q=9.4 Lsize= 105kB time=0.3 bitrate=2692.2kbits/s
video:104kB audio:0kB global headers:0kB muxing overhead 0.684381%
Then you can play it on the phone:
iPhone:~/Media root# ../bin/playaudio test.m4v
TADA Instant movie...! So I wonder... this could be useful I guess :))
The following exercise is left to the reader, you will need erica's pic snap tools for this:
iPhone:~/Media root# cat snapper.sh
#!/bin/bash
i=0
max=10
while [ "$i" -lt "$max" ]
do
../bin/picSnap $i.jpg
echo -n "$i "
let "i += 1"
done
iPhone:~/Media root# ./snapper.sh
0 1 2 3 4 5 6 7 8 9
iPhone:~/Media root# ../ffmpeg -f image2 -i %d.jpg -s 320x240 -f mp4 ./test.m4v
Added destructions for Erica that DIVX using the native ffmpeg above on the iPhone is ok
(slow but seems to work...):
iPhone:~ root# wget http://www.jhepple.com/support/SampleMovies/AVI_DivX.avi
--20:20:12-- http://www.jhepple.com/support/SampleMovies/AVI_DivX.avi
20:20:32 (486.16 KB/s) - `AVI_DivX.avi' saved [9431040/9431040]
iPhone:~ root# ./ffmpeg -i AVI_DivX.avi -f mp4 test.mp4
FFmpeg version SVN-r10168, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --cross-compile --cross-prefix=arm-apple-darwin- --arch=arm
--enable-libamr-nb --enable-libamr-wb --enable-libmp3lame --enable-static
--disable-shared --enable-libfaac --enable-libfaad --enable-libx264 --enable-gpl
libavutil version: 49.5.0
libavcodec version: 51.41.0
libavformat version: 51.12.2
built on Feb 27 2008 17:31:14, gcc: 4.0.1 (Apple Computer, Inc. build 5449)
(LLVM build 2.0-svn-iphone-dev-0.3-svn)
[mpeg4 @ 0x5810c8]frame skip 8
Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001)
Input #0, avi, from 'AVI_DivX.avi':
Duration: 00:00:33.9, start: 0.000000, bitrate: 2225 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 352x240, 29.97 fps(r)
Stream #0.1: Audio: pcm_s16le, 44100 Hz, stereo, 1411 kb/s
Output #0, mp4, to 'test.mp4':
Stream #0.0: Video: mpeg4, yuv420p, 352x240, q=2-31, 200 kb/s, 29.97 fps(c)
Stream #0.1: Audio: libfaac, 44100 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
[mpeg4 @ 0x5810c8]frame skip 8
frame= 910 fps= 7 q=20.1 Lsize= 1121kB time=30.0 bitrate= 306.5kbits/s
video:859kB audio:234kB global headers:0kB muxing overhead 2.556080%
Received signal 2: terminating.
Now we get to use Erica's PLAYAUDIO (which does video... it would not work on the AVI,
but now it has been through ffmpeg) we are all set:
iPhone:~ root# ./bin/playaudio ./test.mp4
----
AVController_CurrentItemWillChange
----
AVController_CurrentItemDidChange
SUCCESS!
Added iTubby :) simple one liner to fetch flv from youtube, and drop it on your phone
Extract itubby to /var/root/itubby, this one has the correct wget, a copy of sed,
and a trimmed down ffmpeg with just the faac stuff we need to make this work:
iPhone:~/itubby root# ./itubby http://www.youtube.com/watch?v=CPUc5PbEh3E test
21:13:59 URL:http://www.youtube.com/watch?v=CPUc5PbEh3E [113760/113760] -> "-" [1]
FFmpeg version SVN-r10168, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --cross-compile --cross-prefix=arm-apple-darwin- --arch=arm
--enable-static --disable-shared --enable-libfaac --enable-libfaad --enable-gpl
libavutil version: 49.5.0
libavcodec version: 51.41.0
libavformat version: 51.12.2
built on Feb 26 2008 11:35:35, gcc: 4.0.1 (Apple Computer, Inc. build 5449)
(LLVM build 2.0-svn-iphone-dev-0.3-svn)
Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from 'pipe:':
Duration: 00:02:36.4, start: 0.000000, bitrate: 64 kb/s
Stream #0.0: Video: flv, yuv420p, 320x262, 25.00 fps(r)
Stream #0.1: Audio: mp3, 22050 Hz, mono, 64 kb/s
Output #0, mp4, to 'test.mp4':
Stream #0.0: Video: mpeg4, yuv420p, 320x262, q=2-31, 200 kb/s, 25.00 fps(c)
Stream #0.1: Audio: libfaac, 22050 Hz, mono, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
frame= 707 fps= 9 q=23.7 Lsize= 1013kB time=28.1 bitrate= 294.7kbits/s
video:871kB audio:130kB global headers:0kB muxing overhead 1.154106%
Received signal 2: terminating.
iPhone:~/itubby root# ../bin/playaudio test.mp4
----
AVController_CurrentItemWillChange
Updates to allow shockwave to mp4
Grab ffmpeg.new.gz, this one can now deal with youtube video and convert to mp4. It also has a
bunch of other stuff in it:
iPhone:~ root# ./ffmpeg -vcodec mpeg4 -i test.flv /tmp/video.mp4
FFmpeg version SVN-r10168, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --cross-compile --cross-prefix=arm-apple-darwin- --arch=arm
--enable-libamr-nb --enable-libamr-wb --enable-libmp3lame --enable-static
--disable-shared --enable-libfaac --enable-libfaad --enable-libx264 --enable-gpl
libavutil version: 49.5.0
libavcodec version: 51.41.0
libavformat version: 51.12.2
built on Feb 26 2008 18:52:29, gcc: 4.0.1 (Apple Computer, Inc. build 5449)
(LLVM build 2.0-svn-iphone-dev-0.3-svn)
Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.92 (359/12)
Input #0, flv, from 'test.flv':
Duration: 00:01:49.8, start: 0.000000, bitrate: 48 kb/s
Stream #0.0: Video: flv, yuv420p, 320x240, 29.92 fps(r)
Stream #0.1: Audio: mp3, 22050 Hz, mono, 48 kb/s
File '/tmp/video.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to '/tmp/video.mp4':
Stream #0.0: Video: mpeg4, yuv420p, 320x240, q=2-31, 200 kb/s, 29.92 fps(c)
Stream #0.1: Audio: libfaac, 22050 Hz, mono, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 3289 fps= 15 q=2.0 Lsize= 3381kB time=109.7 bitrate= 252.5kbits/s
video:2827kB audio:508kB global headers:0kB muxing overhead 1.388127%
Then you can use playaudio from here: http://ericasadun.com/ftp/EricaUtilities/
iPhone:~/bin root# ./playaudio /tmp/video.mp4
----
AVController_CurrentItemWillChange
For Erica
We can now convert amrs to mp3, or wav:
# ./ffmpeg -i Library/Recordings/2007-09-16_14:11:09.amr test.mp3
Nice!!!
FFmpeg version SVN-r10168, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --cross-compile --cross-prefix=arm-apple-darwin- --arch=arm
--enable-libamr-nb --enable-libamr-wb --enable-libmp3lame --enable-static
--disable-shared
libavutil version: 49.5.0
libavcodec version: 51.41.0
libavformat version: 51.12.2
built on Sep 16 2007 14:37:29, gcc: 4.0.1 (Apple Computer, Inc. build 5449)(LLVM build 2.0-svn-iphone-dev-0.3-svn)
Input #0, amr, from 'Library/Recordings/2007-09-16_14:11:09.amr':
Duration: N/A, bitrate: N/A
Stream #0.0: Audio: libamr_nb, 8000 Hz, mono
File 'test.mp3' already exists. Overwrite ? [y/N] y
Output #0, mp3, to 'test.mp3':
Stream #0.0: Audio: libmp3lame, 8000 Hz, mono, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 40kB time=5.1 bitrate= 64.1kbits/s
video:0kB audio:40kB global headers:0kB muxing overhead 0.078247%
Fixed!
# ./ffmpeg -version
FFmpeg version SVN-r10168, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --cross-compile --cross-prefix=arm-apple-darwin- --arch=arm
libavutil version: 49.5.0
libavcodec version: 51.41.0
libavformat version: 51.12.2
built on Sep 16 2007 12:24:03, gcc: 4.0.1 (Apple Computer, Inc. build 5449)(LLVM build 2.0-svn-iphone-dev-0.3-svn)
ffmpeg SVN-r10168
libavutil 3212544
libavcodec 3352832
libavformat 3345410
ffmpeg
On SVN "twig" of llvm and 118 of iphonebin utils
[imac:~/toolchain/llvm-src] % svn update
At revision 41262.
following happens on build of ffmpeg proper:
# ./configure --cross-prefix=arm-apple-darwin- --cross-compile --disable-armv5te --disable
-armv6 --arch=arm
[imac:~/toolchain/src/ffmpeg] % make
arm-apple-darwin-gcc -no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare
-fomit-frame-pointer -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization
-Wpointer-arith -Wredundant-decls -Wno-pointer-sign -I"/Users/toolchain/src/ffmpeg"
-I"/Users/toolchain/src/ffmpeg" -I"/Users/toolchain/src/ffmpeg"/libavutil
-I"/Users/toolchain/src/ffmpeg"/libavcodec -I"/Users/toolchain/src/ffmpeg"/libavformat
-I"/Users/toolchain/src/ffmpeg"/libswscale -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H ffmpeg.c ffserver.c cmdutils.c 1>.depend
/tmp/3V0ZtO.s:unknown:immediate value (-112) too large
make: *** [.depend] Error 1
Hope the libs help at least. My ASM failed me to fix the asm in 3V0ZtO.s (sorry)