Mp4Composer-android icon indicating copy to clipboard operation
Mp4Composer-android copied to clipboard

Missing trim in RemixAudioComposer

Open Roberto7588 opened this issue 4 years ago • 0 comments

When using the option to Trim, some videos are processed incorrectly and show a static frame for the duration of the not trimmed audio. This happens because the class RemixAudioComposer does not trim audio at all. The functionality is incomplete. In this class the variables trimStartUs, trimEndUs, addPrimingDelay, frameCounter and primingDelay are doing nothing.

As a workaround I'm doing next in the RemixAudioComposer, but I'm not sure if is a terrible solution:

if (muxCount == 1){
	boolean write = (bufferInfo.presentationTimeUs >= trimStartUs)
			&& ((bufferInfo.presentationTimeUs <= trimEndUs) || (trimEndUs <= 0L));

	if (write){
		muxer.writeSampleData(SAMPLE_TYPE, encoder.getOutputBuffer(result), bufferInfo);
	}
}

Roberto7588 avatar Jan 24 '20 01:01 Roberto7588