mkv or mp4 shouldn't matter because they get decoded before getting filtered. Try removing just that option ( :force_divisible_by=2 ) and see if it works.
That select filter is a lot to digest, here I'll highlight some of the key tunable numbers so you can adjust it and find what works best for your content.
ffmpeg -i "video" -vsync vfr -vf "select=if(gt(scene\,0.5)*(isnan(prev_selected_t)+gte(t-prev_selected_t\,2))\,st(1\,t)*0*st(2\,ld(2)+1)\,if(ld(1)*lt(ld(2)\,4)\,between(t\,ld(1)+2\,ld(1)+4))),scale=320:180:force_original_aspect_ratio=decrease:flags=bicubic+full_chroma_inp:sws_dither=none,framestep=2,setpts=N/(12*TB)" -an -sn -map_metadata -1 -compression_level 5 -q:v 75 -loop 0 -f webp -y "out.webp"
1st "2" is the minimum number of seconds between captured scene cuts.
2nd "4" is n+1 number of scene cuts to capture.