Shuttle
Shuttle copied to clipboard
Opus Support
Shuttle Version : Dev and store Device: Pixel XL 7.1.1 Description: The app doesn't show any .opus files (http://opus-codec.org/). These files are in the ogg format but have a different extension. As far as I know, the Android platform has supported the codec since 5.0. Steps: Add any .opus file to the devices Music directory. Open app. Expected: The opus file would be an item in any list Outcome: The file is not in any list
I'm interested in contributing so I'll start looking into what needs to be added for this but I'm making this issue to keep track of this feature.
I use x-opus+ogg files for my library. Rhythmbox sync works around this issue by naming all copied files .ogg, but they're not reencoded so treating them as ogg should work fine.
Since the PR doesn't seem to work as intended, here might be some more info:
https://code.google.com/p/android/issues/detail?id=80729
I think this might have to be part of the plans @timusus makes for weaning off MediaStore as he mentioned in the readme.
As far as I know, the Android platform has supported the codec since 5.0.
No, Opus files are not yet supported. Google claimed to add support in Lollipop. They made some very minor changes, but AFAIK, they never actually added support - the MediaScanner doesn't add Opus to the MediaStore and the MediaPlayer doesn't play Opus.
I actually managed to get Opus working.
Device: Google Pixel, running Android 7.1.1
Files: The result of running ffmpeg -i <input> -c:a libopus -b:a 192k -vn -y <output>.opus.ogg
I found however that ffmpeg, which I suspect most people are using, by default transcodes the album art as a Theora video stream. When album art is present, the file fails to play, when the album art is omitted (the -vn argument), the album is added to MediaStore and Shuttle is able to read its metadata and play it (and Shuttle also somehow gets album art?).
While I find this interesting, none of it is relevant to Shuttle's ability to play Opus files. Either Google actually add support for Opus via the MediaScanner, MediaStore and MediaPlayer, or Shuttle replaces these with custom/3rd party components.
What I'm saying is that Shuttle is currently able to play Opus files. Google has added support for Opus via the MediaScanner, MediaStore and MediaPlayer.
I currently have ~3000 Opus files on my phone, running stock Android. Shuttle has added them all to its internal library and I'm able to view and play them inside Shuttle, as if they were any other format.
It appears that support for Opus in an Ogg container was added specifically in Android 7.0:
- CDD for 6.0 only requires that Opus be supported in a Matroska container.
- CDD for 7.0 requires that Opus be supported in both Ogg and Matroska containers.
@bobobo1618 right, well that is good to know.
As far as this issue is concerned though - Shuttle supports Opus only as far as Android does, which is in a very limited fashion at the moment. Very savvy users might be able to encode their files using the appropriate container.
The only solutions I know of to fully support Opus are:
- Android adds support natively
- Shuttle moves to a 3rd party playback engine.
@Daykm: Can you try renaming your files to "*.ogg"? That worked for me, no reencoding necessary.
Very savvy users might be able to encode their files using the appropriate container.
As far as I'm aware, Ogg is the only appropriate container. It's the container used by ffmpeg and opusenc when the .opus file extension is selected as well as the one that there's a spec for. There shouldn't be an encoder that outputs it as anything else (unless you're encoding video) so there shouldn't be any particularly hard work other than to make sure there's not a video stream (from embedded album art) and using the .ogg extension.
I actually did some more testing and it seems that Android's fine with there being a video stream in some circumstances.
So the problems remaining as far as I'm aware are:
- Support Opus on Android < 7.0.
- Support Opus files with the
.opusfile extension. - Support Opus files with album art erroneously transcoded as a video stream (the Ogg spec has provisions for album art as metadata), though I'd really treat this as as a problem with the encoder rather than the player. I'm still not certain what exactly causes it to fail in some cases.
The first certainly requires a 3rd party playback engine but I'm curious whether there's a way to hack around the second by writing your own scanner (and keeping Android's playback API) and the last by perhaps remuxing before sending to Android's playback API.
This is a lot of effort just to keep Android's playback API but I believe some devices, particularly on the lower end, have hardware audio decoders and I fear switching to software decode may negatively impact them.
I suggest to comment on or try to get these PRs merged: https://android-review.googlesource.com/q/owner:aykevanlaethem%2540gmail.com
If enough people make comments on the issue they will be forced sooner or later to merge it, they're ignoring it because they don't really care that much and most people don't even know what Opus is, hence they get currently away with it. It's such a small issue and the PR is already open almost a year, that says a lot about the state of Google.
I'm using a Pixel 3 with Android 9 (so way past the 6.0/7.0 minimum) and I think I ran into a regression in Shuttle, but maybe more likely - MediaStore.
Currently Shuffle fails to import my library at all (mostly ogg opus made with opusenc --bitrate 96 --discard-pictures $INPUT $OUTPUT.ogg but there is a couple MP3s in there as well.)
As you can see the files are all "null" (ignore the playing song for a second)
Interacting with them does nothing and forcing a rescan doesn't seem to work.
I've tested in VLC (i.e. not using MediaStore AFAIK) and it plays the files fine. (albeit it doesn't like my preference for Album_Artist vs. Artist)
I also tested in Phonograph which also uses MediaStore and has this bug (not adding the files to the database), but it's file viewer does not display them as "null".
If I select "scan" from the overflow menu, it actually gets added to the database allowing me to play the file in Phonograph and Shuffle - as shown in the first screenshot
Does anyone else have this strange bug?
I'd also just like to point out the fact MediaStore (No fault of Shuttle, Phonograph, etc.) still has these strange bugs is really annoying
@timusus Has Android 10 improved in this regard?