logo Sign In

Why MPEG2 is not as bad as you may think...

Author
Time

Many thinks that MPEG2 is necessarily a bad codec to use, in particular for HD video - because is old, and there are more sophisticated new video codecs around; well, even if AVC (and VC-1, too) is better - a lot, indeed - this "ancient" codec is quite good.

With this, I don't encourage anyone to compress video using MPEG2 instead AVC, at the contrary; but, when you encounter an MPEG2 hi-def source - like HDTV or D-VHS - please don't discard it immediately!

following this table, if an AVC file size is set to 100%, a comparable quality MPEG2 video should have a file size of about 224%, right?

Ain't that cute? BUT IS WRONG!

PSNR should be used to make comparisons between different encoders or quality settings, but with the same codec, not between different codecs...

Infact, MPEG2 (as AVC and all modern video codecs) takes in account the human vision, and works "tricking" the brain (through the eye).

So, if we have two similar images in perceived quality, PSNR could be a totally wrong method to calculate it... SSIM is a better method!

Example:

Quality: 90, PSNR: 43.06 dB, SSIM: 0.9863, Size: 24308 bytes



Quality: 100, PSNR: 58.44 dB, SSIM: 0.9993, Size: 94169 bytes

As you can see, images are really close in quality, right? But, according to PSNR, the first has only 3/4th quality of the second, while using only our eyes, we should disagree, as we think quality is really close...

Conclusion: even if an MPEG2 source has a lower bitrate in comparison to the same (or comparable) AVC one, it should not (necessarily) means that the MPEG2 has a bad quality! Indeed, sometimes it is surprisingly good, if the bitrate used is adequate - and many HDTV and D-VHS files proves this! So, encoding bitrates and codecs used are only parts of the quality equation, along with master used, encoder type, quality settings etc... and, last but not least, our expectations!

***   ***   ***   ***   ***

Personal thought: as in the late years almost all BD releases are AVC (and, in minor part, VC-1), and MPEG2 is almost abandoned, I think many, if not all, standalone BD players have a superior AVC (VC-1) decoder in comparison to MPEG2; so, maybe the one used, probably in a single chip with AVC, it's an ancient one with lower quality in comparison to newest ones found in e.g. HDTV receivers; also, ffdshow (libavcodec) is considered by many the best MPEG2 decoder and I think is not available in standalone BD players.

So, decoding an MPEG2 source (BD, HDTV, D-VHS etc) with libavcodec, and encode it to AVC (at higher bitrate) using X264 (probably the best AVC encoder), and authoring this to a BD-R, *should* improve a bit the quality, instead of using the MPEG2 file "as is" (if it's BD compliant, of course) authored to BD-R...

Can someone confirm/confute this?

***   ***   ***   ***   ***

Resources:

Video quality characterization techniques

MPEG2 decoders comparison (PDF)

Restoration tips: Kush Gauge™

Sadly my projects are lost due to an HDD crash… 😦 | [Fundamental Collection] thread | blog.spoRv.com | fan preservation forum: fanres.com

Author
Time

_,,,^..^,,,_ said:

As you can see, images are really close in quality, right? But, according to PSNR, the first has only 3/4th quality of the second, while using only our eyes, we should disagree, as we think quality is really close...

I don't know...  When I first looked at these two images (without reading any of the text), the second one definitely looked off.  Inspecting closer the quality was certainly worse by an obvious amount (at least to my eyes).

I don't really know much about PSNR vs. SSIM, but I would venture a guess that if these images were in motion, it would be much more difficult to tell the difference between the two compression levels?

Author
Time

guiser said:


I don't really know much about PSNR vs. SSIM, but I would venture a guess that if these images were in motion, it would be much more difficult to tell the difference between the two compression levels?

 You get the point!

Sadly my projects are lost due to an HDD crash… 😦 | [Fundamental Collection] thread | blog.spoRv.com | fan preservation forum: fanres.com

Author
Time
 (Edited)

AFAIK, MPEG-2 decoding shouldn't differ between different software or hardware... except for:

  • Inverse DCT algorithm (see DGDecode user manual: the difference should be imperceptible to human vision)
  • Error (broadcast glitch) handling
  • Post-processing (deblocking, mosquito noise reduction)

H.264 and H.265 correct the first point by specifying the algorithm that decoders have to use, and of course deblocking is included on the compression side (unless it's turned off like most BDs) instead of being an optional step at the end.

Author
Time

FWIW, my impression has always been that MPEG-2 was a fine codec if you gave it enough bitrate.  Where it falls down is that its bit-starved behavior is much uglier than H.264.  For that reason, H.264's advantage is not really on disc, where space is plentiful, but in things like streaming, where the bitrate is throttled way back by necessity.  I'm sure there's also some minor advantages on disc that derive from this, such as better VBR performance due to better low-bitrate performance, and maybe some other minor things too.  But if you give MPEG-2 30Mbps to work with, my impression was that it could produce fine-looking results.

Project Threepio (Star Wars OOT subtitles)

Author
Time

You are right; a 30mpps is perfect for 1920x1080 16:9 29.97fps, but 20/22mbps is good enough for a 2.35:1 1920x816 23.976fps... Escape From New York was quite good, while Indiana Jones trilogy is better than BD for many - me included, based for the moment only on SS comparisons, though...

Sadly my projects are lost due to an HDD crash… 😦 | [Fundamental Collection] thread | blog.spoRv.com | fan preservation forum: fanres.com