I installed motion in a laptop with fairly powerful CPU and video card. The USB camera’s framerate with motion is always very slow (like 4-5 FPS under the resolution of 1024 * 768). According to the specification from the camera’s vendor, the camera should be able to reach 30 FPS for this resolution.I checked the methods mentioned in the following posts and there are some improvements but still the framerate is less than ideal:
Some people said it is about the CPU limitation of Raspberry Pi but I am not using RPi anyway and thus this explanation is invalid. Finally, after some research, I discover that it is the option [v4l2_palette] in /etc/motion/motion.conf that does the trick. You need to set it to: 8 (which stands for ‘MJPEG’ according to the comments in motion.conf) to make it work. The default 17 (stands for ‘YU12’ according to my configuration file) works, but the FPS is always low. As I understand, MJPEG mode would compress the video extensively, which could lead to a slightly lower video quality but usually viewers should not be able to notice that.
To solve the question, reference is made to this post which is about the difference about MJPEG and YU12 (Chinese only): https://blog.csdn.net/zht9961020/article/details/6962063