Menu

Retrieving PCM from a video file

2009-09-22
2012-10-29
  • kabilius kabilius

    Hi all,

    I have no problem retrieving the PCM of audio files. I basically set _ammediaType.subType = MediaSubType.PCM; _ammediaType.formatType = FormatType.WaveEx;

    However, I am having a difficult time getting the PCM samples from video files
    (the video files contain audio stream as well)
    I let the get_StreamMediaType() method fill the AMMediaType structure for me,
    then I override the subType = MediaSubType.PCM, but I got an run-time error at
    filter.connect()
    No combination of intermediate filters could be found to make the connection

    Could anyone tell me how to get the PCM samples of the audio stream in a video
    file?

    Thank you,
    kab

     
  • snarfle

    snarfle - 2009-09-22

    Are you sure that the video file in question stores its audio samples as PCM?

     
  • kabilius kabilius

    Hi Snarfle,

    The subType of the audio stream in the video file is
    00000161-0000-0010-8000-00AA00389B71 which is WMMEDIASUBTYPE_WMAudioV2 in
    Windows Media Type.
    Here is the link: http://msdn.microsoft.com/en-
    us/library/dd757532%28VS.85%29.aspx

    Does that mean I cannot interpret its audio stream with PCM?

    What I am trying to accomplish is to draw waveforms by calculating the PCM of
    media files.

    Thank you,
    kab

     
  • snarfle

    snarfle - 2009-09-23

    Have you tried rendering the file in graphedt? You can check the output types
    for each of the filters. Presumably somewhere before you hit the renderer, the
    type will be what you need.

    What that information, you can build the graph the does what you need.

     
  • kabilius kabilius

    Hi snarfle,

    I just tried rendering my audio file connection (I got the PCM) and video file
    connection (I got something else other than the PCM) with GraphEdt, and I
    think I found the problem.

    Audio File connection:

    Video File connection:

    It seems like I need to connect the audio pin instead of the video pin to the
    input of the BaseGrabber Filter.

    I connect the two pins with the following code IPin iPinSrcOut = DsFindPin.ByDirection(baseSrcFlt, PinDirection.Output, 0);
    so I thought changing the index from 0 to 1 would fix the problem.

    IPin iPinSrcOut = DsFindPin.ByDirection(baseSrcFlt, PinDirection.Output, 1);

    But it doesn't seem to be as simple as I thought. When I connect the pin, I
    got an expcetion:

    {"No combination of intermediate filters could be found to make the
    connection."}

    Is it because the audio stream in the VideoFile is different from the audio
    stream in the AudioFile? or am I just totally off by replacing the 0 with 1 to
    the ByDirection parameter?

    Thank you,
    kab

     
  • snarfle

    snarfle - 2009-09-24

    While you have the wmv file open in GraphEdt, right click on the audio pin and
    check out its media type. What do you see?

    Also, right click on the audio pin, and choose Render. What does the new graph
    look like?

     
  • kabilius kabilius

    Hi snarfle,

    I open the wmv file by rendering the media file; when the media file is
    loaded, I right clicked on the audio out pin, and select "Pin
    Properties". When I click on the "Pin Properties", it gave me
    an error "The requested property page could not be displayed".

    Here is a link to the file which I am working with, could you please take a
    look?

    http://s169433840.onlinehome.us/myVideoFile.wmv

    Thank you,
    kab

     
  • chossette

    chossette - 2009-09-24

    Have you try register (regsrv32) proppage.dll ?

     
  • kabilius kabilius

    Hi chossette,

    Ahh, thanks, I just registered proppage.dll, and I am able to see the audio
    type now.

    Here is a screenshot of the auido type: http://s169433840.onlinehome.us/audio
    MediaTypeOfVideoFile.JPG

    One thing that I noticed was the Sample rate. The Sample rate is 44.100 KHz
    instead of 8.000 KHz (my normal wav file has 8 KHz, and I was able to get the
    PCM samples from it)

    Anyway, I am still trying to figure out how to connect the audio pin instead
    of the video pin to my next filter.
    Any suggestions is appreciated.

    Thank you,
    kab

     
  • snarfle

    snarfle - 2009-09-25

    Remember when I asked you to "right click on the audio pin, and choose
    Render. What does the new graph look like?
    " How did that turn out?

     
  • kabilius kabilius

    Hi snarfle,

    Sorry I forgot to mention that part of the test.
    The "Render Pin" is non-responsive.. I right clicked on the audio
    pin, and I clicked on "Render Pin", but nothing happened, I clicked
    on "Reconnect Pin", and nothing happened either.

    Any idea?

    Thank you,
    kab

     
  • snarfle

    snarfle - 2009-09-25

    Hmm. That's odd. I don't think I've seen it do that. I've seen it not work,
    but it usually gives a (useless) error message.

    How about adding an audio renderer and dragging a line between the two?

     
  • kabilius kabilius

    Hi snarfle,

    I added a "Default WaveOut Device" as the audio renderer, and
    dragged a link between my Raw Audio and the Default WaveOut Device, then I got
    a green box WMAudio Decoder DMO0009 in between the two.

    Is that what you wanted to know?
    Thank you,
    kab

     
  • snarfle

    snarfle - 2009-09-29

    And what is the output type of the "WMAudio Decoder?" Is it the PCM
    you were looking for? If so, when you build your graph, add that filter
    between the reader and the grabber.

     

Log in to post a comment.