Skip to content

Instantly share code, notes, and snippets.

View Mini preview of clip.md

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:1bf5b39cfd208e7c10caf28d17f416cb
Created Jul 29, 2020
Move "The" to the end of a column
View gist:1bf5b39cfd208e7c10caf28d17f416cb
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
View Mount NAS
#!/bin/bash
HOST=192.168.1.50
# Check if the script is being executed as root
if [[ $EUID -ne 0 ]]; then
echo -e "🥴 \033[0;31mThis script must be run as root \033[0m"
exit 1
fi
# Ping the storage server to determin connectivity
View How to pingpong
1. youtube-dl -a lista.txt // Download all lectures with youtube-dl from file `lista.txt`
2. for f in *.mp4; do ffmpeg -i "$f" -vn "$(basename "$f" .mp4).mp3"; done // convert all mp4 to mp3
3. for f in *.mp3; do ffmpeg -i "$f" -af "highpass=f=200, lowpass=f=3000" "$(basename "$f" .mp3)_noice.mp3"; done
4. for f in *_noice.mp3; do ffmpeg -i "$f" -af silenceremove=1:0:-50dB "$(basename "$f" .mp3)_silence.mp3"; done
5. ffmpeg-normalize *.mp3 -c:a libmp3lame -b:a 192k -ext mp3 (https://superuser.com/a/323127/643639, https://stackoverflow.com/a/58997035/4892914)
6. ????
7. PROFIT
(2. ffmpeg -i input.mp4 -f mp3 -ab 192000 -vn output.mp3)
(3. ffmpeg -i output.mp3 -af "highpass=f=200, lowpass=f=3000" output_clean.mp3) // reduce noice (https://superuser.com/questions/733061/reduce-background-noise-and-optimize-the-speech-from-an-audio-clip-using-ffmpeg)
@ArneAnka
ArneAnka / gist:a1348b13fc291f72f862d92f35380428
Created Jan 5, 2020
FFmpeg: How to convert vertical video with black sides, to video 16:9, with blurred background sides
View gist:a1348b13fc291f72f862d92f35380428
https://stackoverflow.com/questions/30789367/ffmpeg-how-to-convert-vertical-video-with-black-sides-to-video-169-with-blur
ffmpeg -i <input_file> -filter_complex "[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16" <output_file>
TAKES FOREVER!
View gist:56ce9657190fee72051dbf1012871726
https://serverfault.com/a/35079
```
find /home/user -type d -print0 | xargs -0 chmod 0775
find /home/user -type f -print0 | xargs -0 chmod 0664
```
@ArneAnka
ArneAnka / gist:2fac16fa6c7204b0990365d1af2f5331
Created Dec 16, 2018
Move/copy files to folder corresponding their fileextension
View gist:2fac16fa6c7204b0990365d1af2f5331
find . -type f -exec bash -c 'mkdir -p sorted/"${0##*.}"; cp "$0" sorted/"${0##*.}"' {} \;
View Font-awesome and bulma to a Laravel project
Font awesome:
In App directory, run:
```
npm install font-awesome
```
In App/resources/assets/sass/app.scss add
```
// Font awsome
$fa-font-path: "/assets/fonts";
@ArneAnka
ArneAnka / gist:bf636079faa9df86f7511b38982424ed
Created May 11, 2017
Search images of a specific dimension
View gist:bf636079faa9df86f7511b38982424ed
# This scripts helps you when seraching images of a speceifc dimension. Lets
# say you want to remove thumbnails or something, then this is good!
# Notice the `echo`, remove that and run the script. That will REMOVE you files.
# Change `rm` to `cp` to copy the files if you want to review them before deletion.
```
#!/bin/bash
targetDir="$HOME/Pictures"