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

Multiple input files #428

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

Multiple input files #428

wants to merge 2 commits into from

Conversation

brabebhin
Copy link
Collaborator

@brabebhin brabebhin commented May 13, 2024

Hello @lukasf

I've been playing around with a new feature: add multiple input files to the FFmpegMediaSource. This PR showcases a working prototype.

Some notes and open questions:

  1. It is not possible to add the extra streams during playback (unfortunately). I realize that it should be impossible to add external subs this way, if we are to ever implement subs through winRT APIs we need to keep this in mind.
  2. How do we handle files that have different media durations? at this point I do not update the overall length of the MediaStreamSource when a longer file is added, so the automatic increment kicks in.
  3. It appears that syncing the multiple ffmpegreaders in the onStarting event is enough to keep them in sync (the event happens when stream switching and when playback starts / resumes)
  4. Metadata tags will have to be merged / handled somehow
  5. We need an additional property in StreamInfos so that consumers know which IO context they belong to (I am thinking some sort of user provided key and we can also group metadata by that key)
  6. Fast seeking will not work on ffmpeg readers that do not have an active video stream. This will eventually be fixed, not a big deal atm.
  7. Probably weird bugs hidden in the bushes.
  8. This PR is based on the ffmpeg 6 / 7 branch
  9. Feedback is welcome :)

@lukasf
Copy link
Member

lukasf commented Jun 7, 2024

Interesting solution. I had a prototype implementation of this years back. I used a different approach: I just created additional "child" instances of the FFmpegMediaSource. In the main instance's OnSampleRequested, if the requested stream was not found in the current source, I'd search any child sources for the stream and call their SampleRequested method. The upside was that the required amount of changes was pretty small (ofc, that does not neccessarily mean that it is the better approach).

@brabebhin
Copy link
Collaborator Author

Hmm interesting, I haven't thought of that, but it makes sense. Yes it should be a smaller changeset, and that should also make it easier to handle.

Base automatically changed from ffmpeg-6.1 to winui-build June 16, 2024 19:32
Base automatically changed from winui-build to master September 7, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants