FranceBB
6th May 2020, 17:22
Intro:
This whole comparison started because some of my coworkers are obsessed with AppleProRes and wanted to shoot everything in ProRes. ProRes is probably the only not-so-bad thing Apple made in its own existence as a company. The adoption of Apple ProRes has been growing during the years and its use manages to retain a lot of details thanks to the 4:4:4 sampling (with additional possibility of having the alpha channel as well), the 10bit planar bit depth and its very high bitrate. As a matter of fact, it's also one of the most used codecs for cameras that shoot log, however our scenario was different: we had a program recorded in a theater far away from our studio so files had to be recorded by the cameras, sent via Aspera, downloaded by our studio, edited and encoded which was quite a challenge to do with such a huge filesize considering that we had to go on air the very next day.
For the records, we weren't recording anything special, just plain old FULL HD linear BT709 25p, so we didn't need anything particular.
Some of my colleagues proposed AppleProRes LT profile which is essentially with a bitrate as low as 75 Mbit/s, however me (and three other people) argued that having ProRes with such a low bitrate wasn't worth it and it would make more "damages" than anything 'cause not only it's a low bitrate for which such a codec isn't made for, but also because whenever it goes on air the final file has to be encoded live by our encoders in H.264 so the final fine ends up being processed by two different codecs. The point is that everybody knows that going through two different codecs like that is bad and lowers the quality, so I proposed AVC Intra Class 100. The only reason why there's XDCAM-50 in there is that some of our video-servers still like MPEG-2, so they kinda wanted me to add it to the comparison, but I knew it was going to perform poorly...
MPEG-2 and XDCAM-50
MPEG-2 is a codec based on the Discrete Cosine Transform, an excellent transform that works with real numbers (therefore it has a lower computational cost than - for instance - the Fourier Transform since the latter works with imaginary numbers), is continuous in 2π (therefore it has fewer discontinuity points than other transforms like the Fourier one). MPEG-2 will always be remembered as the "first true modern codec" in the sense that it has an implementation that played a role as a "start / beginning" of the modern conception of codecs and led to the development of many other successive codecs, however years passed and it's very old now.
In its implementation, the image is divided into 4x4 and 8x8 blocks and macroblocks and - to each one of them - is assigned a numerical value that goes from 0 to 99 after going through the transform.
The closer the value is to 0, the more it is considered important for human vision, the closer it is to 99 the less it is considered important for human vision. The samples are divided into luma and chroma and according to the sampling type (yv12, yv16, yv24) a different behavior is chosen. (Although I'm using the term "behaviour" loosely here).
This codec was very widespread back when channels were in SD, and it should have been completely replaced with the arrival of HD and FULL HD resolutions as it's not optimized for those resolutions, however, due to the reluctance of various broadcasters to switch to H.264 and due to the much higher computational cost not well supported by the hardware of the time, MPEG-2 managed to survive in some parts of the world despite the advent of HD and FULL HD.
In our test we will use the XDCAM-50 standard, which is MPEG-2 at 50 Mbit/s constant bitrate yv16, 8bit BT709 in FULL HD.
Advantages of MPEG2:
- Low computational cost
Disadvantages of MPEG2:
- Obsolete codec not optimized for resolutions above SD
- Bit depth limitations (max 8bit)
- It only supports linear color curves with BT601 and BT709 matrices
- Each encoder implementation is either single-core single-thread or very poorly optimized to scale on modern CPUs.
MPEG-4 Part 10 H.264
After the development of MPEG2 and after the development of Dvix/Xvid, H.264 was made; it's a very good codec, quite performing in terms of scalability of resources, that was based on the previous models but added many more compression tools and improved things like motion compensation (vector displacement calculations) and, in addition to the Discrete Cosine Transform, the Hadamard Transform was introduced, a very light transform that had the task of dealing with what the Discrete Cosine Transform couldn't handle efficiently enough.
Advantages of H.264
- Supports 8bit and 10bit bit depth
- It supports linear and logarithmic color curves (Linear BT601, Linear BT709, BT2020nc HLG, BT2100 PQ, Slog1-2-3, Clog1-2-3, Log-C, F-Log, V-Log).
Disadvantages of H.264
- It does not support 12bit and higher
- It's getting old and it's not optimized for resolutions higher than FULL HD.
- The division into blocks and macroblocks is limited to 4x4 and 8x8
- It scales fine on multi-core and multi-thread CPUs but it's not very good on Dual Socket configurations with many cores and threads
Note on H.265 HEVC:
The only reason why I didn't include H.265 is that, although it's a very good codec, now mature, based on DCT and other transforms, with 4x4, 8x8, 16x16, 32x32 and 64x64 blocks and macroblocks, optimized for 4K resolutions which supports up to 12bit planar, it's not supported by AVID Media Composer and AVID Interplay Access to be checked-into an AVID Workspace, therefore I couldn't include it...
AppleProRes
Unlike MPEG codecs, it is a codec designed exclusively as a mezzanine file in the sense that the benefits of its compression tools are seen only at very high bitrates and it's not suitable for final users delivery.
Advantages:
- Codec designed for broadcast
- It supports linear and logarithmic curves just like H.264
Disadvantages:
- Closed source proprietary technology with few implementations
- It does scale on multi-core and multi-thread CPUs but it's far from being optimal on non-apple OS which is what most people use since they don't wanna pay for overpriced crap branded Apple
- Free non-apple encoders only support a maximum bit depth of 10bit, just like H. 264
Type of Test
The Test is based on a series of .tiff lossless images recorded by several 4K cameras, downscaled with Lanczos to FULL HD and appended together to make the reel, which is then encoded in UTVideo 4:2:2 planar 10bit linear BT709 and used as source for this comparison. This clip will then be encoded using the three codecs examined: MPEG-2, H.264 and AppleProRes.
Due to the AVID limitation in consolidating these codecs into its system, encoding settings have been chosen in order to make them compatible with the AVID platform, in particular: XDCAM50 for MPEG-2, AVC-Intra 100 for H.264 and LT Profile for Apple ProRes.
Source:
Codec: UTVideo
Bitrate: 1750 Mbit/s
Width: 1920
Height: 1080
Display Aspect Ratio: 16:9
Frame rate mode: Constant
Frame rate: 25fps
Scan Type: Progressive
Color Space: YUV
Chroma Sampling: 4:2:2 planar
Bit Depth: 10bit
Color Range: Limited
Color Primaries: BT709
Matrix Coefficients: BT709
XDCAM Encoding:
Codec: MPEG-2
Bitrate: 50 Mbit/s
Width: 1920
height: 1080
Display Aspect Ratio: 16:9
Frame rate mode: Constant
Frame rate: 25fps
Scan Type: Interlaced TFF
Chroma Sampling: 4:2:2 planar yv16
Bit Depth: 8bit
Color Range: Limited
Color Primaries: BT709
Matrix Coefficients: BT709
AVC-Intra 100 Encoding:
Codec: MPEG-4 Part 10 H.264
Bitrate: 100 Mbit/s
Width: 1920
height: 1080
Display Aspect Ratio: 16:9
Frame rate mode: Constant
Frame rate: 25fps
Scan Type: MBAFF
Chroma Sampling: 4:2:2 planar
Bit Depth: 10bit
Color Range: Limited
Color Primaries: BT709
Matrix Coefficients: BT709
AppleProRes LT Encoding:
Codec: AppleProRes
Bitrate: 85 Mbit/s
Width: 1920
height: 1080
Display Aspect Ratio: 16:9
Frame rate mode: Constant
Frame rate: 25fps
Scan Type: Interlaced TFF
Chroma Sampling: 4:2:2 planar
Bit Depth: 10bit
Color Range: Limited
Color Primaries: BT709
Matrix Coefficients: BT709
Objective metric: SSIM
https://i.imgur.com/tpUyxEo.png
SSIM objective metric test resulted in the following values:
H.264 AVC Intra Class 100
Total value: 358627.09
Average value: 19.33
Apple ProRes profile LT
Total value: 341903.78
Average value: 18.43
MPEG-2 XDCAM50
Total value: 313139.78
Average value: 16.88
Although there are some scenes in which AppleProRes LT profile has actually performed better than H.264, in general, a bitrate of 85 Mbit/s is really too low for its compression tools and this penalized ProRes in favor of H.264 which had the best overall result. As for MPEG-2, it showed all its difficulties in a series of scenes that included many elements like raindrops in which the individual 8x8 and 4x4 blocks and macroblocks of the droplets required a way higher bitrate and coding tools that take precautions when they detect these elements which obviously do not exist in MPEG-2 encoders. Another thing that penalized MPEG-2 a lot was the fact that it was 8bit only while both H.264 and AppleProRes were 10bit planar and avoided banding, especially in dark scenes with gradients and strong lights, and in the fading shades of the sky...
Objective metric: PSNR
https://i.imgur.com/bmUcV8J.png
PSNR objective metric test resulted in the following values:
H.264 AVC Intra Class 100
Total value: 724718.01
Average value: 39.06
Apple ProRes profile LT
Total value: 722724.27
Average value: 38.95
MPEG-2 XDCAM50
Total value: 714906
Average value: 38.53
PSNR was been much more permissive on some types of artifact; for instance it penalized more the fact of having macroblock correlation problems typical of MPEG codecs such as H.264 compared to grain retention, giving more points to AppleProRes than SSIM, however, overall, H.264 turns out to be once again the best on most scenes. One thing that can be noticed, among other things, is that although AppleProRes is only slightly lower than H.264, it is - in some particular situations - even lower than MPEG-2 due to the nature of the codec which is used at a way too low bitrate (85 mbit/s).
In any case, once again, H.264 turns out to be the winner, with AppleProRes immediately behind it and MPEG-2 at the bottom.
Final thoughts
H.264 is the clear winner of this challenge: it's a rather mature codec, supported everywhere in many broadcasting platform (like ours) and for which encoders like x264 have years of development behind them so that they're truly stable and safe.
It can also be used at 10bit in order to avoid banding and, as shown by the objective metrics, it represents the solution with the highest quality compatible with AVID Interplay Access among those analyzed.
This whole comparison started because some of my coworkers are obsessed with AppleProRes and wanted to shoot everything in ProRes. ProRes is probably the only not-so-bad thing Apple made in its own existence as a company. The adoption of Apple ProRes has been growing during the years and its use manages to retain a lot of details thanks to the 4:4:4 sampling (with additional possibility of having the alpha channel as well), the 10bit planar bit depth and its very high bitrate. As a matter of fact, it's also one of the most used codecs for cameras that shoot log, however our scenario was different: we had a program recorded in a theater far away from our studio so files had to be recorded by the cameras, sent via Aspera, downloaded by our studio, edited and encoded which was quite a challenge to do with such a huge filesize considering that we had to go on air the very next day.
For the records, we weren't recording anything special, just plain old FULL HD linear BT709 25p, so we didn't need anything particular.
Some of my colleagues proposed AppleProRes LT profile which is essentially with a bitrate as low as 75 Mbit/s, however me (and three other people) argued that having ProRes with such a low bitrate wasn't worth it and it would make more "damages" than anything 'cause not only it's a low bitrate for which such a codec isn't made for, but also because whenever it goes on air the final file has to be encoded live by our encoders in H.264 so the final fine ends up being processed by two different codecs. The point is that everybody knows that going through two different codecs like that is bad and lowers the quality, so I proposed AVC Intra Class 100. The only reason why there's XDCAM-50 in there is that some of our video-servers still like MPEG-2, so they kinda wanted me to add it to the comparison, but I knew it was going to perform poorly...
MPEG-2 and XDCAM-50
MPEG-2 is a codec based on the Discrete Cosine Transform, an excellent transform that works with real numbers (therefore it has a lower computational cost than - for instance - the Fourier Transform since the latter works with imaginary numbers), is continuous in 2π (therefore it has fewer discontinuity points than other transforms like the Fourier one). MPEG-2 will always be remembered as the "first true modern codec" in the sense that it has an implementation that played a role as a "start / beginning" of the modern conception of codecs and led to the development of many other successive codecs, however years passed and it's very old now.
In its implementation, the image is divided into 4x4 and 8x8 blocks and macroblocks and - to each one of them - is assigned a numerical value that goes from 0 to 99 after going through the transform.
The closer the value is to 0, the more it is considered important for human vision, the closer it is to 99 the less it is considered important for human vision. The samples are divided into luma and chroma and according to the sampling type (yv12, yv16, yv24) a different behavior is chosen. (Although I'm using the term "behaviour" loosely here).
This codec was very widespread back when channels were in SD, and it should have been completely replaced with the arrival of HD and FULL HD resolutions as it's not optimized for those resolutions, however, due to the reluctance of various broadcasters to switch to H.264 and due to the much higher computational cost not well supported by the hardware of the time, MPEG-2 managed to survive in some parts of the world despite the advent of HD and FULL HD.
In our test we will use the XDCAM-50 standard, which is MPEG-2 at 50 Mbit/s constant bitrate yv16, 8bit BT709 in FULL HD.
Advantages of MPEG2:
- Low computational cost
Disadvantages of MPEG2:
- Obsolete codec not optimized for resolutions above SD
- Bit depth limitations (max 8bit)
- It only supports linear color curves with BT601 and BT709 matrices
- Each encoder implementation is either single-core single-thread or very poorly optimized to scale on modern CPUs.
MPEG-4 Part 10 H.264
After the development of MPEG2 and after the development of Dvix/Xvid, H.264 was made; it's a very good codec, quite performing in terms of scalability of resources, that was based on the previous models but added many more compression tools and improved things like motion compensation (vector displacement calculations) and, in addition to the Discrete Cosine Transform, the Hadamard Transform was introduced, a very light transform that had the task of dealing with what the Discrete Cosine Transform couldn't handle efficiently enough.
Advantages of H.264
- Supports 8bit and 10bit bit depth
- It supports linear and logarithmic color curves (Linear BT601, Linear BT709, BT2020nc HLG, BT2100 PQ, Slog1-2-3, Clog1-2-3, Log-C, F-Log, V-Log).
Disadvantages of H.264
- It does not support 12bit and higher
- It's getting old and it's not optimized for resolutions higher than FULL HD.
- The division into blocks and macroblocks is limited to 4x4 and 8x8
- It scales fine on multi-core and multi-thread CPUs but it's not very good on Dual Socket configurations with many cores and threads
Note on H.265 HEVC:
The only reason why I didn't include H.265 is that, although it's a very good codec, now mature, based on DCT and other transforms, with 4x4, 8x8, 16x16, 32x32 and 64x64 blocks and macroblocks, optimized for 4K resolutions which supports up to 12bit planar, it's not supported by AVID Media Composer and AVID Interplay Access to be checked-into an AVID Workspace, therefore I couldn't include it...
AppleProRes
Unlike MPEG codecs, it is a codec designed exclusively as a mezzanine file in the sense that the benefits of its compression tools are seen only at very high bitrates and it's not suitable for final users delivery.
Advantages:
- Codec designed for broadcast
- It supports linear and logarithmic curves just like H.264
Disadvantages:
- Closed source proprietary technology with few implementations
- It does scale on multi-core and multi-thread CPUs but it's far from being optimal on non-apple OS which is what most people use since they don't wanna pay for overpriced crap branded Apple
- Free non-apple encoders only support a maximum bit depth of 10bit, just like H. 264
Type of Test
The Test is based on a series of .tiff lossless images recorded by several 4K cameras, downscaled with Lanczos to FULL HD and appended together to make the reel, which is then encoded in UTVideo 4:2:2 planar 10bit linear BT709 and used as source for this comparison. This clip will then be encoded using the three codecs examined: MPEG-2, H.264 and AppleProRes.
Due to the AVID limitation in consolidating these codecs into its system, encoding settings have been chosen in order to make them compatible with the AVID platform, in particular: XDCAM50 for MPEG-2, AVC-Intra 100 for H.264 and LT Profile for Apple ProRes.
Source:
Codec: UTVideo
Bitrate: 1750 Mbit/s
Width: 1920
Height: 1080
Display Aspect Ratio: 16:9
Frame rate mode: Constant
Frame rate: 25fps
Scan Type: Progressive
Color Space: YUV
Chroma Sampling: 4:2:2 planar
Bit Depth: 10bit
Color Range: Limited
Color Primaries: BT709
Matrix Coefficients: BT709
XDCAM Encoding:
Codec: MPEG-2
Bitrate: 50 Mbit/s
Width: 1920
height: 1080
Display Aspect Ratio: 16:9
Frame rate mode: Constant
Frame rate: 25fps
Scan Type: Interlaced TFF
Chroma Sampling: 4:2:2 planar yv16
Bit Depth: 8bit
Color Range: Limited
Color Primaries: BT709
Matrix Coefficients: BT709
AVC-Intra 100 Encoding:
Codec: MPEG-4 Part 10 H.264
Bitrate: 100 Mbit/s
Width: 1920
height: 1080
Display Aspect Ratio: 16:9
Frame rate mode: Constant
Frame rate: 25fps
Scan Type: MBAFF
Chroma Sampling: 4:2:2 planar
Bit Depth: 10bit
Color Range: Limited
Color Primaries: BT709
Matrix Coefficients: BT709
AppleProRes LT Encoding:
Codec: AppleProRes
Bitrate: 85 Mbit/s
Width: 1920
height: 1080
Display Aspect Ratio: 16:9
Frame rate mode: Constant
Frame rate: 25fps
Scan Type: Interlaced TFF
Chroma Sampling: 4:2:2 planar
Bit Depth: 10bit
Color Range: Limited
Color Primaries: BT709
Matrix Coefficients: BT709
Objective metric: SSIM
https://i.imgur.com/tpUyxEo.png
SSIM objective metric test resulted in the following values:
H.264 AVC Intra Class 100
Total value: 358627.09
Average value: 19.33
Apple ProRes profile LT
Total value: 341903.78
Average value: 18.43
MPEG-2 XDCAM50
Total value: 313139.78
Average value: 16.88
Although there are some scenes in which AppleProRes LT profile has actually performed better than H.264, in general, a bitrate of 85 Mbit/s is really too low for its compression tools and this penalized ProRes in favor of H.264 which had the best overall result. As for MPEG-2, it showed all its difficulties in a series of scenes that included many elements like raindrops in which the individual 8x8 and 4x4 blocks and macroblocks of the droplets required a way higher bitrate and coding tools that take precautions when they detect these elements which obviously do not exist in MPEG-2 encoders. Another thing that penalized MPEG-2 a lot was the fact that it was 8bit only while both H.264 and AppleProRes were 10bit planar and avoided banding, especially in dark scenes with gradients and strong lights, and in the fading shades of the sky...
Objective metric: PSNR
https://i.imgur.com/bmUcV8J.png
PSNR objective metric test resulted in the following values:
H.264 AVC Intra Class 100
Total value: 724718.01
Average value: 39.06
Apple ProRes profile LT
Total value: 722724.27
Average value: 38.95
MPEG-2 XDCAM50
Total value: 714906
Average value: 38.53
PSNR was been much more permissive on some types of artifact; for instance it penalized more the fact of having macroblock correlation problems typical of MPEG codecs such as H.264 compared to grain retention, giving more points to AppleProRes than SSIM, however, overall, H.264 turns out to be once again the best on most scenes. One thing that can be noticed, among other things, is that although AppleProRes is only slightly lower than H.264, it is - in some particular situations - even lower than MPEG-2 due to the nature of the codec which is used at a way too low bitrate (85 mbit/s).
In any case, once again, H.264 turns out to be the winner, with AppleProRes immediately behind it and MPEG-2 at the bottom.
Final thoughts
H.264 is the clear winner of this challenge: it's a rather mature codec, supported everywhere in many broadcasting platform (like ours) and for which encoders like x264 have years of development behind them so that they're truly stable and safe.
It can also be used at 10bit in order to avoid banding and, as shown by the objective metrics, it represents the solution with the highest quality compatible with AVID Interplay Access among those analyzed.