select first appropriate stream index by default #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #6
Please test out this new approach to
AudioTrack.from
. Once we are looking good I will merge & cut a new release.Note: This is not a breaking change; the original way of
AudioTrack.from(source, { streamIndex: 0})
should still work as expected. in order to select the correctstreamIndex
automatically (without specifyingopts.streamIndex
), you need to give the results ofsource.probe
as anopts
argument inAudioTrack.from()
. See the following example:This particular source video file is unique in that it puts the audio track in index
0
, while the video track lives in index1
. This is the opposite of what the standard suggests, so very few videos are authored in this manner. This makes it a good testing grounds. Even thoughAudioTrack.DEFAULT_STREAM_INDEX == 1
, it still chooses the correct index.