use of com.google.android.exoplayer2.transformer.Transformer in project ExoPlayer by google.
the class RepeatedTranscodeTransformationTest method repeatedTranscodeNoAudio_givesConsistentLengthOutput.
@Test
public void repeatedTranscodeNoAudio_givesConsistentLengthOutput() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
Matrix transformationMatrix = new Matrix();
transformationMatrix.postTranslate((float) 0.1, (float) 0.1);
Transformer transformer = new Transformer.Builder(context).setRemoveAudio(true).setTransformationRequest(new TransformationRequest.Builder().setVideoMimeType(MimeTypes.VIDEO_H265).setTransformationMatrix(transformationMatrix).build()).build();
Set<Long> differentOutputSizesBytes = new HashSet<>();
for (int i = 0; i < TRANSCODE_COUNT; i++) {
// Use a long video in case an error occurs a while after the start of the video.
AndroidTestUtil.TransformationResult result = runTransformer(context, /* testId= */
"repeatedTranscodeNoAudio_givesConsistentLengthOutput_" + i, transformer, AndroidTestUtil.REMOTE_MP4_10_SECONDS_URI_STRING, /* timeoutSeconds= */
120);
differentOutputSizesBytes.add(Assertions.checkNotNull(result.fileSizeBytes));
}
assertWithMessage("Different transcoding output sizes detected. Sizes: " + differentOutputSizesBytes).that(differentOutputSizesBytes.size()).isEqualTo(1);
}
use of com.google.android.exoplayer2.transformer.Transformer in project ExoPlayer by google.
the class SetTransformationMatrixTransformationTest method setTransformationMatrixTransform.
@Test
public void setTransformationMatrixTransform() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
Matrix transformationMatrix = new Matrix();
transformationMatrix.postTranslate(/* dx= */
.2f, /* dy= */
.1f);
Transformer transformer = new Transformer.Builder(context).setTransformationRequest(new TransformationRequest.Builder().setTransformationMatrix(transformationMatrix).build()).build();
runTransformer(context, /* testId= */
"setTransformationMatrixTransform", transformer, REMOTE_MP4_10_SECONDS_URI_STRING, /* timeoutSeconds= */
120);
}
use of com.google.android.exoplayer2.transformer.Transformer in project ExoPlayer by google.
the class TransformerEndToEndTest method videoTranscoding_completesWithConsistentFrameCount.
@Test
public void videoTranscoding_completesWithConsistentFrameCount() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
FrameCountingMuxer.Factory muxerFactory = new FrameCountingMuxer.Factory(new FrameworkMuxer.Factory());
Transformer transformer = new Transformer.Builder(context).setTransformationRequest(new TransformationRequest.Builder().setVideoMimeType(MimeTypes.VIDEO_H264).build()).setMuxerFactory(muxerFactory).build();
// Result of the following command:
// ffprobe -count_frames -select_streams v:0 -show_entries stream=nb_read_frames bear-vp9.webm
int expectedFrameCount = 82;
runTransformer(context, /* testId= */
"videoTranscoding_completesWithConsistentFrameCount", transformer, VP9_VIDEO_URI_STRING, /* timeoutSeconds= */
120);
FrameCountingMuxer frameCountingMuxer = checkNotNull(muxerFactory.getLastFrameCountingMuxerCreated());
assertThat(frameCountingMuxer.getFrameCount()).isEqualTo(expectedFrameCount);
}
use of com.google.android.exoplayer2.transformer.Transformer in project ExoPlayer by google.
the class SefTransformationTest method sefTransform.
@Test
public void sefTransform() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setTransformationRequest(new TransformationRequest.Builder().setFlattenForSlowMotion(true).build()).build();
runTransformer(context, /* testId = */
"sefTransform", transformer, SEF_ASSET_URI_STRING, /* timeoutSeconds= */
120);
}
use of com.google.android.exoplayer2.transformer.Transformer in project ExoPlayer by google.
the class TransformationTest method transform.
@Test
public void transform() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build();
runTransformer(context, /* testId= */
"transform", transformer, MP4_ASSET_URI_STRING, /* timeoutSeconds= */
120);
}
Aggregations