I'm trying to capture the output of ffprobe to assign to two variables - currently I just run the loop twice to captue the encoder and codec_name tag. Is there a more effcient way to do this from within a single loop?
for /F "delims=" %%i in ('ffprobe -v error -show_entries format_tags^=encoder -of default^=nw^=1:nk^=1 %%a 2^>^&1') do set "encoder=%%i"
echo !encoder!
for /F "delims=" %%j in ('ffprobe -v error -show_entries stream^=codec_name -of default^=nw^=1:nk^=1 %%a 2^>^&1') do set "codec_name=%%j"
echo !codec_name!
Here's the full code for info - it's a batch reverse function in FFMPEG.
@echo off
md "%cd%\_reversedFiles"
for %%a in (*.wav) do (
SETLOCAL enabledelayedexpansion
for /F "delims=" %%i in ('ffprobe -v error -show_entries format_tags^=encoder -of default^=nw^=1:nk^=1 %%a 2^>^&1') do set "encoder=%%i"
echo !encoder!
for /F "delims=" %%j in ('ffprobe -v error -show_entries stream^=codec_name -of default^=nw^=1:nk^=1 %%a 2^>^&1') do set "codec_name=%%j"
echo !codec_name!
ffmpeg -i %%a -af areverse -c:a !codec_name! "\_reversedFiles\%%~na.wav"
bwfmetaedit "\_reversedFiles\%%a" -a --ISFT="!encoder!"
)
For ease of sharing it needs to be in a batch file.