When I started making videos of me playing guitar, I was using a small Nikon Finepix camera and noticed that the audio coming from the camera wasn’t the best quality. Then I decided that the fastest and cheapest way to get better audio was to get a USB microphone and I settled on the Blue Yeti because it could record in Stereo mode. But then I had another problem: I had to get the audio from my camera to match up with the audio that I was going to use from the USB microphone.

 

Syncing audio and video has got to be the most time consuming and somewhat frustrating task when it comes to making videos for Youtube. Nowadays I record video with the Sony A5000 which has decent sound, but the stereo microphones are located right next to the lens and there’s subsequently a lot of noise from the motors that control autofocus and stability.

 

What I used to do was extract the audio from the video, and then open both the camera audio and the USB mic audio in audacity and sync them there with the time shifter tool. Then I could export the newly mapped audio file as a fresh soundtrack and use that in my video, subsequently deleting the camera’s generated audio. There are all sorts of tutorials going about how to do this on Youtube and that’s what gave me the idea.

The HP Mini Laptop that runs Peppermint OS

 

 

But then I switched to a better video editor which let me see the audio waveform of both the camera and the microphone’s audio, so my next step was to do the audio syncing directly in the NLE. I don’t think this is as precise as doing it in Audacity because in Audacity I could literally zoom up to within microseconds on the waveform, but it was good enough for the video.

 

But this would also be time consuming and sometimes very slow and frustrating when dealing with large video files. Sometimes the lagging software would mean that I would have to wait for the mouse actions to load before doing anything else. Very frustrating.

 

 

Then I decided to search for ways to do this automatically and I found Shenidam. It’s a programme just for Linux but I happen to have an HP Mini laptop that runs Peppermint OS 8, so I decided to build Shenidam on that machine. But building software for me is time consuming and always involves extra steps.

 

Here's how I went about building Shenidam for the HP Mini computer:

 

On the getting started page it lists the various dependencies but then only has the source code. I didn’t feel like building even more software, so luckily I could use the builds in the repositories to speed up the process. Some of the things that I had to do were:

 

sudo apt install libsamplerate
sudo apt install libav-tools
sudo apt install libfftw3-double3
sudo apt install fftw3-dev
sudo apt install libboost-all

And then everything would compile correctly. Now all I needed to do was to shoot some videos with my camera, and simultaneously record the sound with my USB mic, and let Shenidam do its magic.

 

But when it comes to doing stuff automatically, I needed to go all in. All the way. Now I had fifteen camera files, fifteen audio files and damned if I were going to sync those one at a time. I needed a script to do this for me.

 

First I needed to get the audio out of my camera files. I organized my files so that the camera and audio files had the same name, except of course that the camera files have the extension .MTS and the microphone .WAV. Next, in DOS, I ran this to extract all the audio, convert it as a wav file and add the prefix cam-

 

for /R %i in (*.MTS) DO ffmpeg -i "%i" -vn -c:a pcm_s16le "cam-%~ni.wav"

 

I couldn’t seem to use the camera’s native AAC format because Shenidam silently fails when you attempt to use it on two different audio formats. So the camera audio here gets converted and saved in a .WAV container.

 

Next, armed with the audio from the microphone and the newly extracted camera audio, I plugged my drive into the HP Mini and under bash ran the following script:

 

for f in cam-*.wav; do shenidam -b ${f#cam-} -i $f -o ${f%%.*}-mapped.wav; done

 

Which would add the extension -mapped to the microphone audio and map it to a new file. Done!

 

Generally this method works really well although it really depends on microphone placement. I think if your microphone’s audio shows heavy clipping then Shenidam doesn’t work so well. But otherwise it’s a great tool.