Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File extension for downloaded Opus audios should be .ogg for Android 9 and below #8046

Open
5 tasks done
frak0d opened this issue Mar 16, 2022 · 18 comments
Open
5 tasks done
Labels
downloader Issue is related to the downloader feature request Issue is related to a feature in the app

Comments

@frak0d
Copy link
Contributor

frak0d commented Mar 16, 2022

Checklist

  • I am able to reproduce the bug with the latest version.
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.

Affected version

0.22.1

Steps to reproduce the bug

  1. Open any Video
  2. Tap on Download Button
  3. Select Audio Download in opus codec (any bitrate)

Expected behavior

Opus files should be downloaded with the .ogg file extension on Android 9 and below, since the support for recognising the .opus file extension was added in Android 10.

Actual behavior

File is downloaded with the .opus file extension on all OS versions, which is not recognised by many apps, including Android's MediaScanner.

Affected Android/Custom ROM version

Android 5, 6, 7, 8 and 9.

@frak0d frak0d added the bug Issue is related to a bug label Mar 16, 2022
@frak0d frak0d changed the title File extension for download audio in opus coded should be .ogg File extension for download audio in opus codec should be .ogg Mar 16, 2022
@frak0d frak0d changed the title File extension for download audio in opus codec should be .ogg File extension for downloaded audio in opus codec should be .ogg Mar 16, 2022
@triallax triallax added the downloader Issue is related to the downloader label Mar 16, 2022
@TacoTheDank
Copy link
Member

I don't think this is necessarily an issue with Opus as it is with Android support over different OS versions.

It would be good to consider what we would want the new behavior to be if this were to be changed. Would we want the audio to be saved as .ogg for Android 9 or lower, and be saved as .opus for Android 10 and above?

@frak0d
Copy link
Contributor Author

frak0d commented Mar 17, 2022

Just save with .ogg extension for all android versions because there is no such thing as a .opus file, opus is a codec. The file container is actually a ogg, so correct extension is .ogg

@opusforlife2
Copy link
Collaborator

Just save with .ogg extension for all android versions because there is no such thing as a .opus file, opus is a codec. The file container is actually a ogg, so correct extension is .ogg

@Tanishq-Banyal Your information is incorrect. You're mixing containers and file extensions: https://en.wikipedia.org/wiki/Opus_(audio_format)#cite_note-MIME-and-FileExt-1

Following that link: https://wiki.xiph.org/MIME_Types_and_File_Extensions#.opus_-_audio.2Fogg

So the codec is Opus, and the container format is indeed Ogg, but the "official" file extension is .opus. 3 different things.

As a much clearer example, look at MP4: https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions:

While the only filename extension defined by the standard is .mp4, various filename extensions are commonly used to indicate intended content


Coming to your issue:

which is not recognised by many apps including Android System itself

This is the bug you've reported. But LineageOS added support for the .opus file extension in Android 9 (LOS 16), the version you've mentioned! See https://review.lineageos.org/q/opus+extension

I've been storing and playing .opus files myself since LOS 16. If you use a file explorer app that supports showing .opus files, then you can play them just fine. Try using FX File Explorer and Vanilla Music. Both showed and played the files for me.

@opusforlife2
Copy link
Collaborator

Part 2 (the comment was getting too long):

Would we want the audio to be saved as .ogg for Android 9 or lower, and be saved as .opus for Android 10 and above?

@TacoTheDank Using the .ogg file extension will only work for Android 7, 8, and 9, because support for it was added in 7: https://en.wikipedia.org/wiki/Opus_(audio_format)#Operating_system_support

Reading that section further, if you want Android System to natively recognize and play Opus audios for Android 5 and 6, you will need the Matroska container with the Opus codec, which was the only combo supported for those versions. You could use the .mka file extension instead of .mkv to indicate audio content, but I don't know how many file explorers and audio players support that.


Extra info for the interested: Most audio players only care about the container format, not the file extension. That is more the domain of file explorer apps, to be able to identify file types and show them in the UI correctly. As proof, you can rename an Opus audio file downloaded from Newpipe to .opus, .ogg, and .oga, and it will play just fine each time (assuming your media player can recognise both: Opus the codec, and Ogg the container format. Try Poweramp, or Vanilla Music).

@frak0d
Copy link
Contributor Author

