dotfiles/.local/bin/flac-to-ogg

23 lines
570 B
Plaintext
Raw Normal View History

2020-12-27 00:52:16 +01:00
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p ffmpeg
for file in *.flac; do
2020-12-27 00:52:16 +01:00
BASENAME="`basename "${file}" .flac`"
COVER="${BASENAME}-cover.jpg"
METADATA="${BASENAME}.meta"
2020-12-27 00:52:16 +01:00
echo "${BASENAME}"
echo $PATH
2020-12-27 00:52:16 +01:00
ffmpeg -y -i "${file}" -an -c:v mjpeg "${COVER}"
ffmpeg -i "${file}" -f ffmetadata "${METADATA}"
ogg-cover-art "${COVER}" >> "${METADATA}"
ffmpeg -i "${METADATA}" -i "${file}" -map_metadata 0 -b:a 320k -c:a libopus -map 1:a:0 "${BASENAME}.ogg"
rm "${COVER}"
rm "${METADATA}"
done
2020-12-27 00:52:16 +01:00
# Local Variables:
# mode: sh
# End: