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

Feature: Support MultiTrack Audio #199

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

monyone
Copy link
Collaborator

@monyone monyone commented Jun 22, 2024

Support MultiTrack Audio.

  • selectAudioTrack in MSEPlayer
    • Support FLV (eFLV v2) and MPEG-TS
    • Live Seamless Codec switching

@xqq
Copy link
Owner

xqq commented Jun 22, 2024

Thank you very much for your great work!

There's a background that, the feature of switching between multiple audio tracks has also been necessary in KonomiTV. It is an important feature provided in KonomiTV until now, but it has still not been merged or implemented here due to the difficulty of how to design the interface of audio switching. A careful API design becomes necessary which will be provided to the user eventually.
#21
tsukumijima@a0fd4c6

It could be better to provide a consistent interface in MSEPlayer for the user to switch between multiple audio tracks, which should work both for eFLV and MPEG-TS of course.

It should also be better to provide an interface to let the user know or be able to query how much the audio tracks exist inside the input stream, also with some extra information like the codec/profile/samplingRate/bitrate(if known) of each audio track, etc. Then the user could switch to a specific audio track by calling some switching method by providing a reliable audio track index.

BTW, in tsukumijima's fork, the audio track switching is seamless and nearly real-time, which can switch very fast without interrupting the playback, and it didn't do the unload and then load again which is unnecessary and will cause a bad experience.

@xqq
Copy link
Owner

xqq commented Jun 22, 2024

I believe there could be some cases of switching audio tracks between different audio codecs. This is still impossible in the current version of mpegts.js.

The latest specification (and most implementations) of Media Source Extensions has support SourceBuffer.changeType(). In order to support it, firstly I have to refactor the MSEController.

@monyone
Copy link
Collaborator Author

monyone commented Jun 22, 2024

@xqq Thank you for your response and feedback!
Seamless codec switching more interesting, I wish to support it.
(but, I'll leave it to you if you want to implement)

And, FLV for VOD, sequence header does not send regularly, only first time, I think.
So, I would like to implement initialization segment cache for each sequence header.

@monyone monyone marked this pull request as draft June 22, 2024 10:33
@monyone
Copy link
Collaborator Author

monyone commented Jun 22, 2024

If FLV(VOD) and reached endOfStream, such case reconnect http stream and fetch data.
In worst case (use default loader), reloading and dynamic codec switching are same behavior.

I think that needs different implementation for live or not.

@monyone monyone changed the title Feature: Support MultiTrack Audio in FLV (eFLV v2) Feature: Support MultiTrack Audio Jun 23, 2024
@monyone monyone marked this pull request as ready for review June 23, 2024 02:11
@monyone
Copy link
Collaborator Author

monyone commented Jun 23, 2024

@xqq MPEG-TS multitrack support and ChangeType for MSE are implemented, please see it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants