useful for when you rip dvd's and need to rename the episodes
ls | awk '{start=0;system("mv ./" $1 " \"./Simpsons-S01E0"start+NR ".mkv\"")}'
rename 's/find01/replace02/' filestart*
useful for when you take ripped dvd output and need to encode it
mkdir encodes; for i in *.mkv; do ffmpeg -i "$i" "./encodes/${i%.*}.mkv"; done
# for interlaced video with h265 and audio passthrough
mkdir encodes; for i in *.mkv; do ffmpeg -i "$i" -vf yadif -c:v libx265 -preset slow -c:a copy "./encodes/${i%.*}.mkv"; done
# interlaced video, h264, audio 1 passed through, rest encoded, subs passed through
mkdir encodes; for i in *.mkv; do ffmpeg -i "$i" -map 0 -c copy -vf yadif -c:v libx264 -preset slow -c:a aac -c:a:0 copy -b:a 128k "./encodes/${i%.*}.mkv"; done
useful for removing the title from a ripped dvd
for i in *.mkv ; do mkvpropedit "$i" --edit info --set "title="; done
mkdir compress; for i in *.tif; do convert "$i" "./compress/${i%.tif}.jpg"; done
## ss = start t = end
ffmpeg -i input.mp4 -acodec copy -vcodec copy -ss 02:16:30 -t 01:03:10 output.mp4
#Useful to make an ffmpeg list of files for concatenation
find /full/path/to/dir -maxdepth 2 -type f -name *.flac -printf "file '%p'\n" >> ~/Downloads/music.txt
sort --sort=random input.txt >> output.txt
# -vn is no video
ffmpeg -i input.wav -vn -c:a aac -b:a 128k output.m4a
-map 0
maps all streams. -c copy
sets default to copy.
ffmpeg -i innie.mkv -map 0 -c copy -c:v libx265 -c:a aac -b:a 128k outie.mkv
between(t,2.3,8.8) means image visible from 2.3 sec - 8.8 sec
ffmpeg -i cc-lower3.webm -i image.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,2.3,8.8)'" output.mkv
You can use this to expose a service to loopback on a server, then forward that service locally. Keeps it fully protected.
ssh -L localport:127.0.0.1:serverport username@serverip
until curl --stdeerr - localhost:1337/status | grep -q "up" do sleep 15: done
pwgen -s 64 1
for snap in $(zfs list -rt snap -Ho name | grep TAG); do zfs destroy ${snap} && echo "${snap}: DESTROYED";done
du -h / 2>/dev/null | grep '[0-9\.]\+G\s'