soundchaser128 / clip-mash

Generates compilation videos semi-automatically
GNU General Public License v3.0
50 stars 8 forks source link

cropping error for 854x480 video's #75

Open gptstyles opened 7 months ago

gptstyles commented 7 months ago

I'm running the latest version in docker, some videos (eg one with: 854x480 resolution) gives me an error when the clips encode. Running the docker with RUST_LOG=debug, this is the ffmpeg command causing the error.

ffmpeg -hide_banner -loglevel warning -ss 7.509 -i "input.mp4" -t 1.877333641052246 -c:v libx264 -preset medium -crf 24 -filter_complex "split [original][copy];[copy] scale=ih16/9:-1, crop=h=iw9/16, gblur=sigma=120, eq=brightness=-0.125[blurred];[blurred][original] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2, fps=30, scale=1280:720" -acodec aac -ar 48000 output.mp4

which gives error: [Parsed_crop_2 @ 000001c442d2d700] Invalid too big or non positive size for width '852' or height '480' [Parsed_crop_2 @ 000001c442d2d700] Failed to configure input pad on Parsed_crop_2

I commented here: https://github.com/soundchaser128/clip-mash/commit/515cfd3e8bfa884237f261a72ec11ab8a2576c03#r137951506 with a possible fix, not sure if it works in all situations. It may have some unwanted side-effects when te target video is 'portrait mode' aspect ratio.

soundchaser128 commented 7 months ago

Hi, thanks for the report. Yeah, that's an issue I've seen as well. I've played around with this filter a few times and it seems to have trouble when the aspect ratio of the compilation is something like 16:9, and the input video is e.g. 2:1 or something wider like that. I'll try your suggestion and see if it helps.