Joined: 2/3/2013
Posts: 320
Location: Germany
Encoding After following the procedure described in the Dolphin video dumping guide it will have created several files in the dump directory of your Dolphin folder. This guide aims to provide you with information on how these files should be handled for encoding and differentiates between Windows and Linux versions of the AVhack. General Audio should be encoded at the sampling rate that requires the least amount of audio to be resampled. This should be 32kHz. An exception is encoding to Opus, whose encoder automatically resamples to 48kHz (this might change in the future). In that case it is advisable to resample audio manually using a high quality resampler like the one sox provides. TODO: Add/explain formula for calculating the accurate FPS (it is here: http://codepad.org/HKorMEoH for now) Windows First take a look at \User\Dump\Audio. Out of the four files it contains (audiodump.wav, dspdump0-2.wav) only the latter three are needed. dspdump0.wav and dspdump2.wav are both 32kHz whereas dspdump1.wav is 48kHz. Resample that file to 32kHz and concatenate them subsequently:
sox dspdump0.wav dspdump1.wav dspdump2.wav <outfile_concat>
outfile_concat now contains a proper audiodump of the movie. It is also possible to concatenate them on the fly with Avisynth. (TODO: Add the code snippet for this.) Afterwards examine \User\Dump\Frames. It contains two files: framedump0.avi and timecodes.txt. framedump0.avi holds the lossless video dump as VFR (variable framerate) video and timecodes.txt the associated timecodes in v2 format. Assuming you are using Avisynth for processing the video before inputting it to an encoding frontend, you now have to apply the timecodes to the video file and mux the resulting clip with the audio. To following code snippet is to be prepended to the respective .avs:
LoadCPlugin("timecodefps.dll")
video = AVISource("videofile.avi").TimecodeFPS("timecodes.txt", fpsnum=X, fpsden=Y)
audio = WAVSource("audiofile.wav")
AudioDub(video,audio)
Info: Above code requires natt's VFR-to-CFR-conversion plugin; alternatively you may use Aktan's plugin, which tolerates missing or spare timecodes. X and Y denote the desired CFR video FPS, TODO: Explain Pipedec usage Linux Every file you need resides in $HOME/.dolphin-emu/Dump/Frames: framedump0.avi (lossless VFR video encoded with FFV1), framedump.txt (v2 timecodes), framedump0.raw and framedump1.raw (both audio). Audio is stored to disk as 16-bit, 2-channel, 32kHz, big endian raw audio (corresponds to ffmpeg format "s16be"). You likely want to convert it into something more suitable using e.g. ffmpeg:
ffmpeg -f s16be -channels 2 -ar 32000 -i framedump0.raw -c:a pcm_s16le audio.wav
Edit: This post is under construction. The dumping guide has been moved to the wiki: http://tasvideos.org/EncodingGuide/VideoDumping.html#Dolphin. The encoding guide will soon be corrected and differentiate between Windows and Linux versions of the AVhack.
All syllogisms have three parts, therefore this is not a syllogism.
Active player (317)
Joined: 1/15/2012
Posts: 343
Thank you so much !
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
Thanks! Also, resampling and merging WAVs must e possible in avisynth as well.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
Well yeah, it is.
Joined: 10/1/2013
Posts: 98
Location: My Basement
Sorry if this is the wrong spot (or counts as a necro), but I am pulling my hair out with this. After a LOT of mucking around, I've gotten Dolphin to sync properly, and I'm all ready to dump. However, when I start dumping, it works initially, but Dolphin crashes at the 2GB AVI split. I've tried many codecs, including Microsoft Video 1, x264 lossless, Lagarith, and ffdshow FFV1. They all have the same behavior here. Also, the presence of a pre-made framedump1.avi does not matter; it asks whether I want to delete it, then when I say Yes, it crashes. I can properly encode the portions of the audio and video that have already been dumped; it's just bugging on me now. It was working last night (albeit with Dump Audio to AVI instead of Dump Audio), so I'm really confused now! For the record, I'm recording Brawl replays, not a TAS. Since they'll sync with Dual Core and Idle Skipping, I left those on, but it was working fine with those last night. D3D and OpenGL also didn't make a difference besides their unique graphical bugs. I'm using Dolphin 4.0-419-avsync compiled by RachelB for Windows x64. EDIT: Just tried with Dual Core, Idle Skipping, and the framelimiter all off, and it crashes just the same. EDIT2: After a reboot, it still does the same thing. However, I have a workaround that appears to be fine: using x264 in lossy mode. By using CRF 14 for 720p60 and the Faster preset (plus Zero-Latency enabled to appease Dolphin), I got a bitrate of 23.6mbps, which is enough for roughly 11 minutes of video before it crashes. Still would be nice to not crash at all, however, since AVISynth presents the raw decoded frames to VDub, which necessitates a re-encode. Yuck.
Active player (272)
Joined: 11/2/2013
Posts: 62
Location: USA
In the AV Sync topic in the Dolphin section there are a couple solutions. I have 64 bit as well, AV Sync works for me by creating a dummy avi with Microsoft Video 1 configured to very low quality so the full video dump fits without splitting. I then used regular Dolphin 4.0.2 to dump the high quality frames with x264vfw x64 lossless, split files. I combined them with VirtualDub, deleting one frame at the end of each split because it seems a frame is duplicated during the dump split process. Ensure the number of frames on the HQ avi matches the original dummy avi, and call out the HQ avi in your Avisynth script.
Joined: 10/1/2013
Posts: 98
Location: My Basement
Thanks, I'll try that. As for splitting the files, does it just do that automatically on 4.0.2, or do I have to configure x264vfw to do that?
Editor, Experienced player (608)
Joined: 11/8/2010
Posts: 4012
Dolphin will do that automatically, so you can dump with any codec to get AVIs that split. Not sure why A/V sync Dolphin revisions crash at 2GB split, but even those builds try to split the AVI normally before the crash. Also, thank you Ubercapitalist for the information on what causes those extra frames! I never thought it would be a duplicated frame at the end of each segment that was the cause of the slight desync in my encodes (like the character freezing before entering a loading zone).
Joined: 1/13/2014
Posts: 56
Is there a specific frame rate that needs to be used? I've followed all of this exactly and the audio is still a little bit desynced, and I'm not sure what else could be the problem.
Editor, Experienced player (852)
Joined: 8/12/2008
Posts: 845
Location: Québec, Canada
Thank you so much for writting this! Much appreciated.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
Nahoc's back yeah!
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Spikestuff
They/Them
Editor, Publisher, Expert player (2283)
Joined: 10/12/2011
Posts: 6336
Location: The land down under.
feos wrote:
Nahoc's back yeah!
Of course. He needed to take a year break after getting a load of awards in 2012.
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
Post subject: Copy of the framerate stuff mentioned above
Emulator Coder, Skilled player (1141)
Joined: 5/1/2010
Posts: 1217
Here's copy of the framerate paste mentioned above (for more stable storage): Dolphin framerate: M/((k*N+b)*floor(floor(M/F)/N)). For Gamecube: - M is 486MHz. For Wii: - M is 729MHz. For NTSC: - F is 60Hz. - N is 525. For PAL: - F is 50Hz. - N is 625. For PAL60: - F is 60Hz. - N is 625. For progressive mode: - k is 2 if Dolphin 3.5-1249+, otherwise 1. - b is 0. For interlaced mode: - k is 1. - b is 0 if Dolphin 3.5-1249+, otherwise 1.
Dimon12321
He/Him
Active player (479)
Joined: 4/5/2014
Posts: 1124
Location: Ukraine
Dahm it! Just a law of meanness! I've done a TAS on a simple GC game, made everything what guide says, but it just can dump frames to AVI (error)! Why not just make a hot key for this, like on horrible PCSX2-rr (at least dump with errors)? How can I record the movie for myself, not for publishing (I hope sth will be soon)? Sorry if sth wrong!
TASing is like making a film: only the best takes are shown in the final movie.
Joined: 2/3/2013
Posts: 320
Location: Germany
Dimon12321 wrote:
Dahm it! Just a law of meanness! I've done a TAS on a simple GC game, made everything what guide says, but it just can dump frames to AVI (error)! Why not just make a hot key for this, like on horrible PCSX2-rr (at least dump with errors)? How can I record the movie for myself, not for publishing (I hope sth will be soon)? Sorry if sth wrong!
What error message do you get? Just a crash? Make sure this is true for you, if Dolphin crashed:
Should the emulator crash at this point examine the User\Dump\ directory of your Dolphin installation ($HOME/.dolphin-emu/GC on Linux) and create the folders Audio and Frames if either of those are missing.
All syllogisms have three parts, therefore this is not a syllogism.
Dimon12321
He/Him
Active player (479)
Joined: 4/5/2014
Posts: 1124
Location: Ukraine
RGamma wrote:
Dimon12321 wrote:
Dahm it! Just a law of meanness! I've done a TAS on a simple GC game, made everything what guide says, but it just can dump frames to AVI (error)! Why not just make a hot key for this, like on horrible PCSX2-rr (at least dump with errors)? How can I record the movie for myself, not for publishing (I hope sth will be soon)? Sorry if sth wrong!
What error message do you get? Just a crash? Make sure this is true for you, if Dolphin crashed:
Should the emulator crash at this point examine the User\Dump\ directory of your Dolphin installation ($HOME/.dolphin-emu/GC on Linux) and create the folders Audio and Frames if either of those are missing.
I have an error massage: "Error dumping frames to AVI." It appears every time before sth appears on the screen (loading...; no memory card inserted; developer's splash screens)! In my documents there is a folder Dolphin Emulator with all needed folders inside. It actually dumps audio in .wav format and I can listen to it after I stop the emulation. I downloaded Dolphin 3.5 and did the same as guide says, but after I play recording, it gives me an error: "Failed to load DSP ROM. This file is required to use DSP LEE" and etc. I copied dsp_rom and dsp_coef from Dolphin which I used to make the run (4.0.2), after that it writes me that cache in copied files is wrong and recorded sound will be smashed! I preesed No anyway because it doesn't solute the problem by clicking Yes. Then it asks me which codec I want to record. The video records, but it causes desync in the run: sth like emulator skips some dozens of frames at the beginning or loads the game longer. I'm not sure the movie will play right if I get the right dsp files for 3.5. Maybe A/V sync for 4.0.2 x32 will fix the error with dumping frames? Help me, please!
TASing is like making a film: only the best takes are shown in the final movie.
Post subject: RGamma: ping
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
Is it how it's supposed to be done?
Language: avisynth

M = 486000000 F = 60 k = 1 N = 525 b = 1 numerator = M / ((k * N + b) * floor(floor( M / F) / N)) video = last.TimecodeFPS("timecodes.txt", fpsnum=numerator, fpsden=1) audio = WavSource("dspdump0.wav")+WavSource("dspdump1.wav").ResampleAudio(32000)+WavSource("dspdump2.wav") AudioDub(audio, last)
No matter how I change b, it all sounds totally wrong, it even starts several seconds too late right in the very beginning (so no split error, and even if there is, there's 17 extra frames, not a bunch of seconds).
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Post subject: Re: RGamma: ping
Fog
Experienced player (626)
Joined: 4/5/2014
Posts: 459
feos wrote:
Is it how it's supposed to be done?
Language: avisynth

M = 486000000 F = 60 k = 1 N = 525 b = 1 numerator = M / ((k * N + b) * floor(floor( M / F) / N)) video = last.TimecodeFPS("timecodes.txt", fpsnum=numerator, fpsden=1) audio = WavSource("dspdump0.wav")+WavSource("dspdump1.wav").ResampleAudio(32000)+WavSource("dspdump2.wav") AudioDub(audio, last)
No matter how I change b, it all sounds totally wrong, it even starts several seconds too late right in the very beginning (so no split error, and even if there is, there's 17 extra frames, not a bunch of seconds).
why are you using that equation? set fpsnum = 60000 and fpsden = 1000 (or just 60 and 1)
Post subject: Re: RGamma: ping
Joined: 2/3/2013
Posts: 320
Location: Germany
feos wrote:
Is it how it's supposed to be done?
Language: avisynth

M = 486000000 F = 60 k = 1 N = 525 b = 1 numerator = M / ((k * N + b) * floor(floor( M / F) / N)) video = last.TimecodeFPS("timecodes.txt", fpsnum=numerator, fpsden=1) audio = WavSource("dspdump0.wav")+WavSource("dspdump1.wav").ResampleAudio(32000)+WavSource("dspdump2.wav") AudioDub(audio, last)
No matter how I change b, it all sounds totally wrong, it even starts several seconds too late right in the very beginning (so no split error, and even if there is, there's 17 extra frames, not a bunch of seconds).
Apart from rounding errors that might occur (should be very minor/nonexistent, unless AVISynth truncates fpsnum to an integer in TimecodeFPS()), yes, this is how it should work. The framerate shouldn't affect a/v sync, because timecodes of each frame are read from timecodes.txt and are duplicated/dropped according to the fps given (i.e. each frame that is mapped to a timecode should have the (approximately) correct timing anyway, even if not every one of them is displayed in the final result (e.g. if you choose a low fps, such that 1/fps > the time between two adjacent timecodes))).
All syllogisms have three parts, therefore this is not a syllogism.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
Fog: "my" formula gives the same 60.0 fps. And audio is still insanely late...
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 2/3/2013
Posts: 320
Location: Germany
feos wrote:
Fog: "my" formula gives the same 60.0 fps. And audio is still insanely late...
Actually not. The exact result is 60750000/1014391 (~=59.89).
All syllogisms have three parts, therefore this is not a syllogism.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
video = last.TimecodeFPS("timecodes.txt", fpsnum=numerator, fpsden=1) audio = WavSource("dspdump0.wav")+WavSource("dspdump1.wav").ResampleAudio(32000)+WavSource("dspdump2.wav") AudioDub(audio, last)
No one pointed it out. Now as I fixed it, the sound is almost synced. Now it's only 5 seconds too soon by the end of the encode...
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
RGamma: What would be a range of avsync revisions that require GapFix? Also, as we figured out the header size, can we reliably use it for all dolphin audio dumps?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
feos wrote:
RGamma: What would be a range of avsync revisions that require GapFix? Also, as we figured out the header size, can we reliably use it for all dolphin audio dumps?
Found it out myself again. Dolphin wav header has always been 44 byte. Download WaveFile.cpp
Language: cpp

// We are now at offset 44 if (file.Tell() != 44) PanicAlert("wrong offset: %lld", (long long)file.Tell());
So here's the build of GapFix suitable for any dolphin wav dump (as soon as sample gaps were filled of course, which was done in https://github.com/nattthebear/dolphin-avsync/tree/3825S and later): https://github.com/feos-tas/Misc/blob/master/GapFix.7z The question remains "When sample gaps were fixed?"
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
5.0 with FFV1 patch https://github.com/vadosnaprimer/dolphin/releases/tag/5.0-ffv1 This unofficial release improves compatibility of video dumps that use FFV1 lossless codec. Sync-compatible with official 5.0 release.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.