HydrogenAudio

Lossy Audio Compression => Opus => Topic started by: Dynamic on 2016-09-29 10:28:33

Title: Android 5 and 6 Opus support via .opus.ogg double filename extension
Post by: Dynamic on 2016-09-29 10:28:33
On my 2 year old Moto G (2nd Gen) phone now running Marshmallow (Android 6.0) opus files, while I could play them in certain apps like VLC, tended to generate Windows warnings that they may not be compatible with the device when I transfer over USB and weren't supported by Google Music or my file managers.

I found reference to a workaround that renaming the files to filename.ogg would work, so to make it obvious to me, I renamed a couple to filename.opus.ogg and they work great in Google Music.

I'm not a foobar2000 titleformat expert, so couldn't figure out how to make it work in File Operations/Rename, but I found a good Command Prompt line that works recursively through subfolders renaming all .opus files to .opus.ogg, so if you want to rename all .opus files on your PC, modify the first line to get to your Music folder then use the second line to work recursively through them all renaming any .opus files you have:

Code: [Select]
cd C:\Users\MyUserName\Music
for /R %x in (*.opus) do ren "%x" *.opus.ogg

For new encoding using the Foobar2000 converter, I simply use the Custom Encoder and set the extension to .opus.ogg instead of .opus
Title: Re: Android 5 and 6 Opus support via .opus.ogg double filename extension
Post by: lothario15 on 2016-10-04 13:28:58
Thanks for posting this.

I just did a check on a few Samsung devices (i9100, i9305, SM-G900F) running Android 6 (CyanogenMod 13).  The native music player does indeed recognise and play Opus files without issues when the extension is changed from '.opus' to '.ogg'.

There's no need to append a '.ogg' extension to an existing '.opus' extension; simply substituting '.opus' with '.ogg' is sufficient (as far as I'm aware, the system would only recognise the extension after the last dot anyway, anything before is seen as part of the filename).

We knew that Android 6.0 made it mandatory to decode Opus streams in Matroska containers (as discussed in an earlier thread (https://hydrogenaud.io/index.php/topic,107676.0.html) and outlined in the compatibility document here (https://source.android.com/compatibility/android-cdd.html)).  We now know that it treats Opus encoded files just like Vorbis encoded files when the file extension is changed.  Heaven knows why Google dislikes the '.opus' extension.
Title: Re: Android 5 and 6 Opus support via .opus.ogg double filename extension
Post by: eahm on 2016-10-04 17:46:36
Of course there is no need to append but if you do you'll know which one is the Opus file, for example for comparisons.
Title: Re: Android 5 and 6 Opus support via .opus.ogg double filename extension
Post by: Porcus on 2018-07-10 14:40:05
I know the thread is old, but my question is kinda relevant (and I don't mind the neat workaround to be bumped):

A .opus file is still nothing but an .ogg file with a different file extension, right? If I change back and forth the file extension, there is no way to tell whether it was created as .opus or as .ogg?

(Everything assuming that the file has only one audio stream and that is of type Opus blah blah blah.)
Title: Re: Android 5 and 6 Opus support via .opus.ogg double filename extension
Post by: KozmoNaut on 2018-07-10 19:57:24
Ogg is the container format, originally used for the Vorbis coding format (hence "Ogg Vorbis"), but now also used for Opus (which should actually be "Ogg Opus").

So using the extension ".opus.ogg" describes the file format quite well.