I Want to make a script that using ffmpeg looks for errors in files. But I can't redirect the output of ffmpeg to a file, it always displays errors in the console. my script:
@echo off
set LOGFILE=error_check.log
call :LOG > %LOGFILE%
exit /B
:LOG
for /r %%A IN (*.mp4) DO (
echo "%%A"
ffmpeg.exe -hwaccel auto -v error -i "%%A" -f null -
)
exit
I tried redirecting the output of ffmpeg using ">>", but that didn't work either. I also tried using the option -report together with -loglevel error in ffmpeg, but it outputs way too much I only want error information.
>
is an abbreviation for 1>
, which redirects STDOUT.
Errors usually are printed to STDERR, which is stream 2. To redirect STDERR, use 2>
.
To redirect both, use 1>... 2>&1
(STDOUT to ..., STDERR to wherever STDOUT is redirected to)
A fully detailed description is available at SS64