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

[VLCKit/Swiftfin Player] Audio track index incorrect during transcode #926

Open
holow29 opened this issue Nov 19, 2023 · 3 comments
Open
Labels
bug Something isn't working

Comments

@holow29
Copy link
Contributor

holow29 commented Nov 19, 2023

Describe the bug

During transcoding/DirectStreaming using VLCKit/Swiftfin player, selected audio track index will be incorrect, causing no audio to play by default. To get audio to play, it appears that the next track in the index needs to be selected. The server is only sending the one track to begin with.

For example, say a file has two audio tracks: x, y.
The track selection will list: none, x, y.
Currently, 'none' will be selected by default graphically while selected track index sent to the server will indicate 'x'. Server will transcode 'x' and send that back to client. Client appears to have something other than 'x' selected, though, causing no audio to play. To get audio, 'y' needs to be selected graphically and this will actually play the transcoded 'x'.

A workaround for now is here: sy6sy2@029af18 VideoPlayerViewModel.swift changes seem to allow audio to play by default, but I am not sure the implications for DirectPlay.

Might be related to #771

Application version

main eb17300

Where did you install the app from?

None

Device information

Multiple simulators and devices

OS version

iOS 16/17, tvOS 16/17

Jellyfin server version

380c367

@holow29 holow29 added the bug Something isn't working label Nov 19, 2023
@LePips
Copy link
Member

LePips commented Nov 19, 2023

Yep, this is the issue that's causing the "no audio/wrong audio track", however I've also seen it on instances of direct play.

@holow29
Copy link
Contributor Author

holow29 commented Nov 19, 2023

Doing some basic investigation on this: during transcoding, when VLCUI is building the audioTrackIndex in VLCMediaPlayerExtensions.swift Line 84, 'indexes' array seems to be

{[index: -1,...],
[index: 2,...]}

The question is why this is happening and how to solve for it. The expected behavior in a certain sense would be for audioTrackIndexes to look like:

{[index: -1,...],
[index: 1,...],
[index: 2,...],
etc.}

It might have something to do with the HLS playlist. For transcoding in particular, we might just expect

{[index: -1,...],
[index: 1,...]} 

since Jellyfin is only sending 1 audio track; at some point, there should be some way to deal with switching audio tracks during a transcode, but I am not sure there has been any effort for that yet. It might be pertinent to think of that when looking at solutions to this issue, though, because both efforts might involve an abstraction layer (which might already exist with the proxy - I am not sure what the proxy actually does).

-1 is the disabled state for audio, which is what we are getting by default now. We want track with index 1, but it incorrectly appears with index 2 in the array. Therefore, when it searches for track with index 1 (passed with AudioStreamIndex during VLC configuration or with track change button), nothing is found and it returns index -1 so no audio.

I haven't seen this behavior with DirectPlay; the index appears to have all the tracks. It would be interesting to see how this behaves during remuxing.

@holow29 holow29 changed the title [VLCKit/Swiftfin Player] Audio stream index (?) incorrect during transcode [VLCKit/Swiftfin Player] Audio track index incorrect during transcode Nov 20, 2023
@84480138

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants