ffmpeg Notes
Cheat Sheet
http://rodrigopolo.com/ffmpeg/cheats.php
Not all of these are good
https://trac.ffmpeg.org/wiki
is a good place for ideas.
http://rob.opendot.cl/index.php/useful-stuff/ffmpeg-x264-encoding-guide/
streaming server hinting: http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2006-December/005942.html
ffmpeg -pass 1 -passlogfile bh.VOB -threads 0 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -i bh.VOB -vcodec libx264 -b 614400 -s 320x240 -aspect 4:3 -an -y bh.mp4
ffmpeg -i bh.VOB -pass 2 -passlogfile bh.VOB -threads 0 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51-vcodec libx264 -b 614400 -s 320x240 -aspect 4:3 -acodec libfaac -y bh.mp4
streaming server hinting: http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2006-December/005942.html
ffmpeg -pass 1 -passlogfile bh.VOB -threads 0 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -i bh.VOB -vcodec libx264 -b 614400 -s 320x240 -aspect 4:3 -an -y bh.mp4
ffmpeg -i bh.VOB -pass 2 -passlogfile bh.VOB -threads 0 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51-vcodec libx264 -b 614400 -s 320x240 -aspect 4:3 -acodec libfaac -y bh.mp4
(from Mark Pilgrim)
Nice bash script
which uses mplayer
More ffmpeg cmds
#cmd = "ffmpeg -i %s -s 640x480 -ar 44100 -aspect 4:3 -pass 1 -b 768k -r 24 -acodec libmp3lame -ab 64 -f flv -y %s"
cmd = "ffmpeg -y -i %s -s 320x240 -qscale 5.0 -r 30 -ar 44100 -f flv %s"
cmd = "ffmpeg -y -i %s -s 320x240 -qscale 5.0 -r 30 -ar 44100 -f flv %s"
And yet another
ffmpeg -i sample.mpg -y -vcodec libx264 -vprofile baseline -level 30 -acodec libfdk_aac -ab 128k -ac 2 -b:v 500K -threads 1 encoded/sample_enc.mp4
Another
#!/bin/bash
file="$1"
ffmpeg -i "$file" \s
-loglevel error \s
-c:a copy \s
-c:v libx264 \s
-profile:v high \s
-preset veryslow \s
-tune animation \s
-crf 20 \s
"./encoded/${file%.*}.mkv"
file="$1"
ffmpeg -i "$file" \s
-loglevel error \s
-c:a copy \s
-c:v libx264 \s
-profile:v high \s
-preset veryslow \s
-tune animation \s
-crf 20 \s
"./encoded/${file%.*}.mkv"
Yet Another
infile ="video.avi"
tmpfile="video_tmp.mp4"
outfile="video.mp4"
options="-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \s
-partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \s
-me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \s
-flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \s
-g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\s
-qmax 51 -qdiff 4"
ffmpeg -y -i "$infile" -an -pass 1 -threads 2 $options "$tmpfile"
ffmpeg -y -i "$infile" -acodec libfaac -ar 44100 -ab 96k -pass 2 -threads 2 $options "$tmpfile"
qt-faststart "$tmpfile" "$outfile"
tmpfile="video_tmp.mp4"
outfile="video.mp4"
options="-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \s
-partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \s
-me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \s
-flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \s
-g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\s
-qmax 51 -qdiff 4"
ffmpeg -y -i "$infile" -an -pass 1 -threads 2 $options "$tmpfile"
ffmpeg -y -i "$infile" -acodec libfaac -ar 44100 -ab 96k -pass 2 -threads 2 $options "$tmpfile"
qt-faststart "$tmpfile" "$outfile"
From Berkely
profile.hd.stream.ffmpeg.command = -i #{in.video.path} -threads 0 -vcodec libx264 -profile:v high -preset superfast -b:v 500k -vf scale='trunc(oh*a/2)*2\s:720' -acodec libmp3lame -ar 44100 -ab 64k #{out.dir}/#{out.name}#{out.suffix}
I'm not sure what this is
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 320x180 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre ipod320 -r 24 -g 48 -b 200000 -threads 64 bigbuckbunnyiphone_320.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 640x360 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre ipod640 -r 24 -g 48 -b 520000 -threads 64 bigbuckbunnyiphone_640.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 320x180 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 270000 -threads 64 bigbuckbunny_400.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 480x270 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 570000 -threads 64 bigbuckbunny_700.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 720x406 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 1000000 -threads 64 bigbuckbunny_1100.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 1024x576 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 1200000 -threads 64 bigbuckbunny_1300.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 1080x608 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 1400000 -threads 64 bigbuckbunny_1500.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 640x360 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre ipod640 -r 24 -g 48 -b 520000 -threads 64 bigbuckbunnyiphone_640.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 320x180 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 270000 -threads 64 bigbuckbunny_400.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 480x270 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 570000 -threads 64 bigbuckbunny_700.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 720x406 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 1000000 -threads 64 bigbuckbunny_1100.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 1024x576 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 1200000 -threads 64 bigbuckbunny_1300.mov
ffmpeg -i big_buck_bunny_1080p_stereo.avi -s 1080x608 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vpre default -vpre main -r 24 -g 48 -b 1400000 -threads 64 bigbuckbunny_1500.mov
Creating a Poster Image
ffmpeg -ss 0 -i video.mp4 -f image2 -vframes 1 poster.jpg
Create a Thumbnail
$cmd = "$ffmpeg -i $video -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -s 320x240 -vcodec mjpeg -f mjpeg $image 2>&1";