Menu

How do I covert audio sample rate

Carmen
2010-01-13
2012-10-29
  • Carmen

    Carmen - 2010-01-13

    I have a video that I'm stripped the audio from, its sampled at 48000 when I
    strip the audio I'd like it to be 44100. How do I go about doing that? I have
    the graph the creates the wave file, I'd just like to know how I input put the
    sample rate info, in a filter, in a pin?

    Thanks

     
  • snarfle

    snarfle - 2010-01-13

    It isn't simply a matter of setting the media type. You need a filter that
    will actually re-sample the audio down to 44100. Don't know of one off-hand.
    I've just never needed one.

    In general, however, you just set the audio media type the same way you set a
    video type. The most common value (that I've seen) uses a WaveFormatEx struct.
    I don't know how useful it would be, but you can see some fiddling with audio
    in Samples\DMO\DmoSplit\dmo\DmoSplit.cs

     
  • Carmen

    Carmen - 2010-01-13

    So I can't just set one of the filters in my graph to output 44100?

     
  • snarfle

    snarfle - 2010-01-13

    It isn't just a simple matter of changing a value in the .wav file's header.
    Someone actually needs to discard the excess data from the stream. Preferably,
    whoever does it don't just chop off the extra bits, but averages things out to
    keep the best possible audio quality.

    And to do that, someone has to write code. Probably not a lot of code, but
    someone's got to do it. So, yes, what you need is a filter that will take an
    input of 48000 and let you set the output pin to 44100, but the filter needs
    to have the smarts built in to understand what that means and to do the work
    accordingly. I just don't think MS provides one by default.

    So, you will either need to find such a filter, or consider some other format
    (like WMA) that has a filter made for it.

    Also, there are undoubtedly utilities out there to do this as well.

     

Log in to post a comment.

Auth0 Logo