Skip to content

Commit c233ce6

Browse files
authored
Allow to disable b-frames
1 parent c721dff commit c233ce6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

cloudinary-core/src/main/java/com/cloudinary/Transformation.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,9 @@ private static String processVideoCodecParam(Object param) {
923923
outParam.append(":").append(paramMap.get("profile"));
924924
if (paramMap.containsKey("level")) {
925925
outParam.append(":").append(paramMap.get("level"));
926+
if (paramMap.containsKey("b_frames") && paramMap.get("b_frames") == "false") {
927+
outParam.append(":").append("bframes_no");
928+
}
926929
}
927930
}
928931
}

cloudinary-core/src/test/java/com/cloudinary/test/CloudinaryTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,24 @@ public void testVideoCodec() {
879879
assertEquals(VIDEO_UPLOAD_PATH + "vc_h264:basic:3.1/video_id", actual);
880880
}
881881

882+
@Test
883+
public void testVideoCodecBFrameTrue() {
884+
String actual = cloudinary.url().resourceType("video")
885+
.transformation(
886+
new Transformation().videoCodec(asMap("codec", "h264", "profile", "basic", "level", "3.1", "b_frames", "true"))
887+
).generate("video_id");
888+
assertEquals(VIDEO_UPLOAD_PATH + "vc_h264:basic:3.1/video_id", actual);
889+
}
890+
891+
@Test
892+
public void testVideoCodecBFrameFalse() {
893+
String actual = cloudinary.url().resourceType("video")
894+
.transformation(
895+
new Transformation().videoCodec(asMap("codec", "h264", "profile", "basic", "level", "3.1", "b_frames", "false"))
896+
).generate("video_id");
897+
assertEquals(VIDEO_UPLOAD_PATH + "vc_h264:basic:3.1:bframes_no/video_id", actual);
898+
}
899+
882900
@Test
883901
public void testAudioCodec() {
884902
// should support a string value

0 commit comments

Comments
 (0)