Skip to content

Instantly share code, notes, and snippets.

@pierot
Last active December 9, 2016 03:43
Show Gist options
  • Save pierot/a88567befa3a2c795bc9 to your computer and use it in GitHub Desktop.
Save pierot/a88567befa3a2c795bc9 to your computer and use it in GitHub Desktop.
FFMPEG tips

REMOVE SOUND

ffmpeg -i balloon-2.webm -an balloon-2-nosound.webm

FLV TO WMV

ffmpeg -i infile.flv -vcodec wmv2 -sameq -acodec wmav2 -f output.wmv

for f in *.mp4; do ffmpeg -i $f -acodec libvorbis -vcodec libtheora -ac 2 -ab 128k -ar 44100 -b:v 900k -s 1024x576 -y $f.ogv 2> /dev/null &; done

for f in *.mp4; do ffmpeg -i $f -acodec libvorbis -ac 2 -ab 128k -ar 44100 -b:v 900k -s 1024x576 -y $f.webm 2> /dev/null &; done

for f in *.mp4; do ffmpeg -i $f -acodec libfaac -ab 128k -vcodec libx264 -level 21 -refs 2 -b:v 900k -bt 900k -threads 0 -s 1280x720 -y $f.mp4 2> /dev/null &; done

for f in *.mp4; do ffmpeg -itsoffset -5 -i $f -vcodec mjpeg -vframes 1 -an -f rawvideo -s 1024x576 -y $f.jpg 2> /dev/null &; done

for f in *.wmv; do ffmpeg -i $f -c:v libx264 -crf 23 -c:a libfaac -q:a 100 -y $f.mp4 2> /dev/null &; done

BATCH THUMBS

for f in *.mov; do ffmpeg -itsoffset -4 -i $f -vcodec mjpeg -vframes 1 -an -f rawvideo -s 502x276 $f.jpg; done

HIGH QUALITY RESIZE

ffmpeg -i xxx.mp4 -r 10000000/417083 -b 2M -bt 4M -vcodec libx264 -vpre default -acodec libfaac -threads 4 -s 1280x720 xxx.mp4

RESIZE IMAGES TO LONG EDGE 2000

mogrify -path ~/Desktop/resized/ -resize '2000x2000>' *.jpg

TRIM FLV

for f in *.flv; do ffmpeg -ss 00:00:00.000 -t 00:00:07.000 -i $f -acodec copy -vcodec copy -y $f-short.flv; done

RESIZE

sips -Z 960 */*.png

CONVERT MTS 1080i TO MOV 720p

for f in *.MTS; do ffmpeg -i $f -f mp4 -vcodec libx264 -filter:v yadif -bufsize 56000000 -maxrate 56000000 -b:v 1600k -s 1280x720 -ar 44100 -b:a 160k -y $f.mp4; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment