Skip to content

Adjust sample timestamps in MergingMediaPeriod for periods with different timestamp ranges #6103

@brAzzi64

Description

@brAzzi64

Hi,

I have 3 video segments A, B, C with audio. I'd like to play them in sequence, while a different audio-only track plays seamlessly on top of the overall video (I want to discard the original audio of the video segments).

Is there a way to achieve this using ExoPlayer 2?

The documentation for MergingMediaSource states "The Timelines of the sources being merged must have the same number of periods", and I believe this poses a problem with taking the following approach:

a = ExtractorMediaSource(A-video-and-audio-source)
b = ExtractorMediaSource(B-video-and-audio-source)
c = ExtractorMediaSource(C-video-and-audio-source)
x = ExtractorMediaSource(X-audio-only-source)
overallSource = MergingMediaSource(ConcatenatingMediaSource(a, b ,c), x)

Is there a different approach that you think could work?

Do you think replacing the audio source by something like:

x = ConcatenatingMediaSource(ClippingMediaSource(X[0,1]), ClippingMediaSource(X[1,2]), ClippingMediaSource(X[2,3])))

where each ClippingMediaSource grabs a sequential segment of the original X-audio-only-source, should produce accurate results without any noticeable audio clipping?

Appreciate any guidance!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions