rosenbjerg / FFMpegCore

A .NET FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your C# applications
MIT License
1.62k stars 289 forks source link

Grabbing the Mastering Display MetaData - 4K #216

Open centuryx476 opened 3 years ago

centuryx476 commented 3 years ago

Hello, How can we integrate ffprobe to grab the "Mastering Display Metadata" I need this to automate 4K movies Can I pass a custom argument to ffprobe to grab it ?

Command that outputs to Json: ffprobe -hide_banner -loglevel warning -select_streams v -print_format json -show_frames -read_intervals "%+#1" -show_entries "frame=color_space,color_primaries,color_transfer,side_data_list,pix_fmt" -i "inputMovie"

Master Display Data

Source of Command: https://codecalamity.com/encoding-uhd-4k-hdr10-videos-with-ffmpeg/

centuryx476 commented 3 years ago

OK, I'm trying to add the below code but I keep getting System.IO.FileNotFoundException when trying to test. I do not know how to test it. LOL If I can get past this test errors I can continue to add the HDR values

Added this to "FFProbeAnalysis.cs" [JsonPropertyName("color_space")] // Added this public string ColorSpace { get; set; } = null!;

Added this to "VideoStream.cs" public string ColorSpace { get; internal set; } = null!;

centuryx476 commented 3 years ago

OK, I was able to get past the test errors. I was able to grab now the first piece of HDR10 data. I will work on the rest.

FirstHDR

Anyone know how to access the "side_data_list" ?

I was able to get "color_space, color_primaries, color_transfer"

rosenbjerg commented 3 years ago

Looks like you may need a completely custom ffmpeg command for this to work? Maybe it doesn't make sense to add these new Props to IMediaAnalysis, but instead some other model? I think supporting use-cases such as this one could be done more cleanly that way

centuryx476 commented 3 years ago

In the "Tags" variable you are using a Dictionary. Should we use the same for the "side_data_list" ?

rosenbjerg commented 2 years ago

Sorry for the (very) late delay. Yes, that would probably make the most sense