I found the answer from the creator of mp3DirectCut. He gives three options. Relevant part of his post follows:
I use the "DSM converter" of an old version of the "Media Player Classic" (1.3.1249.0). Also "FFmpeg" can demux (command line: ffmpeg.exe -i inputfile.mp4 -acodec copy outputfile.aac
).
There is also MP4Creator which is much smaller. This small batch file can be used for easy decoding by dropping files on it:
mp4creator demux.bat:
@echo off
mp4creator.exe -list %1
echo Demux which track (usually 1 or 2)?
set /p track=
mp4creator.exe -extract=%track% %1
pause
The extension output file must be renamed to AAC - and you got it.
I went with ffmpeg. To convert back to AAC it appears that an additional option is needed. The commands for converting to and from AAC are like below:
ffmpeg -i in.m4a -acodec copy out.aac
ffmpeg -i in.aac -acodec copy -bsf:a aac_adtstoasc out.m4a
More generally, I would recommend to have a look at the FFmpeg Wiki page on AAC encoding. Here you will find tips on how to achieve the best quality, which involves:
- using the
libfdk_aac
encoder instead of the built-in one (the encoder can make a huge difference in quality!)
- using VBR — there is no need to constrain the rate or waste bits
- turning off the high pass filter, as by default some high frequencies are lost during conversion
Thus, the following would work:
ffmpeg -i input.opus -c:a libfdk_aac -vbr 5 -cutoff 18000 output.m4a
This should be absolutely transparent to anyone's ears. You may even use -vbr 4
and check whether you can detect the difference. I guess you won't.
More specifically, you ask:
And finally, youtube-dl also can download an AAC file of 128 kbs. (…) But would transcoding the opus to AAC (…) maintain that quality difference, or would the transcoding (…) induce artefacts so that the audio quality (…) would actually be worse?
Great question that I don't know how to answer without conducting a formal listening test.
However, if you assume that stereo AAC at 128 kbps is at least good quality (but not excellent), you may forgo any conversion and use that directly if it sounds good to you. I think I would listen to the original Opus and AAC samples that you directly downloaded and try to do a blind test — can you reliably detect the difference? If no, then just use AAC and save yourself the conversion.
PS: I listened to a few music clips from YouTube with both the Opus and AAC variants and I personally liked Opus better — it seemed to have a bit more high-frequency spatiality to it. But don't consider that a scientifically sound conclusion!
Finally, there is a thread discussing a similar issue, and here, one user thinks that there is more aggressive psycho-acoustic shaping in VBR encoding, which may enhance already present artifacts when encoding a lossy file again. He concludes that ABR at a high bitrate may be better suited for such tasks.
Best Answer
The easiest way to do this is probably with iTunes. In your preferences, go to Import Settings and choose "Import Using" to WAV encoder. Then you can right-click on any AAC song and choose "Create WAV version." You should be able to select a bunch of files at once and do this to them in bulk.
Nota bene: Don't forget to switch your import settings back to AAC when you're done, presuming you still want to be using it.