I want to convert a ogg file to aac. But I need to transfer all the data of the ogg file (i.e. album, year, cover,...) to the aac file using a shell comand.
Thanks!
I want to convert a ogg file to aac. But I need to transfer all the data of the ogg file (i.e. album, year, cover,...) to the aac file using a shell comand.
Thanks!
ffmpeg -i input.ogg -strict experimental -acodec aac output.aac
you can find ffmpeg in the official repository.
Transcoding from one lossy format to another is not ideal. However, if you insist on doing so, this is the best way: install avconv and ubuntu-restricted-extras with
sudo apt-get install avconv ubuntu-restricted-extras
then get neroAacEnc:
wget http://ftp6.nero.com/tools/NeroAACCodec-1.5.1.zip
sudo unzip NeroAACCodec-1.5.1.zip -d /usr/bin linux/*
sudo chmod +x /usr/bin/neroAacDec /usr/bin/neroAacEnc /usr/bin/neroAacTag
NeroAacEnc is superior to avconv's internal AAC encoder, and also much better than libfaac, it consistently scores highly on listening tests; and Nero have released it free for non-commercial use.
To create an M4A (MP4) file, use
avconv -i input.ogg -f wav - | neroAacEnc -if - -ignorelength -q 0.55 -of output.m4a
The -q flag can use any value between 0 and 1, with 1 being highest-quality; according to this, 0.55 averages to a bit rate of 192 kb/s; a lower -q of around 0.4 would probably actually be perfectly suitable for most music listening. Experiment to find out what works best for you.
Unfortunately, this won't keep the metadata; but you can transfer the metadata from input.ogg to output.m4a with a second command:
avconv -i output.m4a -i input.ogg -map 0 -map_metadata 1 -c copy output.m4a