summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/FrameDumpFFMpeg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoCommon/FrameDumpFFMpeg.cpp')
-rw-r--r--Source/Core/VideoCommon/FrameDumpFFMpeg.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/FrameDumpFFMpeg.cpp b/Source/Core/VideoCommon/FrameDumpFFMpeg.cpp
index ea8bda7893..44ec0a6a27 100644
--- a/Source/Core/VideoCommon/FrameDumpFFMpeg.cpp
+++ b/Source/Core/VideoCommon/FrameDumpFFMpeg.cpp
@@ -62,13 +62,13 @@ struct FrameDumpContext
namespace
{
-AVRational GetTimeBaseForCurrentRefreshRate()
+AVRational GetTimeBaseForCurrentRefreshRate(s64 max_denominator)
{
auto& vi = Core::System::GetInstance().GetVideoInterface();
int num;
int den;
av_reduce(&num, &den, int(vi.GetTargetRefreshRateDenominator()),
- int(vi.GetTargetRefreshRateNumerator()), std::numeric_limits<int>::max());
+ int(vi.GetTargetRefreshRateNumerator()), max_denominator);
return AVRational{num, den};
}
@@ -248,11 +248,16 @@ bool FFMpegFrameDump::CreateVideoFile()
return false;
}
+ m_max_denominator = std::numeric_limits<s64>::max();
+
// Force XVID FourCC for better compatibility when using H.263
if (codec->id == AV_CODEC_ID_MPEG4)
+ {
m_context->codec->codec_tag = MKTAG('X', 'V', 'I', 'D');
+ m_max_denominator = std::numeric_limits<unsigned short>::max();
+ }
- const auto time_base = GetTimeBaseForCurrentRefreshRate();
+ const auto time_base = GetTimeBaseForCurrentRefreshRate(m_max_denominator);
INFO_LOG_FMT(FRAMEDUMP, "Creating video file: {} x {} @ {}/{} fps", m_context->width,
m_context->height, time_base.den, time_base.num);
@@ -535,7 +540,7 @@ FrameState FFMpegFrameDump::FetchState(u64 ticks, int frame_number) const
state.frame_number = frame_number;
state.savestate_index = m_savestate_index;
- const auto time_base = GetTimeBaseForCurrentRefreshRate();
+ const auto time_base = GetTimeBaseForCurrentRefreshRate(m_max_denominator);
state.refresh_rate_num = time_base.den;
state.refresh_rate_den = time_base.num;
return state;