Hello guest, if you like this forum, why don't you register? https://fanrestore.com/member.php?action=register (December 14, 2021) x


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Foolproof method for fandubbing
#1
Hi all,

This is a guide I have followed many times. It allows you to take the audio from one source and add it to the video of another source. It takes a bit of getting used to, but I have successfully fandubbed many projects following it and it has always worked flawlessly, even where the frame rates of the two sources are completely off and there are loads of extra frames.

I did not write this guide, but it is posted here with the permission of the author. The only bit I skipped is part of Section 1 (I)- the part about hex calculators, VDub just told me the 1st and 2nd stream values without me having to calculate them.

Hopefully this is of use to some people.

Thanks




Fandubs the Not Completely Hellish Way
by fleabitefred

Here is a method that I have developed for doing fandubs. It will do a good job in just about any situation. Most fandubs can be completed with a couple of days of work. It involves comparing the source videos frame by frame. The trick is to match the frame rates so this will work.

Tools required:
VirtualDub
Audacity
>100GB free disk space

Donor = the file you want to take audio from
Target = the file you want to add audio to



1. Look at a sample to determine what the heck is going on

To determine the correct frame rate conversion settings, start by doing a dry run on a small sample.

A. Open Donor in VDub. Find a handy sequence, around 3000 to 10000 frames in length, that appears to be free from splices or editorial differences compared to the Target. If you later find there were splices or differences you will have to start over.

B. Set resize filter to 50%. Set video and audio compression to uncompressed. Mix out the sequence to DonorTest.avi.

C. Open Target in VDub. Set resize filter to 50%. Set video and audio compression to uncompressed. Mix out the same
approximate sequence to TargetTest.avi.

D. Open DonorTest.avi and TargetTest.avi in two side by side instances of VDub.

E. In each file, find the matching frame that begins the sequence and mark as selection start.

F. In each file, find the matching frame that ends the sequence and mark as selection end.

G. Write down the number of frames in each selection: DonorSampleLength and TargetSampleLength.

H. In the Target VDub, use the crop and resize filters so the frame size will match the DonorTest.avi frame size. Set video and audio compression to uncompressed. Mix out a few dozen frames to TargetBit.avi.

I. In Donor VDub, use Append AVI to import TargetBit.avi. If it succeeds, write down ImportOK. If it complains about the frame rate, it will tell you the frame rate of the first and second stream. Write down these frame rates, calling them FirstStreamRateHex and SecondStreamRateHex. They will each be in the form of a hexadecimal numerator and denominator. Then find a hex to decimal converter online and convert the fractions to the form of a decimal numerator and denominator. Write those down, calling them FirstStreamRateDec and SecondStreamRateDec. Then use a calculator to divide the decimal numerators by the denominators and write down the results FirstStreamRate and SecondStreamRate.

J. If Append AVI complains about the audio format, use Audacity to reprocess the Target audio to a matching format. I'm not going to explain that here, but it means you have to mix out the audio to WAV, convert using Audacity and then use “Audio->Audio from other file” to attach the converted audio to TargetTest.avi.


2. Test sample conversion scenario 1

If
DonorSampleLength=TargetSampleLength and ImportOK, you do not have to do any frame rate conversion.


3. Test sample conversion scenario 2


If Import OK but DonorSampleLength and TargetSampleLength are different:

A. In Donor VDub, go into “Video->Frame Rate...”. In the box it will tell you the current frame rate which we will call DonorCurrentFrameRate. Enter DonorCurrentFrameRate into “Convert to fps”. Also select “Change frame rate to (fps):” and enter DonorLengthChangeRate which is calculated from the formula

(DonorSampleLength/TargetSampleLength)*DonorCurrentFrameRate.

B. In Donor VDub, with the frame rate set as described, mix out the sample selection as an uncompressed AVI called DonorSampleFixRate.avi.

C. In Donor VDub, mix out the audio of the sample selection as an uncompressed WAV DonorSampleFixRate.wav.

D. Open DonorSampleFixRate.wav in Audacity. Convert the speed of the entire file using “Effect->Change Speed...”. Set the speed to DonorSpeedChange which is calculated from the formula

((DonorSampleLength/TargetSampleLength) – 1)*100.
Note: this value can be positive or negative.

E. Compare the resulting length of audio in seconds to the length of DonorSampleFixRate.avi. If there is a discrepancy more than a few hundredths of a second, correct it by using “Effect->Change Tempo” and entering the exact length in seconds of DonorSampleFixRate.avi.

F. Mix out the complete audio as uncompressed WAV file called DonorSampleFixSpeed.wav.

G. Open DonorSampleFixRate.avi in VDub. Use “Audio->Audio from other file” to import DonorSampleFixSpeed.wav. Mix out as uncompressed video and audio to DonorSampleFixRatePlusAudio.avi.

H. Play DonorSampleFixRatePlusAudio.avi and make sure the audio is in synch with the picture. Otherwise something went wrong.

I. Open DonorTest.avi and DonorSampleFixRatePlusAudio.avi in two side by side instances of VDub.

J. Select the sample region in DonorTest.avi.
Verify that the first frame of the region matches the first frame of DonorSampleFixRatePlusAudio.avi.
Verify that the last frame of the region matches the last frame of DonorSampleFixRatePlusAudio.avi.
Verify that the number of frames in the sample region equals the number of frames in DonorSampleFixRatePlusAudio.avi.
If it doesn't check out something went wrong.

K. In DonorSampleFixRatePlusAudio.avi VDub, use Append AVI to import TargetBit.avi. If it doesn't succeed, something went wrong. (If an audio format error crops up, fix as explained in section 1-J.)

L. EXAMPLE from Labios Rojos (1960)
opération lèvres Rouges (aka Labios Rojos) [Spain] [1960/DVDRIP/x264]
Both files give the same frame rate but the Donor was recorded from a projector running slow at some random speed, causing excess frames to be captured.

ImportOK = true
DonorSampleLength = 3570 frames
TargetSampleLength = 3429 frames

“Convert to fps” = 25 fps
“Change frame rate to (fps):” = 26.0279965 fps
“Effect->Change Speed” = 4.111986002%


4. Test sample conversion scenario 3


If DonorSampleLength=TargetSampleLength but did not get ImportOK:

A. In Donor VDub, go into Video->Frame Rate... Select “Change frame rate to (fps):” and enter SecondStreamRateDec. Enter it in the form of a decimal numerator/denominator, for example 1000000000/40001663.

B. In Donor VDub, with the frame rate set as described, mix out the sample selection as an uncompressed AVI called DonorSampleFixRate.avi.

C. In Donor VDub, mix out the audio of the sample selection as an uncompressed WAV DonorSampleFixRate.wav.

D. Open DonorSampleFixRate.wav in Audacity. Convert the speed of the entire file using “Effect->Change Speed...” Set the speed to DonorSpeedChange which is calculated from the formula

((SecondStreamRate/FirstStreamRate) – 1)*100.
Note, this value can be positive or negative.

E. Compare the resulting length of audio in seconds to the length of DonorSampleFixRate.avi. If there is a discrepancy more than a few hundredths of a second, correct it by using “Effect->Change Tempo” and entering the exact length in seconds of DonorSampleFixRate.avi.

F. Mix out the complete audio as uncompressed WAV file called DonorSampleFixSpeed.wav.

G. Open DonorSampleFixRate.avi in VDub. Use “Audio->Audio from other file” to import DonorSampleFixSpeed.wav.
Mix out as uncompressed video and audio to DonorSampleFixRatePlusAudio.avi.

H. Play DonorSampleFixRatePlusAudio.avi and make sure the audio is in synch with the picture. Otherwise something went wrong.

I. Open DonorTest.avi and DonorSampleFixRatePlusAudio.avi in two side by side instances of VDub.

J. Select the sample region in DonorTest.avi.
Verify that the first frame of the region matches the first frame of DonorSampleFixRatePlusAudio.avi.
Verify that the last frame of the region matches the last frame of DonorSampleFixRatePlusAudio.avi.
Verify that the number of frames in the sample region equals the number of frames in DonorSampleFixRatePlusAudio.avi.
If it doesn't check out something went wrong.

K. In DonorSampleFixRatePlusAudio.avi VDub, use Append AVI to import TargetBit.avi. If it doesn't succeed, something went wrong. (If an audio format error crops up, fix as explained in section 1-J.)

L. EXAMPLE from The Brain (1962)
The Brain [UK/West Germany] [1962/DVDRIP/x264]
Same number of frames in matching scenes but the Donor was running at a slower frame rate so the audio needed to be sped up to match the Target.

DonorSampleLength=TargetSampleLength
FirstStreamRateHex = 00989680/00065d3b
FirstStreamRateDec = 10000000/417083
FirstStreamRate = 23.97604314 fps
SecondStreamRateHex = 3b9aca00/0262607f
SecondStreamRateDec = 1000000000/40001663
SecondStreamRate = 24.99896067 fps

“Convert to fps” = leave blank
“Change frame rate to (fps):” = 1000000000/40001663
“Effect->Change Speed” = 4.266415121%


5. Test sample conversion scenario 4

If DonorSampleLength doesn't match TargetSampleLength and did not get ImportOK:

A. In Donor VDub, go into “Video->Frame Rate...”. Enter SecondStreamRate into “Convert to fps”. Also select “Change frame rate to (fps):” and enter DonorLengthChangeRate which is calculated from the formula

(DonorSampleLength/TargetSampleLength)* SecondStreamRate.

B. In Donor VDub, with the frame rate set as described, mix out the sample selection as an uncompressed AVI called DonorSampleFixRate.avi.

C. In Donor VDub, mix out the audio of the sample selection as an uncompressed WAV DonorSampleFixRate.wav.

D. Open DonorSampleFixRate.wav in Audacity. Convert the speed of the entire file using “Effect->Change Speed...” Set the speed to DonorSpeedChange which is calculated from the formula

((DonorLengthChangeRate/FirstStreamRate) – 1)*100.
Note, this value can be positive or negative.

E. Compare the resulting length of audio in seconds to the length of DonorSampleFixRate.avi. If there is a discrepancy more than a few hundredths of a second, correct it by using “Effect->Change Tempo “and entering the exact length in seconds of DonorSampleFixRate.avi.

F. Mix out the complete audio as uncompressed WAV file called DonorSampleFixSpeed.wav.

G.. Open DonorSampleFixRate.avi in VDub. Use “Audio->Audio from other file” to import DonorSampleFixSpeed.wav. Mix out as uncompressed video and audio to DonorSampleFixRatePlusAudio.avi.

H. Play DonorSampleFixRatePlusAudio.avi and make sure the audio is in synch with the picture. Otherwise something went wrong.

I. Open DonorTest.avi and DonorSampleFixRatePlusAudio.avi in two side by side instances of VDub.

J. Select the sample region in DonorTest.avi.
Verify that the first frame of the region matches the first frame of DonorSampleFixRatePlusAudio.avi.
Verify that the last frame of the region matches the last frame of DonorSampleFixRatePlusAudio.avi.
Verify that the number of frames in the sample region equals the number of frames in DonorSampleFixRatePlusAudio.avi.
If it doesn't check out something went wrong.

K In DonorSampleFixRatePlusAudio.avi VDub, use Append AVI to import TargetBit.avi. If it doesn't succeed, something went wrong. (If an audio format error crops up, fix as explained in section 1-J.)

L. EXAMPLE from Muz z prvniho stoletti (1961)
Man from the First Century (Fandub) [Czechoslovakia] [1961/DVDRIP/XViD]
Converting from 29.97 fps to 25 fps, which seems like a typical NTSC to PAL conversion. But the Donor has somehow picked up extra frames. The typical number of frames for the Donor sample would be 3413 * (29.97/25) = 4092 but instead we are getting 4263.

DonorSampleLength = 4263
TargetSampleLength = 3413
FirstStreamRateHex = bb5/64
FirstStreamRateDec = 2997/100
FirstStreamRate = 29.970 fps
SecondStreamRateHex = 19/1
SecondStreamRateDec = 25/1
SecondStreamRate = 25 fps

“Convert to fps” = 25.0 fps
“Change frame rate to (fps):” = (4263*25)/3413 = 106575/3413
“Effect->Change Speed” = 4.191504719%


5. Test sample conversion scenario 4


If DonorSampleLength doesn't match TargetSampleLength and did not get ImportOK:

A. In Donor VDub, go into “Video->Frame Rate...”. Enter SecondStreamRate into “Convert to fps”. Also select “Change frame rate to (fps):” and enter DonorLengthChangeRate which is calculated from the formula

(DonorSampleLength/TargetSampleLength)* SecondStreamRate.

B. In Donor VDub, with the frame rate set as described, mix out the sample selection as an uncompressed AVI called DonorSampleFixRate.avi.

C. In Donor VDub, mix out the audio of the sample selection as an uncompressed WAV DonorSampleFixRate.wav.

D. Open DonorSampleFixRate.wav in Audacity. Convert the speed of the entire file using “Effect->Change Speed...” Set the speed to DonorSpeedChange which is calculated from the formula

((DonorLengthChangeRate/FirstStreamRate) – 1)*100.
Note, this value can be positive or negative.

E. Compare the resulting length of audio in seconds to the length of DonorSampleFixRate.avi. If there is a discrepancy more than a few hundredths of a second, correct it by using “Effect->Change Tempo “and entering the exact length in seconds of DonorSampleFixRate.avi.

F. Mix out the complete audio as uncompressed WAV file called DonorSampleFixSpeed.wav.

G.. Open DonorSampleFixRate.avi in VDub. Use “Audio->Audio from other file” to import DonorSampleFixSpeed.wav. Mix out as uncompressed video and audio to DonorSampleFixRatePlusAudio.avi.

H. Play DonorSampleFixRatePlusAudio.avi and make sure the audio is in synch with the picture. Otherwise something went wrong.

I. Open DonorTest.avi and DonorSampleFixRatePlusAudio.avi in two side by side instances of VDub.

J. Select the sample region in DonorTest.avi.
Verify that the first frame of the region matches the first frame of DonorSampleFixRatePlusAudio.avi.
Verify that the last frame of the region matches the last frame of DonorSampleFixRatePlusAudio.avi.
Verify that the number of frames in the sample region equals the number of frames in DonorSampleFixRatePlusAudio.avi.
If it doesn't check out something went wrong.

K In DonorSampleFixRatePlusAudio.avi VDub, use Append AVI to import TargetBit.avi. If it doesn't succeed, something went wrong. (If an audio format error crops up, fix as explained in section 1-J.)

L. EXAMPLE from Muz z prvniho stoletti (1961)
Man from the First Century (Fandub) [Czechoslovakia] [1961/DVDRIP/XViD]
Converting from 29.97 fps to 25 fps, which seems like a typical NTSC to PAL conversion. But the Donor has somehow picked up extra frames. The typical number of frames for the Donor sample would be 3413 * (29.97/25) = 4092 but instead we are getting 4263.

DonorSampleLength = 4263
TargetSampleLength = 3413
FirstStreamRateHex = bb5/64
FirstStreamRateDec = 2997/100
FirstStreamRate = 29.970 fps
SecondStreamRateHex = 19/1
SecondStreamRateDec = 25/1
SecondStreamRate = 25 fps

“Convert to fps” = 25.0 fps
“Change frame rate to (fps):” = (4263*25)/3413 = 106575/3413
“Effect->Change Speed” = 4.191504719%


6. Main Conversion


When all verifications are satisfactory, proceed to convert and uncompress your Target and Donor files. This will hog up your memory and take some computing time:

A. Open Target in VDub. If you had to convert the Target Audio per section 1-J, perform the same operation on the entire Target Audio and import it back into VDub. Set resize filter to 50%. Set video and audio compression to uncompressed. Mix out the entire video to TargetUNC.avi.

B. Open Donor in VDub. Set resize filter to 50%. Set video and audio to uncompressed. If needed, set “Convert to fps” and “Change frame rate to (fps):” the same way that worked for the sample. Mix out the entire video to DonorUNC.avi.

C. If “Change frame rate to (fps):” was not used, skip ahead to section 7.

D. Mix out the entire audio from Donor as an uncompressed WAV file DonorUNC.wav. Open in Audacity and apply “Effect->Change Speed...” using the value that worked for the sample.

E. Compare the resulting length of audio in seconds to the length of DonorUNC.avi. If there is a discrepancy more than a few hundredths of a second, correct it by using “Effect->Change Tempo” and entering the exact length in seconds of DonorUNC.avi.

F. Mix out the complete audio as uncompressed WAV file called DonorUNCFixSpeed.wav.

G. Open DonorUNC.avi in VDub. Use “Audio->Audio from other file” to import DonorUNCFixSpeed.wav. Mix out as Direct Stream Copy video and uncompressed audio to DonorUNCPlusAudio.avi.

H. Spot check the beginning, middle and end of DonorUNCPlusAudio.avi in a video player and make sure the audio is in synch with the picture. Otherwise something went wrong.


7. Proceed with the fandub!


A. Open TargetUNC.avi and DonorUNC.avi (or DonorUNCPlusAudio) in two side by side instances of VDub.

B. Starting from the beginning, Edit DonorUNC.avi to match TargetUNC.avi frame for frame.

C. Remove excess frames from DonorUNC.avi as needed. That audio will be lost.

D. If you need to add frames to DonorUNC.avi you have a choice. If there is dialogue or music from the other language version that you think should be incorporated, mix out the needed frames from TargetUNC.avi. Use Append AVI to bring them into DonorUNC.avi and then position into the timeline accordingly. Use the resize and crop filters when mixing out from TargetUNC.avi so the format will match. Don't worry about video quality because we are not going to keep the video.

E. Your second choice when adding frames is take them from elsewhere in DonorUNC.avi. For example suppose a “silent” part between scenes is 10 frames long in DonorUNC.avi but 15 frames in TargetUNC.avi. It might sound better to use copy/paste to replicate 5 frames from the existing “silent” part in DonorUNC.avi, rather than import them from TargetUNC.avi which probably has a different sounding noise floor.

F. If you find yourself regularly needing to put in or take out a frame every few hundred or few thousand frames, that is a sign that your rate conversion was not perfectly accurate. You can either keep hand editing the frames or try to redo the rate conversion using larger sample. In any case, if you let the frame matching go off by more than a couple of frames, you will have a noticeable synch error in the result.

G. I recommend you write down your edits as you go. This helps with remembering the numbers. Plus it is invaluable for later clean up in Audacity (discussed later), and its good to have a record in any case. Example:
@0000 removed 210 frames
@1763 added 4 frames
@2998 removed 412 frames...

H. Get around by using “Go To Frame” (control-G) and typing in the frame number. I know it sounds tedious but it will take forever otherwise. Use a binary search algorithm to find the next non-matching frame. Example:
Jump forward 1000 frames in each window– still matches
Jump forward 2000 frames in each window– still matches
Jump forward 4000 frames in each window– still matches
Jump forward 8000 frames in each window– oh crap it doesn't match
Jump back 4000 frames in each window– still no match
Jump back 2000 frames in each window– still no match
Jump back 1000 frames in each window– match!
Jump forward 500 frames in each window– no match
Jump back 250 frames in each window– match
Now you are close enough to zero in on the mismatch, using Alt-right arrow/Alt-left arrow to jump 50 frames at a time, and right arrow/left arrow to jump 1 frame at a time.

I. If you don't finish all in one sitting, you can quickly save your work for later using the following method in DonorUNC VDub: “Select File->Queue batch operation-> Save as AVI...”. Choose a dummy name for your file and click save. Now you may exit VDub. Later, reopen VDub and choose “File->Job control”. Highlight the desired job and click “Reload”. That will put you right back where you left off.


8. Finishing up

When DonorUNC.avi is a frame for frame match of TargetUNC.avi the fandub is ready!

A. In DonorUNC.avi, simply mix out your fandub in WAV format.

B. For best results, open the WAV in Audacity for some clean up.

C. At the bottom of the Audacity window you can check “Snap To” and click the arrow thingies to set common frame rates of 24, 25 and NTSC (30000/1001 = 29.97003 fps). Then you can enter frame numbers from your notes into the little boxes and quickly navigate to your edits.

D. You can mix out your complete Target audio as a WAV from VDub and import it into the Audacity session where it will appear properly synchronized. It can provide handy source material to help patch up the fandub track.

E. When everything is perfect, use VDub to mix out your fandub audio with the desired compression. (FWIW I like to use AC-3 ACM codec @192 kBit/s.) Then you will typically add it as a second audio track to the Donor. It is better not to touch the original Donor video or audio track without a good reason. I use VirtualDubMod for adding a second audio stream to XVID and MKVToolNix GUI for adding to mkv.

F. Break out the popcorn and enjoy the first run through of your fandub!

G. Now don't forget to SHARE!!!
Reply
Thanks given by:
#2
Thanks for the guide!

P.S. Please DO NOT USE BLACK FOR TEXT, because it will not be visible for people who use the dark theme (which has a black background). I replaced it with grey, but if you want to use another color let me know.
Reply
Thanks given by:
#3
Hi spoRv, no problem and yes grey is fine. I guess depending on your source and output people may do some things slightly differently, but the theory is sound. I've used it several times to take VHS audio and put it onto a non English friendly blu ray or HDTV recording.
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Idea] Is there any (semi) automated method for restoring a cut w/ a new source (details)? deleted user 1 3,058 2017-10-07, 03:09 AM
Last Post: spoRv

Forum Jump:


Users browsing this thread: 1 Guest(s)