VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 2 of 2
Thread
  1. Member
    Join Date
    Nov 2018
    Location
    Moscow
    Search PM
    Hello, folks!

    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

    "BezierCurveData": {
    "Anchors": [
    256,
    512,
    767
    ],
    "KneePointX": 0,
    "KneePointY": 0
    },
    "DateTimeMetadataGenerated": "2018-11-15T11:04:31Z",
    "LuminanceParameters": {
    "AverageRGB": 581,
    "LuminanceDistributions": {
    "DistributionIndex": [
    1,
    5,
    10,
    25,
    50,
    75,
    90,
    95,
    99
    ],
    "DistributionValues": [
    0,
    14326,
    88,
    12,
    41,
    385,
    1483,
    2724,
    14230
    ]
    },
    "MaxScl": [
    0,
    0,
    0
    ]
    },
    "NumberOfWindows": 1,
    "SceneFrameIndex": 0,
    "SceneId": 0,
    "SequenceFrameIndex": 0,
    "TargetedSystemDisplayMaximumLuminance": 0
    }

    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)

    Many Thanks!
    Quote Quote  
  2. Member
    Join Date
    Nov 2018
    Location
    Moscow
    Search PM
    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.
    Quote Quote  



Similar Threads