Skip to content

Instantly share code, notes, and snippets.

Last active February 26, 2023 09:47
Show Gist options
  • Save rayvoelker/58642a9819e3adcec99b4109e4d59f43 to your computer and use it in GitHub Desktop.
Save rayvoelker/58642a9819e3adcec99b4109e4d59f43 to your computer and use it in GitHub Desktop.

How To Sync Your Movie to the Professional Jokes By Professional Comedy Professionals (AKA RiffTrax)


This guide started off as a sort of checklist for myself to try to refine, and speed up the process. I'm sure that there are a good number of things that can be improved upon, but in my opinion, the steps below produce pretty consistently good results. Hopefully this will help someone enjoy RiffTrax a little more. It should go without saying that you should do this only with movies you own, and you should also purchase the official Rifftrax audio from the website

Software Tools Needed

All of the software listed are free, and open source, and should work across multiple operating system platforms

  • Your preferred software for ripping movies (with the ability of creating MKV media containers for purposes of this guide). The process of ripping a DVD or Blu-ray that you own is a little outside the scope of this guide, but software like HandBrake, or MakeMKV work well for the purpose here.

  • mkvinfo, mkvextract, mkvmerge GUI : These tools will allow you to extract the audio track from the movie, as well as mux it together with the video when finished.(these three are all part of the mkvtoolnix project) ( )

  • ffmpeg / avconv (I believe that libav-tools, which supplies avconv on Debian Linux (pre version 9) / Ubuntu distributions, and ffmpeg are compatible for what we are doing in this guide) ( ) ( ) It might be worth mentioning that ffmpeg seems to have better options for encoding aac audio, which seems to be a preferred audio container for many video players, but of course your mileage may vary.

  • Audacity

The Steps

  1. Rip Source Rip your DVD or Bluray movie into the MKV file format; I've found that this format has tools that make it fairly easy to examine, and extract audio and video tracks. There are plenty of tutorials and guides out there for ripping movies you own, and there may be strong preferences to have a smaller files vs giant high def movies, etc; I'll leave this task as an exercise for the reader.

    That being said, if your source is output to the mp4 container, a simple way to convert it to mkv is the following:

    avconv -i movie.mp4 -vcodec copy -acodec copy output.mkv

  2. Get MKV Info We need to figure out how our encoder aranged the tracks in the MKV, and the easiest way to do this is witha tool called mkvinfo. Start mkvinfo, and then open your MKV movie file to obtain information for the audio track in the MKV.

  3. Extract Movie Audio Use the command mkvextract to pull the audio track from the mkv.


    mkvextract tracks NAME_OF_MKV.mkv 1:audio.ac3

    Or, if using an mp4 file, the following command can be used:

    avconv -i NAME_OF_MP4.m4v -map 0:1 -c:a copy audio.ac3

    This will extract the audio in the format it is stored in. The map portion of the command maps the second input track (the second track is often the audio track) to the first output.

  4. Convert Movie Audio to Single Stereo Track (and convert it to a wav file) - If the file is not a standard stereo track (if you ripped your movie with 5.1 dts for example), we want to convert it to one so that it's easier to work with in Audacity. We'll use the following command:

    avconv -i audio.ac3 -ac 2 audio.wav

    (more info here

  5. Import Movie Audio to Audacity - import the audio.wav file created from the previous step into audacity (Now is a good time so save the project somewhere. Also, remember to save the project from time to time!)

  6. Tweak Movie Volume - More often than not, the dialog audio in the movie is very low in comparison the the loud action scenes. We can attempt to fix this with "Compression". Use the "dynamic range compressor" or "Compressor" option from the effects list to help dialog in the movie become more clear. Select the audio, and then Click "Effect" and select "Compressor...". You may have to experiment a little bit to get your preferred "sound" out of the movie track (undo and then redo the compression, jumping to some movie dialog if you want to experiment). Here are my current settings for the compressor in audacity :

  7. Import RiffTrax Audio to Audacity - import RiffTrax into the project and make sure that the RiffTrax track is displayed at the bottom of the project (important later for the auto ducking).

  8. Trim the RiffTrax Introduction - trim before the words "and we're back", or right after the riffmaster tells you to pause the track. Do this by "cutting" the audio from the bottom (RiffTrax) track. (it may help to mute the top, movie audio track)

  9. (Optional) Create a RiffTrax Intro Track - Place the trimmed introduction into its own mp3 track, so that we can later use it to import into the MKV as a separate track. Sometimes there's some pretty funny bits the riffers put on which might be nice to go back and listen to that later on. After you cut the audio into the clipboard, start a new audacity project, paste the clipboard into that project, and then export as an mp3. I usually place mine in the RiffTrax folder for the Movie, and call it "rifftrax_intro.mp3".

  10. Finding Disembodio - to sync the audio, we need to match the Disembodio to the dialog of the movie. Play the movie to the first dialog line spoken by Disembodio and make a note of the main time line position (zoom in to the track get a more precise location). Do the same for the dialog line in the movie (may want to mute the RiffTrax to make this easier as well), and make a note of that position as well (get the precise location).

  11. Pad (or Delete) From the RiffTrax Track - Here is where the rubber meets the road for this guide -- we will be adjusting the RiffTrax audio (the lines spoken by Disembodio) to align with


    Disembodio line starts at 2min30.528sec

    Movie line starts at 2min49.679sec

    2min49.679sec - 2min30.528sec = 19.151sec

    Add 19.151 seconds of silence to the front of the RiffTrax track.

    Jump back to the movie line (2min49.679sec) and check to see if the tracks are now aligned (adjust from this point). If you're still not in sync (but only off by a little bit), then you can add or subtract from the RiffTrax track (by generating silence, or cutting silence) from this location.

    The audio should now be fully in sync, but it may drift from Disembodio line to Disembodio line. Adjust accordingly (usually by cutting silence or adding silence in .100sec or .200sec increments).

  12. Match the Volume of the Rifftrax to the Volume of the Dialog - This can be a little bit difficult and is somewhat a matter of preference. I like to have moments where characters are speaking in the movie to be roughly the same decibel level as what the riffers are speaking at. The only good way I've found to do it is to mute the rifftrax, then jump to different time-stamps in the movie, play the movie audio, and make a note of where the decibel level reaches. I've found that after running the compressor, it's usually around the -12dB point. Once you've found that, un-mute the rifftrax, and mute the movie audio. Do the same thing you did with the movie audio - jumping around to different time stamps, and making note of the dB levels. Now, select the rifftrax audio, and run the Amplify... Effect, reducing the rifftrax dB by roughly the amount you see the rifftrax exceeding the movie dialog. You may have to undo then re-do this amplification a few times to dial in the correct level for the rifftrax. The goal here is to bring down the rifftrax dB levels to a point where you can turn the volume up on the movie, and not be blasted out of the room by the riffers voices.

  13. Silence Disembodio From the RiffTrax Track - Remove the Disembodio dialog from the movie to make for a more pleasant experience. Use the readme file that came with your purchased RiffTrax .zip file to jump to the locations (usually a second or two before the listed time). Stop the playback, select the portion of the audio with the Disembodio line, and select "Generate", and then "Silence" from the menu.

  14. (Optional) Export Time-synced Rifftrax to MP3 - This may be helpful if you want to go back later and adjust the volume of the rifftrax, make change to the rifftrax, etc. Select the bottom track (the RiffTrax), then from the "File" menu, select "Export Selected Audio".

  15. Normalize the Tracks - Now that they tracks are synced up, and we've removed Disembodio from the mix, now it's time to make the rifftrax and the move track the same relative volume. Select both tracks (ctrl-A), and then select the "Effect" menu, and then "Normalize". I've found that Normaize maximum amplitude to -0.1 seems to work pretty well.

  16. REMOVE? (Optional) Tweak RiffTrax Volume - You may want to reduce the volume of the RiffTrax to help match with the movie volume. More times than not, the riff is at a much higher volume than the audio of the movie. We may experiment with either using the normalize effect, or using the "Amplify" effect to reduce the RiffTrax volume. ---

  17. Duck the Movie Audio When Riffers Speak - Once we're happy with the volume of the riff compared the the volume of the movie, we can now auto duck the movie audio with the RiffTrax. This brings down the movie audio so that we can hear the Riffers talk (that's kind of the whole point, isn't it?) Select the top track that consists of the movie file. Now, select "Effect" and "Auto Duck"

  18. Merge RiffTrax Track with Movie Audio - Once we have auto ducked the movie sound, now we can merge the RiffTrax into the movie's stereo audio track. Select "Tracks" then "Mix and Render" from the menu.

  19. Export! : Now that we have one single stereo track of the movie, and the riff, we can now export to a usable audio file. The way I prefer to do this is to simply export as a .wav file from Audacity, and then use the ffmpeg tool (or avconv) to encode this wav file to the format desired. This is described in the next step. If however you would like Audacity do some of the work, you could export to a format like .mp3, or aac, but this may require extra setup of Audacity.

  20. Home Stretch! Mux the new audio with the movie video / audio: I prefer to MUX and convert the audio and video into the mp4 container, targeting devices like the chromecast. This also makes it more "Plex friendly", if that's something you're into.

    Here are the options that I use for making my final output file. Note, that changing the option for -crf will effect the quality, and therefore the size of the output file (replace [input], [output], and audio_combined.wav with the appropriate file names):

    ffmpeg -i [input] -i audio_combined.wav -map 0:0 -map 1:0 -map 0:1 -c:v libx264 -profile:v high -level 4.1 -crf 30 -maxrate 10M -bufsize 16M -pix_fmt yuv420p -x264opts bframes=3:cabac=1 -movflags faststart -c:a:0 libfdk_aac -b:a:0 320k -metadata:s:a:0 language=eng -c:a:1 libfdk_aac -b:a:1 320k -metadata title="my title" -y [output]

    If you have a movie with subtitles (for foreign language sections for example), consider "burning" the subtitles to the video track itself. The easiest way to do this is with the .srt files for the movie. These may be on the disk, or you may have to look for them elsewhere. Use the following command to convert them for ffmpeg:

    ffmpeg -i subs.ass

    Then, like the encoding command for ffmpeg above, use something like this:

    ffmpeg -i [input] -i audio_combined.wav -map 0:0 -map 1:0 -map 0:1 -c:v libx264 -vf ass=subs.ass -profile:v high -level 4.1 -crf 30 -maxrate 10M -bufsize 16M -pix_fmt yuv420p -x264opts bframes=3:cabac=1 -movflags faststart -c:a:0 libfdk_aac -b:a:0 320k -metadata:s:a:0 language=eng -c:a:1 libfdk_aac -b:a:1 320k -metadata title="my title" -y [output]

    If you prefer to simply keep using the mkv format, simply use the tool MKVmerge and add your original .mkv, and then add your combined rifftrax audio file, and start muxing.

  21. Enjoy your perfectly synced, high quality video, high quality audio rifftrax!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment