Skip to content

Instantly share code, notes, and snippets.

@ArneAnka
ArneAnka / gist:1bf5b39cfd208e7c10caf28d17f416cb
Created July 29, 2020 06:14
Move "The" to the end of a column
UPDATE games
SET title = CASE WHEN INSTR(title,' ')>0
AND LEFT(title,INSTR(title,' '))
IN ('The ')
THEN CONCAT(UPPER(SUBSTRING(title,INSTR(title,' ')+1,1))
,SUBSTRING(title,INSTR(title,' ')+2)
, ', '
, LEFT(title,INSTR(title,' ')-1))
ELSE title
END

mkv or mp4 shouldn't matter because they get decoded before getting filtered. Try removing just that option ( :force_divisible_by=2 ) and see if it works.

That select filter is a lot to digest, here I'll highlight some of the key tunable numbers so you can adjust it and find what works best for your content.

ffmpeg -i "video" -vsync vfr -vf "select=if(gt(scene\,0.5)*(isnan(prev_selected_t)+gte(t-prev_selected_t\,2))\,st(1\,t)*0*st(2\,ld(2)+1)\,if(ld(1)*lt(ld(2)\,4)\,between(t\,ld(1)+2\,ld(1)+4))),scale=320:180:force_original_aspect_ratio=decrease:flags=bicubic+full_chroma_inp:sws_dither=none,framestep=2,setpts=N/(12*TB)" -an -sn -map_metadata -1 -compression_level 5 -q:v 75 -loop 0 -f webp -y "out.webp"

1st "2" is the minimum number of seconds between captured scene cuts.

2nd "4" is n+1 number of scene cuts to capture.

@ArneAnka
ArneAnka / gist:612b9f51566b73b10fc8b3eddce16747
Created July 8, 2022 16:50
Get all emails from a file with grep and regex
`$ grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" file.txt`