How to export audio-media from a MOV-file with QuickTime-API?
I want to export the audio-media of a MOV-File with the QuickTime-API and save it to an WAV-File (or something equivalent). How can I do t开发者_StackOverflowhat? I use Windows XP.
Sorry if I am stating the obvious, but you should be able to achieve this the same way as described here:
Export every frame as image from a Movie-File (QuickTime-API)
Or do you need to do this in a non-interactive way?
Edit
To export the audio media of a Movie file to WAVE non-interactively using a Movie Exporter, use the following code:
"include "QuickTimeComponents.h"
...
// aquire Movie
...
ComponentDescription desc;
MovieExportComponent exporter;
char filename[255];
FSSpec fsspec;
int flags;
// first we have to find a Movie Exporter capable of eporting the format we want
desc.componentType = MovieExportType;
desc.componentSubType = kQTFileTypeWave; // 'WAVE'
desc.componentManufacturer = SoundMediaType;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
// and create an instance of it
exporter = OpenComponent( FindNextComponent( 0, &desc ) );
// then set up a FSSpec for our output file
sprintf( outfilename, "C:/test.wav" );
c2pstr( outfilename );
FSMakeFSSpec( 0, 0L, (ConstStr255Param)outfilename, &fsspec );
// if you do error handling take care to ignore fnfErr being returned
// by FSMakeFSSpec - we're about to create a new file after all
// then finally initiate the conversion
flags= createMovieFileDeleteCurFile | movieToFileOnlyExport;
ConvertMovieToFile( movie, 0, &fsspec, kQTFileTypeWave, 'TVOD', 0, 0, flags, exporter );
CloseComponent( exporter );
...
// Clean up
...
ffmpeg is easily capable of this and can be compiled under the LGPL if needed for commercial software. If you need more customizable hooks you can use libavcodec and libavformat from the same project.
with mplayer
mplayer.exe -ao pcm:file=output.wav -vo null -vc dummy input.mov
精彩评论