HydrogenAudio

Lossy Audio Compression => Opus => Topic started by: Klimis on 2018-06-02 20:29:43

Title: OPUS not working on Android 6.0+ phone.
Post by: Klimis on 2018-06-02 20:29:43
It looks like there is something odd with the implementation or I am doing something wrong.

This thread says that after changing the extension from .opus to .ogg Google Music player seems to play OPUS files without any problem.
https://hydrogenaud.io/index.php/topic,112798.0.html

I just tried to do the same on a Samsung Galaxy S7 running Nougat (7.0) and while the track now appears on the player, pressing play results in silence.

Did something between 2016 (that the thread was created) and now changed on the encoder that broke native Android support on Android or it's an issue that I'm the only one encountering?
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: eevan on 2018-06-02 21:44:05
I have just tried to replicate your problem on my S7 Edge running stock Nougat 7.0 and renamed opus file played fine in Google Play music and Samsung's player.

Title: Re: OPUS not working on Android 6.0+ phone.
Post by: Klimis on 2018-06-02 22:36:17
I'm having a feeling there is something wrong with some settings I use or something that puts off the decoder.

EDIT: I found the issue. I guess I just found a bug. Setting --framesize to 60 results into this issue. Setting it to 2.5, 5, 10, 20, 40, seems to work.
I would like to know is this issue is with the encoder or the decoder so I could report this bug on the correct place.

Google claims that their decoder is based on libopus 1.2.1
I don't know if back then it was a known problem that got fixed since then or framesize 60 was simply not supported yet.
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: sveakul on 2018-06-03 03:26:40
From the OpusFAQ:

"A 20ms frame size works well for most applications. Smaller frame sizes may be used to achieve lower latency, but have lower quality at a given bitrate.
Sizes greater than 20 ms increase latency and are generally beneficial only at fairly low bitrates, or when used to reduce external overhead (e.g. by reducing the number of packets that are sent). For file encoding, using a frame size larger than 20 ms will usually result in worse quality for the same bitrate because it constrains the encoder in the decisions it can make. "

The default (i.e. not specified) framesize is 20ms when using opusenc.exe.  Did you encode your own Opus files or get them from a third party?  If the latter, it would be a good idea to let them know this.
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: Klimis on 2018-06-03 11:38:25
I encoded them myself using the --framesize 60 parameter. If I encode files with any other compatible value but 60 it works. Files with a framesize of 60 though upset Android's native decoder. Considering that Android' s native decoder is based on libopus 1.2.1 I think it wouldn't hurt if I'd report this bug over here.
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: 2012 on 2018-06-03 14:47:54
Confirmed in LOS 14.1. OGG opus files with framesize=60 fail to play.

if you have to use  --framesize 60, you can remux to mka or use other players like vlc.
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: Klimis on 2018-06-03 17:12:32
Confirmed in LOS 14.1. OGG opus files with framesize=60 fail to play.

if you have to use  --framesize 60, you can remux to mka or use other players like vlc.
This is not what I want to do though.
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: 2012 on 2018-06-03 17:24:09
Confirmed in LOS 14.1. OGG opus files with framesize=60 fail to play.

if you have to use  --framesize 60, you can remux to mka or use other players like vlc.
This is not what I want to do though.

At what bitrate are you encoding your files?
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: sveakul on 2018-06-03 17:37:24
I encoded them myself using the --framesize 60 parameter. If I encode files with any other compatible value but 60 it works. Files with a framesize of 60 though upset Android's native decoder. Considering that Android' s native decoder is based on libopus 1.2.1 I think it wouldn't hurt if I'd report this bug over here.

I guess what I don't understand is why you chose that framesize over the recommended, default one.  Were you trying to make them compatible with some non-Android device that would not decode the default framesize?
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: Klimis on 2018-06-03 17:49:31
At what bitrate are you encoding your files?
Does it matter? The bug is happening whatever the bitrate.
I guess what I don't understand is why you chose that framesize over the recommended, default one.  Were you trying to make them compatible with some non-Android device that would not decode the default framesize?
No, it was mostly a test for lower bitrates.
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: 2012 on 2018-06-05 01:54:47
At what bitrate are you encoding your files?
Does it matter? The bug is happening whatever the bitrate.

I'm asking because there is no reason to use --framesize 60 unless you're encoding at a very very low bitrate and trying to save every last bit.
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: Klimis on 2018-06-05 14:50:03
At what bitrate are you encoding your files?
Does it matter? The bug is happening whatever the bitrate.

I'm asking because there is no reason to use --framesize 60 unless you're encoding at a very very low bitrate and trying to save every last bit.
True but when it makes sense to use it, it still doesn't work. Remember this is a bug report. It supposed to bring up the fact that using that parameter it creates files that are not working on Android when they should, not whether I should or not use that parameter. My guess is that either the encoder creates a somewhat flawed stream that most decoders tolerate it but Android doesn't or simply Android's decoder simply sucks. Heh!
Title: Re: OPUS not working on Android 6.0+ phone.
Post by: 2012 on 2018-06-05 21:06:43
Quote
Remember this is a bug report.

Then you should report it here:
https://issuetracker.google.com/issues/new?component=190923&template=841312

The file generated by adb bugreport will include a backtrace that should be useful (you can see it with logcat).