Skip to content

Instantly share code, notes, and snippets.

@EstebanFuentealba
Last active June 17, 2022 15:53
Show Gist options
  • Save EstebanFuentealba/40a16ed07c4eb98c9d636c981d7abd66 to your computer and use it in GitHub Desktop.
Save EstebanFuentealba/40a16ed07c4eb98c9d636c981d7abd66 to your computer and use it in GitHub Desktop.
Tropimix Clasicos
#!/bin/bash
if [ -z "$1" ] && [ -z "$2" ]; then
echo Syntax:
echo "AudioToVideo.sh /path/to-disk-dir/ \"#fff00\""
else
# convert image to full hd for video
#convert "$1/cover.png" +dither -colors 5 -define histogram:unique-colors=true -format "%c" histogram:info:
find "$1" \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.wav" -o -iname "*.m4a" \) -print0 |
while IFS= read -r -d '' line; do
file=$(basename "$line" .mp3)
echo $file;
convert -gravity Center -background "$2" -flatten -resize 1920x1080^ -extent 1920x1080 "$1/cover.png" "$file"-cover-1920x1080.png;
ffmpeg-bar -i "$line" -y -loop 1 -i "$file"-cover-1920x1080.png -filter_complex "[0:a]showwaves=s=1920x200:mode=cline:r=30:colors=0xFFFFFF|0xD3D3D3:draw=full[fg];[1:v]scale=1920:-1[bg];[bg][fg]overlay=shortest=1:850:format=auto,format=yuv420p[out]" -map "[out]" -map 0:a -pix_fmt yuv420p -c:v libx264 -preset medium -crf 18 -c:a copy -shortest "$1/$file".mkv < /dev/null
echo "$file".mkv generated
rm "$file"-cover-1920x1080.png
done
echo generated all
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment