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 that? I use Windows XP.
A:
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.
cobbal
2010-03-09 09:45:17
i said i need it with Quicktime-API
Berschi
2010-03-11 08:55:02
+1
A:
Sorry if I am stating the obvious, but you should be able to achieve this the same way as described here:
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
...
Bjoern
2010-03-10 09:02:59
i tried this way, and QuickTime also creates a WAV-File, but it has only 84kb size... so you can say there is no data in it... why?
Berschi
2010-03-15 09:11:40
if you check the return value of ConvertMovieToFile() - does it return a value != noErr? The return value might give hint on what goes wrong in this case...
Bjoern
2010-03-15 09:45:16
return value == noErr; do I have to iterate over every frame (or: does ConvertMovieToFile() just export the sound of 1 frame?)? or should your code export the complete WAV?
Berschi
2010-03-15 10:06:14
It should export the complete audio. It worked fine when I tested it yesterday. How may files have you tried?Furthermore, I used the code from my answer linked above to aquire the Movie of the QuickTime file. Did you use something different? If, so this might be the reason the code behaves differently...
Bjoern
2010-03-15 11:31:11
that was the problem, I used a AVI-file, not a MOV-file. Thank you so much! :-)
Berschi
2010-03-15 11:43:18
A:
with mplayer mplayer.exe -ao pcm:file=output.wav -vo null -vc dummy input.mov