TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.14k stars 380 forks source link

Alternate Sync causes FFmpeg dumping to crash for N64 #2376

Open Zinfidel opened 4 years ago

Zinfidel commented 4 years ago

Summary

Dumping N64 video while using the Alternate Sync option causes FFmpeg to crash shortly after starting the dump. I have tested this only with Star Wars Episode 1 Racer for the N64. I tested Pink Panther: Pinkadelic Pursuit for GBA, and the bug did not manifest for that core/game. I tried changing the throttling option to Audio Throttling (I think this setting is related somehow to what alternate sync does) but it did not change the crash.

Audio is broken without the Alternate Sync setting for this game - it is not a continuous audio stream but broken up and skips constantly.

Repro

  1. Load Star Wars Episode I - Racer (U) [!]
  2. Pause the emulator
  3. File > AVI/WAV > Config and Record
  4. Check Alternate Sync
  5. Choose FFmpeg writer and click OK
  6. Choose MP4 profile (the crash happens for any profile I choose)
  7. Choose a place to save the file
  8. Unpause the emulator
  9. Wait a moment (usually about 5 seconds for me)

Output

System.Exception: A/V Desync?
   at BizHawk.Client.EmuHawk.NutMuxer.WriteAudioFrame(Int16[] samples)
   at BizHawk.Client.EmuHawk.NutMuxer.Finish()
   at BizHawk.Client.EmuHawk.FFmpegWriter.CloseFileSegment()
   at BizHawk.Client.EmuHawk.FFmpegWriter.Dispose()
   at BizHawk.Client.EmuHawk.MainForm.AbortAv()
   at BizHawk.Client.EmuHawk.MainForm.AvFrameAdvance()
   at BizHawk.Client.EmuHawk.MainForm.StepRunLoop_Core(Boolean force)
   at BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop()
   at BizHawk.Client.EmuHawk.Program.SubMain(String[] args)

HOnIWpessY EyLEDT33Og

Host env.

Zinfidel commented 4 years ago

Probably related to this: #2137

nattthebear commented 4 years ago

More or less the same as https://github.com/TASVideos/BizHawk/issues/133, and probably other bugs I can't find. BizHawk assumes that the number of audio samples returned by an emulation core each frame has at least some connection to reality, but Mupen does not obey this. Alternate sync helps dumps not sound like arse, but it has its limits.

nattthebear commented 3 years ago

Note that #2137, while a nice thing to add, won't really fix this well because for that proposal, the number of audio samples emitted by the core each frame is trusted as an authority, where as in mupen it is not.