我想用 QuickTime-API 导出MOV文件的音频媒体,并将其保存到WAV文件(或类似的东西)。我怎样才能做到这一点?我使用的是Windows XP。
答案 0 :(得分:1)
很抱歉,如果我说的是明显的,但你应该能够按照这里描述的相同方式实现这一目标:
Export every frame as image from a Movie-File (QuickTime-API)
或者您是否需要以非交互方式执行此操作?
修改强>
要使用电影导出器以非交互方式将电影文件的音频媒体导出为WAVE,请使用以下代码:
"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
...
答案 1 :(得分:0)
ffmpeg很容易做到这一点,如果商业软件需要,可以在LGPL下编译。如果您需要更多可自定义的钩子,可以使用同一项目中的libavcodec和libavformat。
答案 2 :(得分:0)
使用mplayer
mplayer.exe -ao pcm:file=output.wav -vo null -vc dummy input.mov