Skip to content

Instantly share code, notes, and snippets.

@patrickt

patrickt/audio.fish

Created Sep 2, 2019
Embed
What would you like to do?
fish-shell snippets to convert between representations of lossless audio
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
You can’t perform that action at this time.