The paper proposes a novel algorithm to enhance the quality of H.264/AVC compressed video sequences by using an inloop spatio-temporal motion compensated lter (MCSTF). Extra information from surrounding coded frames are used together with the information of the current coded frame to reduce the coding artifacts. With the availability of the original frame, the MCSTF coef cients are optimized at the encoder and then are implemented at the decoder. Furthermore, an overlapped motion compensated scheme is proposed to reduce the blocking artifacts from surrounding motion compensated frames. Simulation results are judged by PSNR and ickering metric.