Using DShow for mp3 encoding/decoding

Started by
3 comments, last by Crispy 20 years, 1 month ago
Although I''ve never done this, I know you can write a samplegrabber filter in DirectShow to dump practically any format DShow supports (from mp3 to DivX avi via appropriate 3rd party codecs) into raw data (wav or uncompressed avi). However, is it also possible to "upload" samples into an encoded stream to force DShow act as an encoder? For instance, is it possible to encode a wav file into an mp3 stream and then extract the compressed stream? I know MS has paid the royalties for all of the formats DX decodes - I''m just wondering if the royalties they paid also extend that far.

"Finishing in second place, simply means you are the first loser." - PouyaCat
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Advertisement
Encoding is pretty simple and shouldn''t need filter development. The WAV file can be used with the file source filter to get the PCM samples into the graph. You then need further filters to encode and save the data out again. There is no MP3 encoder filter as standard with DirectShow, only a decoder. There is a WMA encoder filter (WM ASF Writer).

Use the GraphEdit tool from the DX SDK to test all this.
Hmm. Thanks - although what you say sounds slightly vague. I''ve had problems with the comprehensiveness of the DirectX API as a whole before (for instance, I simply couldn''t get myself to read all the things I needed to get up to speed on the decoder filter development, so the terminology used (sinks, pins, etc) finally forced me to resign). I''ve run some basic searches on Google on the topic, but evidently nothing much is just available as it is (not really looking for source code, but a simplified approach). Can you possibly provide me with a link?


"Finishing in second place, simply means you are the first loser." - PouyaCat

"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
If you want to develop your own filters you are going to have to force yourself to read through the SDK and samples, painful as it is :-)

If you just want to use existing filters then testing with GraphEdit is easist way to start. Render a file (which will create a playback graph) and then swap out filters to create a recompression graph. As I said, there is no MP3 compression filter as standard but there are plenty on the web.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directX/htm/simulatinggraphbuildingwithgraphedit.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/htm/buildingtherecompressiongraph.asp
Thanks again, AP. I'm interested in MP3 output, but unfortunately not just because I'm "interested" so the reading up part's probably going to be just a load of pain . Anyway - I appreciate the clickenses!


"Finishing in second place, simply means you are the first loser." - PouyaCat 



[edited by - crispy on March 20, 2004 3:03:35 PM]
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared

This topic is closed to new replies.

Advertisement