【发布时间】:2010-02-15 09:51:20
【问题描述】:
我想使用 QuickTime-API 导出 MOV 文件的音频媒体并将其保存到 WAV 文件(或其他类似文件)。我怎样才能做到这一点?我使用的是 Windows XP。
【问题讨论】:
-
您愿意使用 Quicktime-for-Java api 吗?
我想使用 QuickTime-API 导出 MOV 文件的音频媒体并将其保存到 WAV 文件(或其他类似文件)。我怎样才能做到这一点?我使用的是 Windows XP。
【问题讨论】:
对不起,如果我说的是显而易见的,但您应该能够以与此处所述相同的方式实现这一点:
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
...
【讨论】:
ffmpeg 很容易做到这一点,如果商业软件需要,可以在 LGPL 下编译。如果您需要更多可定制的钩子,您可以使用同一项目中的 libavcodec 和 libavformat。
【讨论】:
带播放器
mplayer.exe -ao pcm:file=output.wav -vo null -vc dummy input.mov
【讨论】: