Skip to content

Instantly share code, notes, and snippets.

View mwcz's full-sized avatar
🏠
Working from home

Michael Clayton mwcz

🏠
Working from home
View GitHub Profile
@salamanders
salamanders / speedup.sh
Last active June 25, 2023 22:45
Speed up video 64x with frame blending/averaging using ffmpeg
# Simple 4x speedup, force to 60fps.
/c/bin/ffmpeg/bin/ffmpeg.exe -r 60 -i thefile.mkv -vf "tblend=average,framestep=2,tblend=average,framestep=2,setpts=0.25*PTS" -r 60 -c:v mpeg4 -q:v 1 -an thefile_4x.mp4
# Force input to 60fps. blend 16, and pick 1 of each 16. (do we do extra work for the other 15?) Set PTS to 1/16th of "original". Encode very high quality.
ffmpeg -r 60 -i molt.mp4 \
-vf "crop=in_h:in_h,tmix=frames=16:weights='1',select='not(mod(n\,16))',setpts=0.0625*PTS" \
-c:v libx265 -crf 18 -an molt16.mp4
# I still like the original. Match the "-r NN" to the source frame rate.
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs