Test: Add sequence effect test with bt601.
PiperOrigin-RevId: 608377195
This commit is contained in:
parent
e6facd6a7e
commit
9e352d5c27
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
BIN
libraries/test_data/src/test/assets/media/mp4/bt601.mov
Normal file
BIN
libraries/test_data/src/test/assets/media/mp4/bt601.mov
Normal file
Binary file not shown.
@ -88,6 +88,22 @@ public final class AndroidTestUtil {
|
||||
// ffprobe -count_frames -select_streams v:0 -show_entries stream=nb_read_frames sample.mp4
|
||||
public static final int MP4_ASSET_FRAME_COUNT = 30;
|
||||
|
||||
public static final String BT601_ASSET_URI_STRING = "asset:///media/mp4/bt601.mov";
|
||||
public static final Format BT601_ASSET_FORMAT =
|
||||
new Format.Builder()
|
||||
.setSampleMimeType(VIDEO_H264)
|
||||
.setWidth(640)
|
||||
.setHeight(428)
|
||||
.setFrameRate(29.97f)
|
||||
.setColorInfo(
|
||||
new ColorInfo.Builder()
|
||||
.setColorSpace(C.COLOR_SPACE_BT601)
|
||||
.setColorRange(C.COLOR_RANGE_LIMITED)
|
||||
.setColorTransfer(C.COLOR_TRANSFER_SDR)
|
||||
.build())
|
||||
.setCodecs("avc1.4D001E")
|
||||
.build();
|
||||
|
||||
public static final String MP4_PORTRAIT_ASSET_URI_STRING =
|
||||
"asset:///media/mp4/sample_portrait.mp4";
|
||||
public static final Format MP4_PORTRAIT_ASSET_FORMAT =
|
||||
|
@ -20,6 +20,8 @@ package androidx.media3.transformer;
|
||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||
import static androidx.media3.common.util.Util.SDK_INT;
|
||||
import static androidx.media3.test.utils.BitmapPixelTestUtil.readBitmap;
|
||||
import static androidx.media3.transformer.AndroidTestUtil.BT601_ASSET_FORMAT;
|
||||
import static androidx.media3.transformer.AndroidTestUtil.BT601_ASSET_URI_STRING;
|
||||
import static androidx.media3.transformer.AndroidTestUtil.JPG_ASSET_URI_STRING;
|
||||
import static androidx.media3.transformer.AndroidTestUtil.JPG_PORTRAIT_ASSET_URI_STRING;
|
||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_FORMAT;
|
||||
@ -221,6 +223,39 @@ public final class TransformerSequenceEffectTest {
|
||||
extractBitmapsFromVideo(context, checkNotNull(result.filePath)), testId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void export_withBt601AndBt709MediaItems() throws Exception {
|
||||
String testId = "export_withBt601AndBt709MediaItems";
|
||||
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
|
||||
context,
|
||||
testId,
|
||||
/* inputFormat= */ MP4_ASSET_FORMAT,
|
||||
/* outputFormat= */ MP4_ASSET_FORMAT)) {
|
||||
return;
|
||||
}
|
||||
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
|
||||
context, testId, /* inputFormat= */ BT601_ASSET_FORMAT, /* outputFormat= */ null)) {
|
||||
return;
|
||||
}
|
||||
Composition composition =
|
||||
createComposition(
|
||||
Presentation.createForHeight(EXPORT_HEIGHT),
|
||||
clippedVideo(
|
||||
BT601_ASSET_URI_STRING,
|
||||
ImmutableList.of(RgbFilter.createInvertedFilter()),
|
||||
SINGLE_30_FPS_VIDEO_FRAME_THRESHOLD_MS),
|
||||
clippedVideo(MP4_ASSET_URI_STRING, NO_EFFECT, SINGLE_30_FPS_VIDEO_FRAME_THRESHOLD_MS));
|
||||
|
||||
ExportTestResult result =
|
||||
new TransformerAndroidTestRunner.Builder(context, new Transformer.Builder(context).build())
|
||||
.build()
|
||||
.run(testId, composition);
|
||||
|
||||
assertThat(result.filePath).isNotNull();
|
||||
assertBitmapsMatchExpectedAndSave(
|
||||
extractBitmapsFromVideo(context, checkNotNull(result.filePath)), testId);
|
||||
}
|
||||
|
||||
private static OverlayEffect createOverlayEffect() throws IOException {
|
||||
return new OverlayEffect(
|
||||
ImmutableList.of(
|
||||
|
Loading…
x
Reference in New Issue
Block a user