jellyfin / jellyfin-androidtv

Android TV Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
2.87k stars 489 forks source link

AV1 with OPUS #1768

Closed gaalos closed 1 year ago

gaalos commented 2 years ago

Describe the bug

Read content with AV1 CODEC AND OPUS. The movie is laggy.

No issues on android smartphones or Firefox No issues when playing VP9 with OPUS codec Tested on Shield and chromecast with google tv Looks like android TV bug

Link for sources video used for testing

Logs

No response

Application version

0.13.6

Where did you install the app from?

Google Play

Device information

Nvidia shield, chromecast with google tv

Android version

Android 9

Jellyfin server version

10.7.7

acedogblast commented 2 years ago

I am also having lag and very low fps on my Sony Xr-X90J which supports hardware decoding of AV1 video. I think the player is using software decoding rather than the hardware.

acedogblast commented 2 years ago

The problem may be with libVLC as using ExoPlayer results in a trans-code as it does not support AV1.

philhoefer commented 2 years ago

I have the same problem with a Xiaomi TV Stick 4K. I'd try to fix this myself but I don't think I will have the time before october. Is there any way to help speed this up? I'd give 10€ to whoever solves this.

acedogblast commented 2 years ago

I have a workaround. Install vlc for android as a separate app and set it as the external video player in jellyfin. This also fixes 4k hdr playback without having to transcode.

gaalos commented 2 years ago

@acedogblast same for me.

jellyfin-bot commented 1 year ago

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

gaalos commented 1 year ago

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

This issue still affects the last release

EliasGagnef commented 1 year ago

Exact same issue here:

Server is on the latest 10.8.8, on my Google TV a movie with AV1 and Opus does not play at all with MXPlayer, and only audio plays on LibVLC (nothing with external players)

Same issue occurs on Samsung Tab A8 (2022), however the movie plays as intended on Google Pixel 6a

I suspect that the server isn't actually transcoding the AV1 video, since my Tab A8 (2022) says that it is using "Direct Play", I researched this a little and the Pixel 6a's Tensor chip actually does support the AV1 codec, so even if the server isn't transcoding the video on there it should work on the 6a

TLDR: maybe the servers AV1 transcoding doesn't work?

gaalos commented 1 year ago

@EliasGagnef Thx for your reply The goal is to not transcode because AV1 powerfull codec :) done for streaming ;) Cur

EliasGagnef commented 1 year ago

@gaalos No problems, just ran into the same issue myself :)

Aah gotcha that makes sense, though if the client doesn't support AV1 shouldn't the last resort be to transcode it anyway?

In the future I will just avoid AV1 when possible, thank you for making this post so I knew what to look for :D

ArceyTheSecond commented 1 year ago

This issue seems to still persist, can confirm here (Nvidia Shield laggy, plays normally on browser)

mhdevop commented 1 year ago

Adding myself to track this issue. I can confirm that ExoPlayer just has a black screen but audio is playing (although title is OPUS I'm using AAC). If I chose an "external player" like MXPlayer/Nova then it plays perfectly but at the expense of not "tracking" progress while watching. (It seems like "Just Player" is the only "external" app that does somehow sync the progress as a crude workaround)

VampiricAlien commented 1 year ago

I asked an AI bot about this:

To add AV1 and Opus support to Jellyfin Android TV, you will need to modify the code to include the necessary libraries and codecs. Here are the general steps you can follow:

Here is some sample code that you can use as a starting point:


// Add the AV1 and Opus dependencies to the build.gradle file
dependencies {
    implementation 'com.google.android.exoplayer:exoplayer-core:2.15.1'
    implementation 'com.google.android.exoplayer:exoplayer-ui:2.15.1'
    implementation 'com.google.android.exoplayer:extension-av1:2.15.1'
    implementation 'com.google.android.exoplayer:extension-opus:2.15.1'
}

// Modify the media player to support AV1 and Opus
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
MediaItem mediaItem = new MediaItem.Builder()
    .setUri(uri)
    .setMimeType(MimeTypes.VIDEO_AV1)
    .build();
player.setMediaItem(mediaItem);
player.prepare();

// Test the changes to ensure that AV1 and Opus are working correctly
player.addListener(new Player.Listener() {
    @Override
    public void onPlaybackStateChanged(int playbackState) {
        if (playbackState == Player.STATE_READY) {
            Log.d(TAG, "AV1 and Opus playback is working correctly");
        }
    }
});

Note that this is just sample code and you will need to modify it to fit your specific use case. Additionally, you may need to modify other parts of the code to fully support AV1 and Opus.

@nielsvanvelzen Not trying to replace you, Your blood, sweat and tears will always be apart of Jellyfin, I just want to know what you think about the AI code?

nielsvanvelzen commented 1 year ago

Not trying to replace you, Your blood, sweat and tears will always be apart of Jellyfin, I just want to know what you think about the AI code?

While I agree that AI can help with development, you cannot have it make everything for you. The response you got is basically just ExoPlayer documentation and you can't just use this as-is.

VampiricAlien commented 1 year ago

I had my suspicions about this, TBH I trust you over AI.

Even though I mentioned Jellyfin Android TV, it failed to see that the code is being rewritten in kotlin and moving away from Exoplayer to the new media3 system. I was hopping it would help and not get in the way, sorry about that.

jellyfin-bot commented 1 year ago

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

shimulroy842 commented 4 months ago

Any solution? I am using google chromecast 4k and the problem still persist.