A blog about Ruby, Rails and other Tech. Mostly.
Back to blog
Installing FFMPEG on a mac to encode to flvActually installing FFMPEG on a mac is not completely trivial due to some recent issues caused by the version of GAS used by Apple. I'm sure this will be fixed soon, but in the mean time here's how I did it:
- Get lame. I used version 3.97.
- Extract, confgure, make and install. It goes cleanly.
tar xzf lame-3.97.tar.gz
cd lame-3.97
./configure
make
sudo make install
- Get ffmpeg. It's easiest to download the full checkout.
- Uncompress it.
bunzip2 ffmpeg-checkout-snapshot.tar.bz2
- Patch it. Get the patch from here if it doesn't render correctly in my blog.
cd ffmpeg-checkout-2007-06-06 # use your own dated version of course
cat >g_patch
Index: libavcodec/i386/fft_sse.c
===================================================================
--- libavcodec/i386/fft_sse.c (revision 9152)
+++ libavcodec/i386/fft_sse.c (working copy)
@@ -170,12 +170,12 @@
asm volatile (
"movaps %0, %%xmm0
" // xmm0 = r0 X r1 X : in2
"movaps %1, %%xmm3
" // xmm3 = X i1 X i0: in1
- "movaps -16+%0, %%xmm4
" // xmm4 = r0 X r1 X : in2
- "movaps 16+%1, %%xmm7
" // xmm7 = X i1 X i0: in1
+ "movaps -16%0, %%xmm4
" // xmm4 = r0 X r1 X : in2
+ "movaps 16%1, %%xmm7
" // xmm7 = X i1 X i0: in1
"movlps %2, %%xmm1
" // xmm1 = X X R1 R0: tcos
"movlps %3, %%xmm2
" // xmm2 = X X I1 I0: tsin
- "movlps 8+%2, %%xmm5
" // xmm5 = X X R1 R0: tcos
- "movlps 8+%3, %%xmm6
" // xmm6 = X X I1 I0: tsin
+ "movlps 8%2, %%xmm5
" // xmm5 = X X R1 R0: tcos
+ "movlps 8%3, %%xmm6
" // xmm6 = X X I1 I0: tsin
"shufps $95, %%xmm0, %%xmm0
" // xmm0 = r1 r1 r0 r0
"shufps $160,%%xmm3, %%xmm3
" // xmm3 = i1 i1 i0 i0
"shufps $95, %%xmm4, %%xmm4
" // xmm4 = r1 r1 r0 r0
@@ -222,13 +222,13 @@
for (k = 0; k < n4; k += 4) {
asm (
"movaps %0, %%xmm0
" // xmm0 = i1 r1 i0 r0: z
- "movaps 16+%0, %%xmm4
" // xmm4 = i1 r1 i0 r0: z
+ "movaps 16%0, %%xmm4
" // xmm4 = i1 r1 i0 r0: z
"movlps %1, %%xmm1
" // xmm1 = X X R1 R0: tcos
- "movlps 8+%1, %%xmm5
" // xmm5 = X X R1 R0: tcos
+ "movlps 8%1, %%xmm5
" // xmm5 = X X R1 R0: tcos
"movaps %%xmm0, %%xmm3
" // xmm3 = i1 r1 i0 r0
"movaps %%xmm4, %%xmm7
" // xmm7 = i1 r1 i0 r0
"movlps %2, %%xmm2
" // xmm2 = X X I1 I0: tsin
- "movlps 8+%2, %%xmm6
" // xmm6 = X X I1 I0: tsin
+ "movlps 8%2, %%xmm6
" // xmm6 = X X I1 I0: tsin
"shufps $160,%%xmm0, %%xmm0
" // xmm0 = r1 r1 r0 r0
"shufps $245,%%xmm3, %%xmm3
" // xmm3 = i1 i1 i0 i0
"shufps $160,%%xmm4, %%xmm4
" // xmm4 = r1 r1 r0 r0
@@ -248,7 +248,7 @@
"addps %%xmm3, %%xmm0
" // xmm0 = result
"addps %%xmm7, %%xmm4
" // xmm4 = result
"movaps %%xmm0, %0
"
- "movaps %%xmm4, 16+%0
"
+ "movaps %%xmm4, 16%0
"
:"+m"(z[k])
:"m"(tcos[k]), "m"(tsin[k])
#ifndef ARCH_X86_64
^D
patch <g_patch
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: libavcodec/i386/fft_sse.c
|===================================================================
|--- libavcodec/i386/fft_sse.c (revision 9152)
|+++ libavcodec/i386/fft_sse.c (working copy)
--------------------------
File to patch: libavcodec/i386/fft_sse.c
patching file libavcodec/i386/fft_sse.c
- Configure, make and install
./configure --enable-libmp3lame --enable-static --disable-vhook
make
sudo make install
- Try it out:
ffmpeg -i video.wmv -b 640k -ar 44100 -ab 128 -s 320x240 video.flv
Back to blog |