In many distributed wireless surveillance applications, compressed videos are used for performing automatic video analysis tasks. The accuracy of object detection, which is essential for various video analysis tasks, can be reduced due to video quality degradation caused by lossy compression. In particular, it has been found that current standardized video encoding schemes cause temporal fluctuation for encoded blocks in stable background areas of a raw video, which has a strong effect on the accuracy of object detection. To obtain better object detection performance on compressed videos, this paper proposes a standard-compliant video encoding scheme that can suppress unnecessary temporal fluctuation in stable background areas. The proposed scheme uses the Sum-of-absolute Frame Difference (SFD) to measure the degree of temporal fluctuation for stable background blocks. New mode decision strategies are designed for both intra and inter frames with the objective to reduce SFD while maintaining acceptable rate-distortion performance. Experimental results show that, compared with traditional encoding schemes, the proposed scheme improves the performance of object detection and results in lower bitrate with comparable quality in terms of PSNR and SSIM.