gpt4 book ai didi

windows - ffmpeg 在 forfiles 循环中调用时覆盖输入文件

转载 作者:行者123 更新时间:2023-12-04 23:07:17 26 4
gpt4 key购买 nike

我需要使用 ffmpeg 加入几个 mp4 和 wav 文件对。
当我运行指定文件名的命令时,它运行良好:.\ffmpeg.exe -i file01.mp4 -i file01.wav -c:v copy -c:a aac -b:a 96k file01_new.mp4但是当我将此调用集成到 forfiles 循环中时,源 mp4 文件被覆盖,输出 mp4 文件仅包含音频:forfiles /M "*.mp4" /C ".\ffmpeg.exe -i @FNAME.mp4 -i @FNAME.wav -c:v copy -c:a aac -b:a 96k @FNAME_new.mp4"我真的不明白在加入 MP4 和 WAV 文件之前会发生什么。为什么源 MP4 被覆盖?
如何编写此脚本以使其工作?谢谢您的支持。

最佳答案

让我推荐使用 for 而不是 forfiles , 因为后者非常慢并且它扩展了它的 @ - 带有引号的变量,这可能是有问题的:

rem // Create sub-directory for resulting files, so resulting files cannot become reprocessed:
2> nul md "result"
rem // Loop through `*.mp4` files:
for %%I in ("*.mp4") do (
rem /* Process current file, together with the related `*.wav` file,
rem and write the result into the new sub-directory: */
ffmpeg.exe -i "%%~I" -i "%%~nI.wav" -c:v copy -c:a aac -b:a 96k "result\%%~I"
)

关于windows - ffmpeg 在 forfiles 循环中调用时覆盖输入文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65348862/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com