I recently read that if saving youtube audio for offline listening (e.g., using youtube-dl), youtube’s currently-used native audio format is opus encoded audio (typically @160 mbps). Downloading youtube audio only (e.g., in Windows 10) creates a .webm file containing opus encoded audio. Using this format theoretically results in the least re-encoding for youtube originating audio.
However, attempting to listen to .webm/opus audio files using Plex or Plexamp creates problems. After some testing, here is what I found as of today (6/14/20):
Plex will not add .webm files to any library designated an audio library.
This first issue can be fixed by manually changing the .webm file extensions to .ogg, .opus, and/or .m4a (perhaps others, but I only tried these three).
Once in a Plex music library, the audio files play as expected using either the Windows Plex Media Player app or in a Chrome browser (This is the good news).
Unfortunately, the audio files do NOT play on an iPhone using either the Plex iOS client or in Plexamp (This is the bad news).
Strangely, the audio files do play in the Plex app if first downloaded (“synced”) to the device. But the audio files do NOT play in Plexamp even if first downloaded.
With youtube’s apparently universal adoption of opus (and the generally positive reviews of the format I encountered while searching this issue), it seems that opus is poised to become the most broadly adopted method of lossy audio compression (with flac leading the way for lossless). It would be great if Plexamp and Plex could seemlessly handle these open-encoded files.
For now, the best option for mobile listening is (1) use only the main Plex app and (2) sync to device prior to listening.
As an update and work-around, I can convert the webm/ogg files to .flac using ffmpeg and regain all Plexamp capabilities.
This work-around is not ideal because it is an extra step, is a waste of storage space and cpu time, and philosophically is goofy (to go from lossy opus to lossless flac) given that no additional quality magically appears from expanding the file size.
Demux the .webm file and extract the audio track, so you get a pure .opus file. You only want the audio, after all. Not video+audio, which is what webm is usually holding.
.webm is a Matroska container. Therefore you can use all tools which can handle MKV/MKA files. If they don’t cooperate at first, rename the .webm to .mkv
Once you have the opus file, you can tag it like a regular .flac or .ogg file. mp3tag (among others) can be used on Windows to do it.
Otto - Thank you for these helpful tips. For anyone else who comes across this conversation, here is a short Windows batch file that somewhat automates the process. It has an example youtube URL which can be replaced with any youtube URL (or youtube playlist URL). The directory locations were just for testing and have been revised to drop the files into my music folders monitored by Plex.
I have not yet automated the use of mp3tag, so that process is essentially manual for now. I may play with that more later.
FOR %%f IN (g:\Downloads\convert*.webm) DO mkvextract tracks “g:\Downloads\convert%%~nf.webm” 0:“g:\Downloads\convert%%~nf.opus” && del “g:\Downloads\convert%%~nf.webm”