set accurate avi framerate instead of rough approximation (#11030)

emu/recording: improve avi framerate accuracy
(Numerator values above 0x3fff'ffff have support issues currently, specifically, youtube will refuse to process an MP4 with it, and it's a pretty common container)
This commit is contained in:
feos 2023-04-15 22:11:57 +03:00 committed by GitHub
parent 188c5a74d5
commit 899acccfe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,8 +179,8 @@ bool avi_movie_recording::initialize(running_machine &machine, std::unique_ptr<e
// build up information about this new movie
avi_file::movie_info info;
info.video_format = 0;
info.video_timescale = 1000 * (screen() ? screen()->frame_period().as_hz() : screen_device::DEFAULT_FRAME_RATE);
info.video_sampletime = 1000;
info.video_timescale = 0x3fff'fffc; // multiple of 60, for screenless machines
info.video_sampletime = screen() ? screen()->frame_period().as_ticks(info.video_timescale) : 0x0111'1111;
info.video_numsamples = 0;
info.video_width = width;
info.video_height = height;
@ -195,7 +195,7 @@ bool avi_movie_recording::initialize(running_machine &machine, std::unique_ptr<e
info.audio_samplerate = machine.sample_rate();
// compute the frame time
set_frame_period(attotime::from_seconds(1000) / info.video_timescale);
set_frame_period(attotime::from_ticks(info.video_sampletime, info.video_timescale);
// create the file
avi_file::error avierr = avi_file::create(fullpath, info, m_avi_file);