Hein (fub) wrote,
Hein
fub

  • Mood:

Recipe for YouTube with better sound

The new camera also takes movies -- we have already inflicted some of those to you.

The camera produces Quicktime clips, but YouTube prefers XviD video and MP3 sound. I use AviSynth to frame-serve the clips to VirtualDub, in order to make an AVI with the right compressions. But the sound quality when the clip appears on YouTube is quite dreadful. Through some tweaking, I found the ideal solution to that.

First, make an AviSynth script that merely serves the video:

DirectShowSource("D:\Incoming\P4260009.MOV")

Open this script in VirtualDub, and demux with File | Save WAV. The sound is converted into WAV, and saved seperately. However, the problem is that the sample rate of the Quicktime clip is quite low, giving the WAV an equally low sample rate. When you convert this into MP3, sound quality really degrades quite a lot.
The trick is to upsample the WAV. I use WaveWizard for that. Just add the file, and click 'Convert' -- this will upsample the WAV into a 14.400KHz WAV.

Next, change your script so that it will mix in the WAV-file as audio:

DirectShowSource("D:\Incoming\P4260009.MOV", audio=false)
audiodub(wavsource("D:\Incoming\P4260009.MOV"))

Again, open this script with VirtualDub. Choose XviD as compression for the video, and choose an MP3 codec for the audio. Take the largest sampling rate, and highest bitrate. If you have more than one, check to see which one will go the highest -- take that one.
Save the file as an AVI, and convert. Now you have a clip that will be speedily converted by YouTube with acceptable audio quality.

If you took your clip while holding the camera in portrait mode, YouTube will stretch your video, making it quite ugly. Add the following lines at the end of your script to turn your video right-side-up and add black bands to the left and right to preserve the aspect ratio:

TurnRight()
AddBorders(80, 0, 80, 0)

(You may need to adjust the values for AddBorders to fit the size of your video.)

Probably, no-one will use this recipe anyway, but I felt a need to just record this trick for posterity.
Tags: tools
Subscribe

  • Mock Chicken

    The Judge Dredd comics are an interesting artefact of the 1980s: it’s what British comic writers thought how the US urban landscape would…

  • Friday Five: Food

    Food is an important subject of this blog, so I couldn’t pass up a food-themed Friday Five. 1) What is your favourite food? Okonomiyaki, no…

  • Baking

    I have been making chocolates with flexible silicone molds, because those are easy to get the chocolate out of once it’s been set. I did try…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments