Skip to content

audio passtrough not working

Context

I'm using Jellyfin-AndroidTV that uses the LibVLC library. I'm having trouble playing surround sound. All types of surround sound are played as stereo instead of surround.

In jellyfin the mediaplayer is setup like this:

            // Create a new media player
            ArrayList<String> options = new ArrayList<>(20);
            options.add("--network-caching=" + buffer);
            options.add("--audio-time-stretch");
            options.add("--avcodec-skiploopfilter");
            options.add("1");
            options.add("--avcodec-skip-frame");
            options.add("0");
            options.add("--avcodec-skip-idct");
            options.add("0");
            options.add("--android-display-chroma");
            options.add("RV32");
            options.add("--audio-resampler");
            options.add("soxr");
            options.add("--stats");
            if (isInterlaced) {
                options.add("--video-filter=deinterlace");
                options.add("--deinterlace-mode=Bob");
            }
            options.add("--audio-desync");
            options.add(String.valueOf(KoinJavaComponent.<UserPreferences>get(UserPreferences.class).get(UserPreferences.Companion.getLibVLCAudioDelay())));
            options.add("-v");
            options.add("--vout=android-opaque,android-display");

            mLibVLC = new LibVLC(mActivity, options);
            Timber.i("Network buffer set to %d", buffer);

            mVlcPlayer = new MediaPlayer(mLibVLC);
            setVlcAudioOptions(); #This method sets the audio options > see setVlcAudioOptions below.

            mSurfaceHolder.addCallback(mSurfaceCallback);
            mVlcPlayer.setEventListener(mVlcHandler);

            //setup surface
            mVlcPlayer.getVLCVout().detachViews();
            mVlcPlayer.getVLCVout().setVideoView(mSurfaceView);
            mVlcPlayer.getVLCVout().setSubtitlesView(mSubtitlesSurface);
            mVlcPlayer.getVLCVout().attachViews(this);

The audio config for direct audio in Jellyfin uses the 'setCompatibleAudio' method mode (passtrough) is:

    private void setVlcAudioOptions() {
        if (!Utils.downMixAudio(mActivity)) {
            mVlcPlayer.setAudioDigitalOutputEnabled(true);
        } else {
           setCompatibleAudio();
        }
    }

    public void setCompatibleAudio() {
        if (!nativeMode) {
            mVlcPlayer.setAudioOutput("opensles_android");
            mVlcPlayer.setAudioOutputDevice("hdmi");
        }
    }

I tried commenting this line mVlcPlayer.setAudioOutput("opensles_android"); but it doesn't make a difference. I hope you maybe have some insight in what possibly is going wrong. With Exoplayer (another integrated player in jellyfin) surround works like it should. But vlc handles h265 encoding much better, so that why I like to solve this :)

App version

LibVLC 3.5.1

Android version

12.0

Device model

Google TV 4K TV

Auto

Edited by FerronN