Created
September 2, 2019 20:42
-
-
Save patrickt/e142069a38a7db7bc97785245b6e5916 to your computer and use it in GitHub Desktop.
fish-shell snippets to convert between representations of lossless audio
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
function flac_to_m4a | |
set flacs ./*.flac | |
if test -z "$flacs" | |
echo "No .flac files in current directory" | |
false | |
else | |
for flac_path in $flacs | |
set new_name (basename "$flac_path" .flac).m4a | |
ffmpeg -i "$flac_path" -c:a alac -c:v copy "$new_name" | |
end | |
true | |
end | |
end | |
function m4a_to_flac | |
set m4as ./*.m4a | |
if test -z "$m4as" | |
echo "No .m4a files in current directory" | |
false | |
else | |
for m4a_path in $m4as | |
set new_name (basename "$m4a_path" .m4a).flac | |
ffmpeg -i "$m4a_path" "$new_name" | |
end | |
true | |
end | |
end | |
function wav_to_m4a | |
set wavs ./*.wav | |
if test -z "$wavs" | |
echo "No .wav files in current directory" | |
false | |
else | |
for wav_path in $wavs | |
set new_name (basename "$wav_path" .wav).m4a | |
ffmpeg -i "$wav_path" -acodec alac "$new_name" | |
end | |
true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment