MeiCam SDK For Android  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:

public static final int HDR_CAPABILITY_FLAG_SUPPORTED_BY_IMPORTER = 1;    (Import)
public static final int HDR_CAPABILITY_FLAG_SUPPORTED_BY_EDITING = 2;     (Edit)
public static final int HDR_CAPABILITY_FLAG_SUPPORTED_BY_EXPORTER = 4;    (Export)
public static final int HDR_CAPABILITY_FLAG_SUPPORTED_BY_LIVEWINDOW = 8;  (Screen support)

1. Initial configuration:

The HDR function needs to add the following mark:

NvsStreamingContext.STREAMING_CONTEXT_FLAG_ENABLE_HDR_DISPLAY_WHEN_SUPPORTED

String licensePath = "assets:/meishesdk.lic"; NvsStreamingContext.init(mContext, licensePath, NvsStreamingContext.STREAMING_CONTEXT_FLAG_SUPPORT_4K_EDIT|NvsStreamingContext.S TREAMING_CONTEXT_FLAG_ENABLE_HDR_DISPLAY_WHEN_SUPPORTED);

2. Create timeline:

To create timeline, you need to specify the bitDepth attribute of NvsVideoResolution, which has 3 parameters:

VIDEO_RESOLUTION_BIT_DEPTH_8_BIT(SDR edit)

VIDEO_RESOLUTION_BIT_DEPTH_16_BIT_FLOAT(HDR edit)

VIDEO_RESOLUTION_BIT_DEPTH_AUTO(Automatically adapted models)

//Create timeline
videoEditRes.bitDepth = XXXX
mStreamingContext.createTimeline(videoEditRes, videoFps, audioEditRes);

3. Set livewindow:

There are 3 support modes for livewindow, which can be configured through setHDRDisplayMode():

HDR_DISPLAY_MODE_SDR           (Display in SDR mode, without processing HDR video, the picture may be too bursty)
HDR_DISPLAY_MODE_DEPEND_DEVICE (Automatic adaptation according to equipment)
HDR_DISPLAY_MODE_TONE_MAP_SDR  (Convert HDR video to SDR and then display, the picture will not be overburdened)

4. Generate configuration:

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

1.  key is:NvsStreamingContext.COMPILE_VIDEO_ENCODER_NAME  value is:"hevc"
2.  key is:NvsStreamingContext.COMPILE_VIDEO_HDR_COLOR_TRANSFER  value为:"none" or "st2084" or "hlg"

Hashtable<String, Object> compileConfigurations = new Hashtable<>(); 
compileConfigurations.put(NvsStreamingContext.COMPILE_VIDEO_ENCODER_NAME,Constants.HDR_EXPORT_HEVC);
compileConfigurations.put(NvsStreamingContext.COMPILE_VIDEO_HDR_COLOR_TRANSFER, settingValues.getExportConfig());

mStreamingContext.setCompileConfigurations(compileConfigurations);

5、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 com.meicam.sdk.NvsStreamingContext.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 com.meicam.sdk.NvsStreamingContext.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)