diff --git a/src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java b/src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java index 32099f8a..e826e422 100644 --- a/src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java +++ b/src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java @@ -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 @@ -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; } diff --git a/src/test/java/net/bramp/ffmpeg/FFprobeTest.java b/src/test/java/net/bramp/ffmpeg/FFprobeTest.java index efe07d38..0c510432 100644 --- a/src/test/java/net/bramp/ffmpeg/FFprobeTest.java +++ b/src/test/java/net/bramp/ffmpeg/FFprobeTest.java @@ -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")); @@ -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 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()); + } } diff --git a/src/test/java/net/bramp/ffmpeg/fixtures/Samples.java b/src/test/java/net/bramp/ffmpeg/fixtures/Samples.java index 2c3fd70e..3b54c8c8 100644 --- a/src/test/java/net/bramp/ffmpeg/fixtures/Samples.java +++ b/src/test/java/net/bramp/ffmpeg/fixtures/Samples.java @@ -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; diff --git a/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-video_with_reserved_color_space.mp4 b/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-video_with_reserved_color_space.mp4 new file mode 100644 index 00000000..b577278a --- /dev/null +++ b/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-video_with_reserved_color_space.mp4 @@ -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]" + } + } + ] +} \ No newline at end of file diff --git a/src/test/resources/net/bramp/ffmpeg/samples/video_with_reserved_color_space.mp4 b/src/test/resources/net/bramp/ffmpeg/samples/video_with_reserved_color_space.mp4 new file mode 100644 index 00000000..555d94bb Binary files /dev/null and b/src/test/resources/net/bramp/ffmpeg/samples/video_with_reserved_color_space.mp4 differ