Skip to content

Instantly share code, notes, and snippets.

@samelie
samelie / ffmpeg install brew
Created September 2, 2014 21:35
ffmpeg all options in brew
change owner of brew to root, which is common for files in /usr/local directory ( opposed to either /home or /Users )
sudo chown root /usr/local/bin/brew
and/or add the admin group
sudo chown root:admin /usr/local/bin/brew
sudo brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-openssl --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools --with-x265 --with-faac --with-lame --with-x264 --with-xvid
@samelie
samelie / recursive png compression
Last active August 29, 2015 14:10
Recursive png smash
for i in *.png; do pngquant --force --ext .png --quality=90-100 $i; done
for i in *.mp4; do ffmpeg -i $i -c:v libvpx -minrate 3M -maxrate 3M -b:v 3M -c:a libvorbis $i.webm; done
@samelie
samelie / imagemagik
Last active October 17, 2015 16:32
resize imagemagik
for i in *.png; do convert $i -resize 480x270 $i; done
@samelie
samelie / gif!
Last active August 29, 2015 14:13
make gifs from video
//to folder output
ffmpeg -i screencast.mov -vf scale=320:-1 -r 4 output/ffout%3d.png
//make jpg
for i in output/*.png; do convert $i -strip -interlace Plane -gaussian-blur 0.01 -quality 70% $i.jpg; done
// merge, -dalay' is the delay of 8, you would get a FPS=100/8=12.5
convert -delay 6 -loop 0 output/*.jpg output/animation.gif
@samelie
samelie / ffmpeg last frame video
Created February 18, 2015 09:49
ffmpeg last frame of video
#!/bin/bash
fn="$1"
of=`echo $1 | sed s/mp4/jpg/`
lf=`ffprobe -show_streams "$fn" 2> /dev/null | grep nb_frames | head -1 | cut -d \= -f 2`
rm -f "$of"
let "lf = $lf - 1"
ffmpeg -i $fn -vf select=\'eq\(n,$lf\) -vframes 1 $of
A flawless way whereyou can just spit gifs out images, video, very easy. Mac only :(
----------- 1 ----------------
-First you need to open Terminal.app
(Spotlight > terminal)
- past this in and press enter: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
(this command install a package manager that lets you install two packages into your machine; they're not too big >.< )
----------- 2 ----------------
encode blur timeline , 0->10sec
ffmpeg -i vid2.mp4 -vf "boxblur=20:enable='between(t,0,10)'" -y testtest.mp4
//complete
ffmpeg -i vid2.mp4 -vf "boxblur=20:enable='between(t,0,10)'" -y -c:v libx264 -c:a libfdk_aac -movflags +faststart -pix_fmt yuv420p -keyint_min 6 -profile:v high -level 4.2 -maxrate 3000k testtest.mp4
@samelie
samelie / jsfindings
Created October 6, 2015 19:03
Wierd JS findings
********************
BACKBONE
********************
If you want to download a zip for example, consider attaching the url as a form action and using submit,
to avoid router.
<form class="" method="GET" action="{{url}}"><input value="{{download}}" type="submit"></form>
{
"dynamic_allocation_ad_tag": "https://ad.doubleclick.net/N4061/pfadx/com.ytpwatch.music/main_10481;sz=WIDTHxHEIGHT;kvid=pJk0p-98Xzc;kpu=WuTangClanVEVO;kpeid=1wNaX00osCIK4VjwboFqzA;kpid=10481;mpvid=AAT-TvWQhVcS1PHy;ssl=1;afv=1;afvbase=eJxdUl1zqyAQ_TX1zQ4qGnnwIe0kzWdrPm7r7QuDSKMJAlHUmF9_ienc6b0MM-zZsyy7Z8l5xIRFZVUxTrSsIgcC33cgCkeBF1iiKTHJ6sixco2LLPJCJwiga_U6Y21BmSFKcjEhOGsqogspIifwAbDaImMSU1VGARiWRXMiBOPRuhDPqoQhuIzAntXaeXCfyFeLC1HripHSwHdW6YISjr1_gP8T-cj9CR3ggf8S4aY2nl5jcSvkm2xqVuGu0UQcKCeiZa38yRQZdrpXkgAg6-f5Er4fu1ROz9fxPVOpTF94PN7b-_Zjk7_TnRPP-jtHb3cBDJ2_jxI1mHel8N2vapyxL9JwPUDGDdSk4IocmGVk1L1i0SCepbHq24hdKG8yZuWy1hEl9u20VZPaEAIYINc07nujEUBWU_Eo11o9eKbaqdld1z32stFNyh6pNMJOh8TmVIsTUDYKkyu1uGRmsAiasRmBn5EZMAA3A_rAGzyeGRYcDIR88B3jDhQIfRgOwY7nI-uWyfwNrHQ0jlNv6iIIL9fV1vdtsFjGq81-1feLo70ZP-22-9ni6cTiWTsWo_OSpp-nbo7pJYR1ctq8aWbPwyPmu0lSn9xDj9e5i85X1K_d7W8RS3zWQfdLvIhRJus38JK9cZ1O4mLS592JTWKnpJ-vH-kqOyTzaZFMqj6-_gFCwvVc;dc_backfill=1;dc_yt=1;k5=3_35_592_1030;kclt=1;kga=-1;kgg=-1;klg=en;kmsrd=1;ko=p;kr=F;ktype=so