Skip to content

Instantly share code, notes, and snippets.

View mishazawa's full-sized avatar
🎩
because white is boring

mishazawa

🎩
because white is boring
  • 0x0
  • 09:14 (UTC +09:00)
View GitHub Profile
@mishazawa
mishazawa / gist:9b36719e847f7a18b74d5140a4f572d4
Created February 21, 2019 07:54
extract keyframes from video
# extract kframes
`ffmpeg -skip_frame nokey -i $filename -vsync 0 -r 30 -f image2 $output_dir-%02d.jpeg`
# get frames \ timestamps
`ls -1 image-*.jpeg > images.txt`
`ffprobe -f lavfi -i "movie=input.mp4,fps=fps=25[out0]" -show_frames -show_entries frame=pkt_pts_time -of csv=p=0 > frames.txt`
@mishazawa
mishazawa / index.js
Created March 7, 2019 12:24
express mw example
export const possal = (req, res, next) => {
res.set('Ya-Possal', '*');
return next();
};
@mishazawa
mishazawa / mpd.sh
Created May 2, 2019 12:25
create mpd
ffmpeg -i <input file> -c:v libx264 -c:a aac -strict experimental -b:a 128k -f dash -min_seg_duration 4 <manifest name>.mpd
@mishazawa
mishazawa / convconc.sh
Created May 16, 2019 07:02
img + audio -> mp4 -> concat
ffmpeg -loop 1 -i <IMAGE> -i <AUDIO> -c:v libx264 -tune stillimage -strict -2 -c:a aac -b:a 192k -pix_fmt yuv420p -shortest <OUTPUT>.mp4
# > playlist.txt
# file 'out1.mp4'
# file 'out2.mp4'
# file 'out3.mp4'
ffmpeg -f concat -safe 0 -i <PLAYLIST> -c copy <OUTPUT>.mp4
@mishazawa
mishazawa / Rules.md
Created May 29, 2019 09:44
What are some rules you do not violate as a software developer?

If possible, don´t do it

  • Reuse as much as you can

  • Use open source

  • Buy what works

The simplest thing that work

@mishazawa
mishazawa / history.sh
Created August 15, 2019 08:28
Log stats
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
@mishazawa
mishazawa / history.sh
Created August 15, 2019 08:28
Log stats
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
@mishazawa
mishazawa / split.js
Last active September 4, 2019 15:24
split by silence
"ffmpeg -i "videoplayback.mp4" -af silencedetect=noise=-30dB:d=0.5 -f null - 2> vol.txt"
const si = [
["1.0466" , "254.221"],
["256.942" , "470.262"],
["472.004" , "806.045"],
["808.412" , "1096.53"],
["1098.64" , "1322.09"],
["1327.67" , "1641.81"],
@mishazawa
mishazawa / PrePostPlugin.js
Created October 10, 2019 14:09
pre-compile post-compile plugin for webpack
const { exec } = require('child_process');
const resp = (error, stdout, stderr) => {
console.log(stdout);
if (error) console.error(error);
if (stderr) console.error(stderr);
}
class PrePostPlugin {