I need to write CLI application for checking HDR10 metadata in input video .mp4 file in hevc codec.
On input it has video file and HDR10 metadata in json format.
First of all need to check is it(video) has generated values for example such as
I want to use x265 library for this. My idea is to use this api function from x265.h:
int x265_encoder_encode(x265_encoder *encoder, x265_nal **pp_nal, uint32_t *pi_nal, x265_picture *pic_in, x265_picture *pic_out)
It has pic_in and pic_out pointers. If I can compare input and output frames from pic_in and pic_out objects respectively, then I can tell next:
if input video frame parameters HDR10 metadata == generated output frame HDR10 metadata, then input video file really has metadata
if input video frame parameters HDR10 metadata != generated output frame HDR10 metadata, then there is no metadata.
I saw source code for x265, well I know what pic_in depends on Frame* frame, Frame* frame in its turn depends on Slice* slice when users metadata posting calculation goes,
and posting metadata links on compressFrame() in frameencoder.cpp.
Unfortunately, I'dont know many things yet about how x265 encoding format works.
Can you tell me some hints about which types of x265.h api structure data I can use to get this things without a lot of painless work??
And if you have idea how get this mission works more easy way I'll be very gratefull to you for any shared information!!
Or maybe if you know about instruments(with open source code I mean) which can get json metadata from video, please let me know)
+ Reply to Thread
Results 1 to 2 of 2
Okay, I founded answer by myself. In x265 generation metadata runs with toneMap array values. In x265.cpp has m_cim pointer on frame array metadata from which when encoder starts his work generated metadata values pasts to input bitstream. You can create array of generated values and check videofile byte by byte and found exactly same numbers metadata insertion accordingly with 'SceneFrameNumbers' value in json file. If you know reverse alghoritm you can get initual metadata values frame by frame from binary videofile.