2 ms·
it's worth noting there's pretty trivial ffmpeg solutions with the lenscorrection filter for people who don't need any accuracy and just want to stop looking li
by kristopolous 6y ago
it's worth noting there's pretty trivial ffmpeg solutions with the lenscorrection filter for people who don't need any accuracy and just want to stop looking like a distorted alien. (https://www.danielplayfaircal.com/blogging/ffmpeg/lensfun/v360/lenscorrection/fisheye/dodgeball/2020/03/24/correcting-lens-distortion-with-ffmpeg.html https://www.danielplayfaircal.com/blogging/ffmpeg/lensfun/v3...)
Dima's solutions in mrcal are way more accurate and can even accommodate manufacturing imperfections with localized warping and other less-than-perfect real world realities but for the times such things don't matter (like say correcting a webcam for your zoom calls instead of, say, landing on mars), there's always lenscorrection.
If you're trying to set up a really basic pipeline for lens correction (more like adjustment) in linux that works with the web browser and apps here's a gross simplification
1. create a virtual v4l device with the v4l2loopback module, set exclusive_caps=1 (example: modprobe v4l2loopback devices=1 exclusive_caps=1)
2. Do something like ffmpeg -i /dev/video0 -vf "lenscorrection=cx=0.5:cy=0.5:k1=-0.015:k2=-0.072" -f v4l2 /dev/video2 where the first argument is the real video and the second is the virtual (do v4l2-ctl --list-devices) to see the devices
3. Point teams or whatever to the virtual device, /dev/video2 in this example.
You can use this same trick to force resolutions, compression ratios, rotate and mirror webcams - it's pretty useful.