Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public class FFmpegStream {
public int channels;
public String channel_layout;

public String color_range;
public String color_space;
public String color_transfer;
public String color_primaries;

public FFmpegDisposition disposition;

// TODO: Make Map immutable
Expand Down Expand Up @@ -214,6 +219,22 @@ public String getChannelLayout() {
return channel_layout;
}

public String getColorRange() {
return color_range;
}

public String getColorSpace() {
return color_space;
}

public String getColorTransfer() {
return color_transfer;
}

public String getColorPrimaries() {
return color_primaries;
}

public FFmpegDisposition getDisposition() {
return disposition;
}
Expand Down
16 changes: 16 additions & 0 deletions src/test/java/net/bramp/ffmpeg/FFprobeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public void before() throws IOException {
when(runFunc.run(argThatHasItem(Samples.big_buck_bunny_720p_1mb_with_packets_and_frames)))
.thenAnswer(new NewProcessAnswer("ffprobe-big_buck_bunny_720p_1mb_packets_and_frames.mp4"));

when(runFunc.run(argThatHasItem(Samples.video_with_reserved_color_space)))
.thenAnswer(new NewProcessAnswer("ffprobe-video_with_reserved_color_space.mp4"));

when(runFunc.run(argThatHasItem(Samples.side_data_list)))
.thenAnswer(new NewProcessAnswer("ffprobe-side_data_list"));

Expand Down Expand Up @@ -750,4 +753,17 @@ public void testFullFrameDeserialization() throws IOException {
assertEquals(6, frame.getChannels());
assertEquals("5.1", frame.getChannelLayout());
}

@Test
public void testReservedColorSpaceVideo() throws IOException {
FFprobeBuilder probeBuilder = ffprobe.builder().setShowStreams(true).setInput(Samples.video_with_reserved_color_space);
List<FFmpegStream> streams = ffprobe.probe(probeBuilder).getStreams();
assertEquals(1, streams.size());
FFmpegStream stream = streams.get(0);

assertEquals("tv", stream.getColorRange());
assertEquals("reserved", stream.getColorSpace());
assertEquals("arib-std-b67", stream.getColorTransfer());
assertEquals("bt2020", stream.getColorPrimaries());
}
}
2 changes: 2 additions & 0 deletions src/test/java/net/bramp/ffmpeg/fixtures/Samples.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ private Samples() {
public static final String base_big_buck_bunny_720p_1mb = "big_buck_bunny_720p_1mb.mp4";
public static final String base_testscreen_jpg = "testscreen.jpg";
public static final String base_test_mp3 = "test.mp3";
public static final String base_video_with_reserved_color_space = "video_with_reserved_color_space.mp4";

public static final String big_buck_bunny_720p_1mb = TEST_PREFIX + base_big_buck_bunny_720p_1mb;
public static final String testscreen_jpg = TEST_PREFIX + base_testscreen_jpg;
public static final String test_mp3 = TEST_PREFIX + base_test_mp3;
public static final String video_with_reserved_color_space = TEST_PREFIX + base_video_with_reserved_color_space;

private static final String book_m4b = "book_with_chapters.m4b";
public static final String book_with_chapters = TEST_PREFIX + book_m4b;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"streams": [
{
"index": 0,
"codec_name": "hevc",
"codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
"profile": "Main 10",
"codec_type": "video",
"codec_tag_string": "hvc1",
"codec_tag": "0x31637668",
"width": 1080,
"height": 1920,
"coded_width": 1088,
"coded_height": 1920,
"closed_captions": 0,
"film_grain": 0,
"has_b_frames": 3,
"pix_fmt": "yuv420p10le",
"level": 120,
"color_range": "tv",
"color_space": "reserved",
"color_transfer": "arib-std-b67",
"color_primaries": "bt2020",
"chroma_location": "left",
"refs": 1,
"id": "0x1",
"r_frame_rate": "30/1",
"avg_frame_rate": "181000/6033",
"time_base": "1/90000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 542970,
"duration": "6.033000",
"bit_rate": "11854362",
"nb_frames": "181",
"extradata_size": 155,
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0,
"captions": 0,
"descriptions": 0,
"metadata": 0,
"dependent": 0,
"still_image": 0
},
"tags": {
"creation_time": "2025-09-09T10:58:04.000000Z",
"language": "eng",
"handler_name": "VideoHandle",
"vendor_id": "[0][0][0][0]"
}
}
]
}
Binary file not shown.
Loading