We are having issues with playing video streams in Safari on Apple Vision Pro headsets. However, the same streams render on Meta Quest headsets using the Chrome browser. We are using the nvEncodeAPI library to generate the streams.
Encoder settings:
static const GUID ENCODE_GUID = NV_ENC_CODEC_HEVC_GUID;
static const GUID PROFILE_GUID = NV_ENC_HEVC_PROFILE_MAIN_GUID;
static const GUID PRESET_GUID = NV_ENC_PRESET_P3_GUID;
static const NV_ENC_TUNING_INFO TUNING_INFO = NV_ENC_TUNING_INFO_LOW_LATENCY;
NV_ENC_PRESET_CONFIG preset_config{NV_ENC_PRESET_CONFIG_VER,
{NV_ENC_CONFIG_VER}};
NVENC_API_CALL(m_nvapi.nvEncGetEncodePresetConfigEx(
m_encoder, ENCODE_GUID, PRESET_GUID, TUNING_INFO, &preset_config));
preset_config.presetCfg.rcParams.averageBitRate = 30000000;
preset_config.presetCfg.rcParams.rateControlMode = NV_ENC_PARAMS_RC_CBR;
preset_config.presetCfg.rcParams.multiPass = NV_ENC_MULTI_PASS_DISABLED;
preset_config.presetCfg.frameIntervalP = 1;
preset_config.presetCfg.gopLength = NVENC_INFINITE_GOPLENGTH;
preset_config.presetCfg.profileGUID = PROFILE_GUID;
preset_config.presetCfg.encodeCodecConfig.hevcConfig.level =
NV_ENC_LEVEL_HEVC_51;
preset_config.presetCfg.encodeCodecConfig.hevcConfig.tier =
NV_ENC_TIER_HEVC_MAIN;
preset_config.presetCfg.encodeCodecConfig.hevcConfig.outputAUD = 1;
NV_ENC_INITIALIZE_PARAMS initialize_params{NV_ENC_INITIALIZE_PARAMS_VER};
initialize_params.encodeGUID = ENCODE_GUID;
initialize_params.presetGUID = PRESET_GUID;
initialize_params.encodeWidth = 1920;
initialize_params.encodeHeight = 1080;
initialize_params.darWidth = 1920;
initialize_params.darHeight = 1080;
initialize_params.frameRateNum = 60;
initialize_params.frameRateDen = 1;
initialize_params.enablePTD = 1;
initialize_params.encodeConfig = &preset_config.presetCfg;
initialize_params.maxEncodeWidth = 1920;
initialize_params.maxEncodeHeight = 1080;
initialize_params.tuningInfo = TUNING_INFO;
NVENC_API_CALL(
m_nvapi.nvEncInitializeEncoder(m_encoder, &initialize_params));
Pic params:
NV_ENC_PIC_PARAMS pic_params{NV_ENC_PIC_PARAMS_VER};
pic_params.inputWidth = m_width;
pic_params.inputHeight = m_height;
pic_params.inputBuffer = m_inputs[back_buffer];
pic_params.outputBitstream = m_output;
pic_params.bufferFmt = NV_ENC_BUFFER_FORMAT_ABGR;
pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME;
if (idr) {
pic_params.encodePicFlags =
NV_ENC_PIC_FLAG_FORCEIDR | NV_ENC_PIC_FLAG_OUTPUT_SPSPPS;
}
NVENC_API_CALL(m_nvapi.nvEncEncodePicture(m_encoder, &pic_params));
Using HVENC, only the first frame renders, and with H.265 just a handful of frames are rendered.
Any advice would be greatly appreciated!