This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://evilmartians.com/chronicles/better-web-video-with-av1-codec | |
# Encode as H.264. Reduce quality by increasing the CRF value. If you're looking for an output that is roughly "visually lossless" but not technically lossless, use a -crf value of around 17 or 18. | |
ffmpeg -i <SOURCE> -map_metadata -1 -c:a libfdk_aac -c:v libx264 -crf 28 -preset veryslow -profile:v main -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.h264.mp4 | |
# Encode as AV1. Reduce quality by increasing the CP value. | |
ffmpeg -i <SOURCE> -map_metadata -1 -c:a libopus -c:v librav1e -qp 80 -tile-columns 2 -tile-rows 2 -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.av1.mp4 | |
# Encode as HEVC. Reduce quality by increasing the CRF value. | |
ffmpeg -i <SOURCE> -map_metadata -1 -c:a libfdk_aac -c:v libx265 -crf 28 -preset veryslow -pix_fmt yuv420p -movflags +faststart -tag:v hvc1 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.hevc.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bin/bash | |
for d in */; do | |
cd "$d" | |
title=$(echo "$d" | sed 's/\./ /' | sed 's/ \[.*//g') | |
echo "$title" | sed 's/FABRICLIVE/Fabric lyve/' | sed -r 's/\(([0-9]+)\)/in \1/g' | sed -r 's/ 0+([1-9][0-9]*)/ \1/g' | say -v Serena -o "00. Title.aiff" | |
ffmpeg -i "00. Title.aiff" -acodec libmp3lame -ab 192000 -ar 44100 -ac 2 "00. Title.mp3" | |
command ls -1 *.mp3 | sed s/\'/\'\\\\\'\'/g | awk '$0="file \047"$0"\047"' >> tracklist.txt | |
ffmpeg -f concat -safe 0 -i tracklist.txt -c copy "../../Merged with titles/$title.mp3" | |
rm "00. Title.aiff" | |
rm "00. Title.mp3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Shokz OpenSwim headphones (formerly AfterShokz Xtrainerz) have a bug where | |
# tracks are not played in alphabetical or track order. They are played in the | |
# order that they were copied to the device. Read more about the issue here: | |
# | |
# - https://en.help.shokz.com/s/article/How-to-list-the-track-order-on-OpenSwim-formerly-Xtrainerz-OPENSWIM1408 | |
# - https://en.help.shokz.com/s/get-article?urlName=how-to-list-tracks-order-EN | |
# | |
# After extensive testing, it seems that specifying transmission order alone is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILES=(*.mp3) | |
for i in "${!FILES[@]}"; do | |
id3v2 -T "$((i + 1))/${#FILES[@]}" "${FILES[i]}" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for d in */; do | |
cd "$d" | |
say "$d" -o "00. Title.aiff" | |
lame -m m "00. Title.aiff" "00. Title.mp3" | |
rm "00. Title.aiff" | |
cd .. | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in {001..100}; do | |
say ${i##+(0)} -o "$i.aiff" | |
lame -m m "$i.aiff" "$i.mp3" | |
rm "$i.aiff" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILES=($(ls -tUr *.{png,jpeg})) | |
for i in "${!FILES[@]}"; do | |
mv "${FILES[i]}" "$(printf "%02d.${FILES[i]##*.}" "$((i + 1))")" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dependency: https://archive.org/services/docs/api/internetarchive/cli.html | |
# Usage example: ./download.sh byte-magazine | |
ia search "collection:$1" --itemlist | parallel 'ia download {} --glob="*.pdf"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p woff && for f in *.ttf; do sfnt2woff "$f"; woff2_compress "$f"; done && mv *.woff* woff | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Parse takes a string and returns a nested array. The array nests | |
* to a deeper level for each [[enclosed double bracket pair]]. | |
* | |
* eg: | |
* | |
* // Output: ['It goes ', ['deeper and ', ['deeper.']]] | |
* parse('It goes [[deeper and [[deeper.]]]]'); | |
*/ | |
function parse(str, startIdx = 0, isChild = false) { |