A new MPEG-2-to-H.264 video transcoding algorithm based on regions of interest (ROIs) is proposed. The whole transcoding scheme, including the ROI detection, is applied in the compressed domain to alleviate the computational load. The ROI detection uses the motion information from the partially decoded MPEG-2 bitstream. Then the ROIs that are likely to attract the viewer's attention are transcoded with drift compensation to provide better quality, while other regions are transcoded without drift compensation to save computational complexity. Experimental results show that our algorithm provides a better trade-off between computational complexity and picture quality. It achieves a speedup of 2 times over the closed-loop transcoding algorithm in the compressed domain, while giving comparable visual quality.