zigford.org/burning-a-cd-cli-style.md
2020-07-21 06:49:32 +10:00

52 lines
1.7 KiB
Markdown

Burning a CD CLI Style
I've written about [ripping an album cli style][1], and sometimes it still
makes sense to have older tech around. Like for example if you have 6 kids,
you can't exactly afford to buy them all iPods. Or, maybe you can't afford
the latest cars, and your car still has cd audio.
Thanksfully with Linux we don't have to resort to some clunky UI. We can do
anything on the good ole' command line
---
So, you got your Audio files. They may not be titled with nice numbers so
that the list well with `ls` or a `*` glob. Not to worry. You probably
downloaded them in order. We can fix this in bash. The `ls` command sorts
files by default in alphabetical order. `ls -U` on the other hand, disables
sorting and they should be shown in order they were added to the filesystem
:
i=1
ls -U | while read f
do
mv "${f}" "$(printf %02d $i)_${f}"
i=$((i+1));
done
With this touch of cli magic, we have prepended a 01..etc number to each
file.
Next we need to ensure the files are in the right format for cdrecord to
burn. The command line tool cdrecord, needs files to be in WAV, stereo at
44100hz. ffmpeg to the rescue! _PS, you might need to adjust for file ext_
mkdir burn
for i in *.webm
do
ffmpeg -i "${i}" -ar 44100 burn/"${i}".wav
done
Now we are ready to burn those files to disc with cdrecord:
cdrecord -v -nofix -audio -pad *.wav
And finally we need to finalize the disc if we want any hope of reading it
on a regular old cd player
cdrecord -v -fix -eject
Tags: ffmpeg, cli, burn-a-cd, linux, mp3, music, bash, youtube
[1]:ripping-an-album-from-youtube---cli-style.html