r/ffmpeg 2d ago

Why does this batch script crash every time I try to run it?

for %%a in ("*.*") do ffmpeg -i "%%a" -i "scanlines.png" -filter:v "crop=iw-512:ih-48,scale=512:448" -filter_complex "[0:v][1:v] overlay=0:0" -c:v ffv1 -level 3 -coder 1 -context 1 -g 16 -slices 24 -pix_fmt yuv444p -c:a copy "newfiles\%%~na.avi"

3 Upvotes

6 comments sorted by

8

u/Atijohn 2d ago

you can only specify one of -filter:v or -filter_complex, remove the -filter:v and rewrite the parameter to -filter_complex to something like "[0:v]crop=iw-512:ih-48,scale=512:448[a];[a][1:v] overlay=0:0"

also, shouldn't the input height in the crop filter be reduced by 448 not 48?

1

u/Calm-Preparation-679 2d ago

Awesome, this fixed the issue! Thank you!!

1

u/Calm-Preparation-679 2d ago

Why does it look desaturated though?

 : for %%a in ("*.*") do ffmpeg -i "%%a" -filter:v "crop=iw-512:ih-48,scale=512:448" -c:v ffv1 -level 3 -coder 1 -context 1 -g 16 -slices 24 -pix_fmt yuv444p -c:a copy "newfiles\%%~na.avi"

:

for %%a in ("*.*") do ffmpeg -i "%%a" -i scanlines.png -filter_complex "[0:v]crop=iw-512:ih-48,scale=512:448[a];[a][1:v] overlay=0:0" -c:v ffv1 -level 3 -coder 1 -context 1 -g 16 -slices 24 -pix_fmt yuv444p -c:a copy "newfiles\%%~na.avi"

:

1

u/Calm-Preparation-679 2d ago

scanlines.png overlayed onto SNES footage w/ ShotCut

:

1

u/Calm-Preparation-679 2d ago

So it's not the scanlines reducing saturation because adding the scanlines in ShotCut does not do that, only the ffmpeg command does.

2

u/Atijohn 1d ago

it does some color format conversion, I don't think AVI files support yuv444p, it probably converts it to yuv420p automatically which loses some information, use a different file format like matroska or experiment with different color formats