我想使用 bench 过滤器作为 sidechaincompress 过滤器。但是,很难让 bench 过滤器工作。这是原始命令:
.\ffmpeg.exe -benchmark -y -i .\main_mono.mp3 -i .\sidechain_441_mono.mp3 -filter_complex "[0:a][1:a]sidechaincompress=threshold=0.015:ratio=2:level_sc=1:release=200:attack=30" main_sc3.wav
我参考了 bench filter 的代码并按照如下方式进行操作:
int64_t start = av_gettime();
ret = av_buffersrc_add_frame_flags(abuffer_ctx_1, frame1, AV_BUFFERSRC_FLAG_PUSH);
ret = av_buffersrc_add_frame_flags(abuffer_ctx_2, frame2, AV_BUFFERSRC_FLAG_PUSH);
ret = av_buffersink_get_frame_flags(abuffersink_ctx, filt_frame, AV_BUFFERSINK_FLAG_NO_REQUEST);
const int64_t stop = av_gettime();
const int64_t diff = stop - start;
// calc by myself
但是,我仍然希望在命令行中运行 Bench Filter。这是我找到的示例
ffmpeg -i main.mp3 -filter_complex '[0]ametadata=mode=add:key=lavfi.testkey1:value=blahlbah[1];[1]ametadata=mode=print:file=metadata.txt[2]' -map [2] .\output3.mp3
多谢。