I'm trying to transcode mp4 to webm format in a lossless way. I tried two ways to do that.

For that purpose, I extracted mp4 video to image sequences (png). Then, I converted image sequence(without changing any frame) to webm video with a lossless flag. But, when i extract webm video to image sequences and compared with the images that i extracted from mp4 video, i realized that PSNR values were not infinity. It changes from between around 53-55 dB.

On the other hand, I directly transcoded mp4 to webm with a lossless flag. Then, I extracted image sequences from mp4 and webm format and compared PSNR values. This time i realized that PSNR values are infinity.

Encoding image sequences to webm video with lossless flag is not actually lossless. Is this true or am i doing something wrong?

migrated from stackoverflow.com Jan 29 '16 at 19:52

This question came from our site for professional and enthusiast programmers.


The MP4 video will be using some variant of the YUV colorspace, as does VP9. PNG stores RGB pixels. So your MP4 -> PNG -> VP9 pipeline has two colorspace conversions i.e. YUV -> RGB -> YUV. These conversions aren't mathematically lossless.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.