CMD 等同于调用 FFPROBE 中的 linux wc -l 命令?
CMD equivalent of linux wc -l command within a call to FFPROBE?
这个答案会解决我的很多问题,但依赖于 wc -l 来计算 ffprobe 输出的音频通道数。
我正在使用 Windows 批处理文件,所以我需要另一种方法在 CMD 中完成以下操作:
-filter_complex "[0:v]scale=w=1920:h=1080:force_original_aspect_ratio=1,pad=1920:1080:(ow-iw)/2:(oh-ih)/2[video];[0:a]amerge=inputs=$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 input.mov | wc -l),atempo=24000/24024[audio]"
有什么帮助吗?我的编程经验很少。这个问题似乎在问同样的事情,但我似乎无法将其建议调整到 ffprobe 调用中,最终结果是它只返回一个数字。
这是未经测试的,因为我没有安装您的程序。但本质上,您需要做的是使用 FOR /F
命令捕获 ffprobe 的输出。您将 FFPROBE 的输出通过管道传输到 FIND
命令以获得非空行计数。
FOR /F "delims=" %%G in ('ffprobe -loglevel error -select_streams a -show_entries stream^=codec_type -of csv^=p^=0 input.mov ^| find /v /c ""') do set "count=%%G"
然后您可以在 FFMPEG 命令中使用变量 %count%
。
这个答案会解决我的很多问题,但依赖于 wc -l 来计算 ffprobe 输出的音频通道数。
我正在使用 Windows 批处理文件,所以我需要另一种方法在 CMD 中完成以下操作:
-filter_complex "[0:v]scale=w=1920:h=1080:force_original_aspect_ratio=1,pad=1920:1080:(ow-iw)/2:(oh-ih)/2[video];[0:a]amerge=inputs=$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 input.mov | wc -l),atempo=24000/24024[audio]"
有什么帮助吗?我的编程经验很少。这个问题似乎在问同样的事情,但我似乎无法将其建议调整到 ffprobe 调用中,最终结果是它只返回一个数字。
这是未经测试的,因为我没有安装您的程序。但本质上,您需要做的是使用 FOR /F
命令捕获 ffprobe 的输出。您将 FFPROBE 的输出通过管道传输到 FIND
命令以获得非空行计数。
FOR /F "delims=" %%G in ('ffprobe -loglevel error -select_streams a -show_entries stream^=codec_type -of csv^=p^=0 input.mov ^| find /v /c ""') do set "count=%%G"
然后您可以在 FFMPEG 命令中使用变量 %count%
。