File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,17 @@ uint64_t Utils::Obs::NumberHelper::GetOutputDuration(obs_output_t *output)
3232 uint64_t frameTimeNs = video_output_get_frame_time (video);
3333 int totalFrames = obs_output_get_total_frames (output);
3434
35- return util_mul_div64 (totalFrames, frameTimeNs, 1000000ULL );
35+ // calculating the divisor is a hack to support multiple video encoders, someone please improve this in the future
36+ uint64_t divisor = 0ULL ;
37+ for (size_t i = 0 ; i < MAX_OUTPUT_VIDEO_ENCODERS; i++) {
38+ obs_encoder_t *encoder = obs_output_get_video_encoder2 (output, i);
39+ if (!encoder)
40+ continue ;
41+ uint32_t encoder_divisor = obs_encoder_get_frame_rate_divisor (encoder);
42+ divisor += encoder_divisor <= 1 ? 1000000ULL : 1000000ULL / encoder_divisor;
43+ }
44+
45+ return util_mul_div64 (totalFrames, frameTimeNs, divisor ? divisor : 1000000ULL );
3646}
3747
3848size_t Utils::Obs::NumberHelper::GetSceneCount ()
You can’t perform that action at this time.
0 commit comments