frak0d commented Mar 18, 2022

My music player (musicolet) does recognise .opus as well as .ogg, just my system file explorer (Android Documents UI) doesn't recognise .opus.

I am not affected much by this as I have a script running in background that renames any .opus file to .ogg in Music folder whenever a new .opus file is detected.

@opusforlife2
Copy link
Collaborator

Is your LOS 16 build older than the commits I linked to? That's the only reason I can think of why your system file explorer isn't recognising them.

I'm on LOS 17.1, and the system Files app shows the file type of .opus files as "OGA audio", and the MIME type as "audio/ogg".

@frak0d
Copy link
Contributor Author

frak0d commented Mar 18, 2022

I'm on LOS 17.1, and the system Files app shows the file type of .opus files as "OGA audio", and the MIME type as "audio/ogg".

I am on LOS 16.0, and system files app shows mime type "application/octet-stream" ie. binary file

But as I said earlier :-

I am not affected much by this as I have a script running in background that renames any .opus file to .ogg in Music folder whenever a new .opus file is detected.

@opusforlife2
Copy link
Collaborator

Okay. Then let's limit this issue to keeping .ogg for Android 9-, and .opus for Android 10+. This will be much easier than adding Matroska container support for Android 5 and 6.

@opusforlife2 opusforlife2 changed the title File extension for downloaded audio in opus codec should be .ogg File extension for downloaded Opus audios should be .ogg for Android 9 and below Mar 18, 2022
@opusforlife2 opusforlife2 added feature request Issue is related to a feature in the app and removed bug Issue is related to a bug labels Mar 18, 2022
@TacoTheDank
Copy link
Member

@TacoTheDank Using the .ogg file extension will only work for Android 7, 8, and 9, because support for it was added in 7: https://en.wikipedia.org/wiki/Opus_(audio_format)#Operating_system_support

Yep I'm aware, I just shortened it in my statement and assumed that people visiting this issue would read as such in the linked Wikipedia article. Maybe I should have clarified, lol.

@opusforlife2
Copy link
Collaborator

assumed that people visiting this issue would read

Now there's a super-optimistic person. xD

@Atemu
Copy link
Contributor

Atemu commented Mar 18, 2022

Quoting rfc7845:

The RECOMMENDED filename extension for Ogg Opus files is '.opus'.

As this is only a recommendation, I'd prefer to stick to ogg because OGG is a somewhat common audio container format that people know and the most widely used file extension for it is ogg, no matter the inner codec.

I'm also doubtful that the crappy music players people love to use can handle the opus extension well (despite Android 10) while I'd expect most of them to be able to handle ogg.

What do you think of an audio format option to save files as webm that gets enabled by default when the initial run happens on Android <7?
Default with that option off would be ogg.


OT: @opusforlife2's username checks out ;D

@opusforlife2
Copy link
Collaborator

I don't see why we should mislabel files because people use crappy/old music apps. Instead, this could nudge them toward using updated music apps that do recognise the .opus extension. Android 10 was released in 2019. Any competent music app developer should have added support for it after that point.

@Atemu
Copy link
Contributor

Atemu commented Mar 18, 2022

Instead, this could nudge them toward using updated music apps that do recognise the .opus extension.

While the idealist in me agrees, the realist sees people that are confused about weird audio formats their favourite music player can't and blame NewPipe for it.

Any competent music app developer should have added support for it after that point.

This implies competence among said developers which I don't think exists universally.

@opusforlife2
Copy link
Collaborator

I just searched, and we've never actually had anyone complain about not being able to play Opus files. (Disclaimer, there is one issue, but back then Newpipe's Opus support itself was broken.)

@frak0d
Copy link
Contributor Author

frak0d commented Mar 19, 2022

just let the user choose file extension in download settings

@opusforlife2
Copy link
Collaborator

We're always conservative about introducing additional options that need to be maintained. In this case, an option isn't needed at all, because the suggested defaults make sense:

.opus for 10+ and .ogg for 5-9.

@opusforlife2
Copy link
Collaborator

What does that mean, exactly? The discussion is open to anyone who wants to add anything. Apart from that, we need a PR to implement this.

@otonoton

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
downloader Issue is related to the downloader feature request Issue is related to a feature in the app
Projects
None yet
Development

No branches or pull requests

6 participants