MeiCam SDK For iOS  3.10.0
HDR

HDR

HDR related instructions:

Meishe SDK supports the import, edit and export of HDR video, that is, the whole process of HDR video processing. Compared with ordinary SDR video processing, special settings are required in the following steps:

Initialize SDK, create timeline, set liveWindow display, export HDR.

Get native HDR support capabilities:

The HDR support capability of the machine can be obtained through the getEngineHDRCaps() interface on the NvsStreamingContext class. The meaning of the return value is as follows:

/*! \anchor  NvsHDRCapabilityFlag */
/*!
*  \if ENGLISH
*   @name HDR capability flags
*  \else
*   
*  \endif
*/
typedef enum {
    NvsHDRCapabilityFlagSupportedByImporter = 1,      //!< \if ENGLISH Support importing HDR video  \else  \endif
    NvsHDRCapabilityFlagSupportedByEditing = 2,       //!< \if ENGLISH Editing Support HDR  \else  \endif
    NvsHDRCapabilityFlagSupportedByExporter = 4,      //!< \if ENGLISH Support exporting HDR video  \else  \endif
    NvsHDRCapabilityFlagSupportedByLivewindow = 8,    //!< \if ENGLISH Livewindow support HDR \else  \endif
}NvsHDRCapabilityFlag;

1、Create timeline:

To create a timeline, you need to call the method:

- (NvsTimeline *)createTimeline:(NvsVideoResolution *)videoEditRes videoFps:(NvsRational *)videoFps audioEditRes:(NvsAudioResolution *)audioEditRes bitDepth:(NvsVideoResolutionBitDepth)depth flags:(int)flags;

When creating a timeline, you need to specify the bitDepth attribute of NvsVideoResolution, which has 3 parameters:

typedef enum NvsVideoResolutionBitDepth{
    NvsVideoResolutionBitDepth_8Bit,            //!< \if ENGLISH The bit depth of processing pixel is 8bit \else   \endif
    NvsVideoResolutionBitDepth_16Bit_Float,    //!< \if ENGLISH The bit depth of processing pixel is half float \else   \endif
    NvsVideoResolutionBitDepth_Auto           //!< \if ENGLISH The bit depth of processing pixel is adaptive. For example, for videos with HDR in editing, half precision floating point will be used for HDR video processing in SDK \else   \endif
} NvsVideoResolutionBitDepth;

2、Set livewindow:

Livewindow has 3 hdr support modes, which can be configured through hdrDisplayMode property:

typedef enum {
    NvsLiveWindowHDRDisplayMode_SDR = 0,                //!< \if ENGLISH Forced to use SDR display, regardless of whether the device supports HDR display. \else  \endif
    NvsLiveWindowHDRDisplayMode_Device ,                 //!< \if ENGLISH If the device supports HDR, use HDR display. \else  \endif
    NvsLiveWindowHDRDisplayMode_TONE_MAP_SDR ,      //!< \if ENGLISH If the device supports HDR, use HDR display, and use NO HDR mode display if it is not supported. \else  \endif
} NvsLiveWindowHDRDisplayMode; 

3. Generate configuration:

To support HDR export by configuring compileConfigurations, two parameters need to be set:

Example:

[[NvsStreamingContext sharedInstance].compileConfigurations setValue:@”hevc” forKey:NVS_COMPILE_VIDEO_ENCODEC_NAME];
[[NvsStreamingContext sharedInstance].compileConfigurations setValue:@”hlg” forKey:NVS_COMPILE_HDR_VIDEO_COLOR_TRANSFER];

4、Color gain processing

Adjust the color gain when converting from SDR to HDR, default: 0.

/*! \if ENGLISH
*  \brief Sets the color gain during SDR to HDR conversion.
*  \param gain color gain. range is [1.0, 10.0]
*  \else
*  \brief 
*  \param 
*  \endif
*  \since 2.23.0
*  \sa getColorGainForSDRToHDR
*/
- (void)setColorGainForSDRToHDR:(float)gain;

/*! \if ENGLISH
*  \brief gets the color gain during SDR to HDR conversion.
*  \return Returns color gain. range is [1.0, 10.0]
*  \else
*  \brief 
*  \return 
*  \endif
*  \since 2.23.0
*  \sa setColorGainForSDRToHDR
*/
- (float)getColorGainForSDRToHDR;

Recording parameters and exporting parameters:NVS_RECORD_VIDEO_ENCODEC_NAME,NVS_RECORD_HDR_VIDEO_COLOR_TRANSFER.

Other:

There are several types of media formats: SDR, HDR, HDR10, HDR10+, Dolby Vision.

Type Color conversion curve name
SDR none
HDR hlg
HDR10/HDR10+ st2084(PQ Video)
Dolby Vision(Only IOS support) hlg dolby vision(Only IOS support)