Soo I need to use a video reader which onl accepts yuv420. I have videos which are yuv444 and have very weird resolutions (they come from an algorith and they are videos manually created stacking frames)
Soo I tried the following
ffmpeg -i CJMOPvsinJE.mp4 -pix_fmt yuv420p yuv420.mp4
But it seems that resolution have to be even.
[libx264 @ 0x556e02626660] width not divisible by 2 (241x1080)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Sooo I solved it by cropping.
ffmpeg -i CJMOPvsinJE.mp4 -filter:v "crop=240:1080:1:0" -pix_fmt yuv420p yuv420.mp4
Buuut The fact is that I need to perform this operation for a bunch of videos.
Is there a way to tell ffmpeg to crop to the nearest even resolution? Namely, if resolution is odd just to remove 1 row/column.