Now a day multimedia applications are growing rapidly and at the same time the volume of video transactions is raising exponentially. This demands an efficient technique to encode the video and to reduce the congestion in the transmission channel. This paper presents an improvisation technique; weighted encoding for High Efficiency Video Coding (HEVC). This method optimizes the spatial and temporal redundancy during the motion compensation by the optimal choice of code block. The blocks are chosen on the basis of weights- assigned to it using the firefly algorithm. On encoding it reduces the size of the video with perceptually better quality video or Peak Signal to Noise Ratio (PSNR). © Springer Nature Singapore Pte Ltd. 2018.