Perenista
27th December 2024, 07:55
I posted in the MPC thread that I tried using Handbrake to reencode a 4K video (not from a UHD/4K disc) into regular H.265, FPS same as source, again in MKV, with a 5000 (bitrate) and all the rest set to default.
Also, I created a copy with the video only, to make things easier, of the original (bigger) file.
This is what the 4K OG video was:
https://pastebin.com/NTQmzvUT
And this was the end result:
https://pastebin.com/5Usja10a
I explained the following to chatGPT:
Subtitles were stretched, when I added to the reencoded video. Only by turning off this:
"Apply aspect ratio compensation for anamorphic videos"
They were OK. This option was always enabled by default, in MPC-HC.
Then I was told this:
++++++++++
Here's an analysis of the differences between the original and re-encoded video files, focusing on why the re-encoded file has playback issues in MPC-HC and requires adjusting the "Apply aspect ratio compensation for anamorphic videos" setting.
1. Key Differences Between the Files
Video Encoding Format
Original: AVC (H.264) with High@L4.1 profile.
Re-encoded: HEVC (H.265) with Main@L4@Main profile.
HEVC is more efficient at compression but can sometimes cause compatibility issues with older players or renderers.
Video Dimensions
Original: 3840x2160 pixels (4K UHD) with an aspect ratio of 16:9.
Re-encoded: 1920x1080 pixels (Full HD) with an aspect ratio of 2.35:1.
Impact: The re-encoded file has a lower resolution and a different aspect ratio, requiring the player to make additional adjustments for proper display.
NOTE (I forgot to explain before):
- The original content is in Wide 2.35:1.
ChatGPT explained further:
++++++++
Sample Aspect Ratio (SAR)
Original: Doesn't rely on SAR adjustments; uses a standard display aspect ratio (DAR) of 16:9.
Re-encoded: Specifies a SAR of 255:360, which is unusual and likely incorrect.
Impact: The odd SAR value in the re-encoded file can mislead the MPC-HC into applying unnecessary aspect ratio corrections, treating the video as anamorphic.
++++++++
From where does this come from? Since I set everything as default (max res to 1080p, not 2160p) in HANDBRAKE?
++++++++
Bitrate
Original: 60 Mbps.
Re-encoded: 4,999 kbps.
Impact: The drastic reduction in bitrate may reduce video quality, but it doesn't directly cause the playback issue with aspect ratio.
+++++++++
Encoding Library
Original: Encoded with x264 core 163.
Re-encoded: Encoded with x265 4.1+1.
Encoding with HEVC (x265) introduces specific metadata, such as the incorrect SAR, that older renderers or settings may interpret incorrectly.
+++++++
2. The MPC-HC Setting: "Apply Aspect Ratio Compensation for Anamorphic Videos"
This setting automatically adjusts videos with anamorphic properties or unusual SAR values to display correctly. For the re-encoded file:
The SAR value of 255:360 triggers this adjustment unnecessarily.
Disabling the option resolves the issue for this specific file but could potentially impact other videos that genuinely require this compensation.
++++++++
3. The Root Cause
The incorrect SAR value (255:360) in the re-encoded file is the primary issue. This causes MPC-HC to treat it as anamorphic, triggering aspect ratio compensation that distorts the playback.
The HEVC metadata may also contribute to this misinterpretation, as it's more sensitive to inconsistencies compared to AVC.
+++++++++++++
Then, I was offered a solution...
4. Solution
Fix the SAR in the Re-encoded File To correct the SAR without re-encoding the video, use ffmpeg:
The code:
ffmpeg -i reencoded.mkv -c copy -vf "setsar=1" corrected.mkv
This sets the SAR to 1:1, ensuring the video doesn't require any aspect ratio adjustments.
2. Adjust the MPC-HC Settings Temporarily, you can disable "Apply aspect ratio compensation for anamorphic videos" in MPC-HC settings. However, this might cause issues for other anamorphic videos.
3. Use an Advanced Renderer Consider switching to a renderer like madVR or similar, which handles HEVC metadata and unusual SAR values more gracefully.
++++++++
NOTE: I always used madVR.
+++++++
5. Conclusion
+++++++
The playback issue with the re-encoded file is caused by its incorrect SAR value (255:360), not just the re-encoding itself. Fixing the SAR to 1:1 using ffmpeg will resolve the problem without needing to alter MPC-HC's global settings or affect other files.
+++++++
My conclusion is that ChatGPT is wrong, because running that command mentioned in step #4 will probably not work without a reencode.
So, I spent hours reencoding this, for nothing? And need to do this from scratch?
I don't think ffmpeg will fix this in 2 minutes as suggested above, just like MKVTOOLNIX isn't, if I select a new display AR like 16/9 or 2.35 for the file (with no reencode)
What needs to be done here?
I reencoded 1080p files before, and this was the 1st time subtitles were displayed like that.
These were the HANDBRAKE options I used:
https://i.postimg.cc/x1vGNBT7/OP1.jpg
https://i.postimg.cc/F9bGYkYR/OP2.jpg
https://i.postimg.cc/R0v77GW0/OP3.jpg
https://i.postimg.cc/6QzdYRZf/OP4.jpg
If there was a single mistake (besides some personal choices), I am not seeing anywhere in HANDBRAKE. The goal was to reencode into a H.265 file, with a bitrate of 5000, in regular H.265, and that's it. FPS = same as source, again as MKV, and nothing more.
P.S. I tried a reencode with another 4K file totally different, and the same problems were repeated.
Also, I created a copy with the video only, to make things easier, of the original (bigger) file.
This is what the 4K OG video was:
https://pastebin.com/NTQmzvUT
And this was the end result:
https://pastebin.com/5Usja10a
I explained the following to chatGPT:
Subtitles were stretched, when I added to the reencoded video. Only by turning off this:
"Apply aspect ratio compensation for anamorphic videos"
They were OK. This option was always enabled by default, in MPC-HC.
Then I was told this:
++++++++++
Here's an analysis of the differences between the original and re-encoded video files, focusing on why the re-encoded file has playback issues in MPC-HC and requires adjusting the "Apply aspect ratio compensation for anamorphic videos" setting.
1. Key Differences Between the Files
Video Encoding Format
Original: AVC (H.264) with High@L4.1 profile.
Re-encoded: HEVC (H.265) with Main@L4@Main profile.
HEVC is more efficient at compression but can sometimes cause compatibility issues with older players or renderers.
Video Dimensions
Original: 3840x2160 pixels (4K UHD) with an aspect ratio of 16:9.
Re-encoded: 1920x1080 pixels (Full HD) with an aspect ratio of 2.35:1.
Impact: The re-encoded file has a lower resolution and a different aspect ratio, requiring the player to make additional adjustments for proper display.
NOTE (I forgot to explain before):
- The original content is in Wide 2.35:1.
ChatGPT explained further:
++++++++
Sample Aspect Ratio (SAR)
Original: Doesn't rely on SAR adjustments; uses a standard display aspect ratio (DAR) of 16:9.
Re-encoded: Specifies a SAR of 255:360, which is unusual and likely incorrect.
Impact: The odd SAR value in the re-encoded file can mislead the MPC-HC into applying unnecessary aspect ratio corrections, treating the video as anamorphic.
++++++++
From where does this come from? Since I set everything as default (max res to 1080p, not 2160p) in HANDBRAKE?
++++++++
Bitrate
Original: 60 Mbps.
Re-encoded: 4,999 kbps.
Impact: The drastic reduction in bitrate may reduce video quality, but it doesn't directly cause the playback issue with aspect ratio.
+++++++++
Encoding Library
Original: Encoded with x264 core 163.
Re-encoded: Encoded with x265 4.1+1.
Encoding with HEVC (x265) introduces specific metadata, such as the incorrect SAR, that older renderers or settings may interpret incorrectly.
+++++++
2. The MPC-HC Setting: "Apply Aspect Ratio Compensation for Anamorphic Videos"
This setting automatically adjusts videos with anamorphic properties or unusual SAR values to display correctly. For the re-encoded file:
The SAR value of 255:360 triggers this adjustment unnecessarily.
Disabling the option resolves the issue for this specific file but could potentially impact other videos that genuinely require this compensation.
++++++++
3. The Root Cause
The incorrect SAR value (255:360) in the re-encoded file is the primary issue. This causes MPC-HC to treat it as anamorphic, triggering aspect ratio compensation that distorts the playback.
The HEVC metadata may also contribute to this misinterpretation, as it's more sensitive to inconsistencies compared to AVC.
+++++++++++++
Then, I was offered a solution...
4. Solution
Fix the SAR in the Re-encoded File To correct the SAR without re-encoding the video, use ffmpeg:
The code:
ffmpeg -i reencoded.mkv -c copy -vf "setsar=1" corrected.mkv
This sets the SAR to 1:1, ensuring the video doesn't require any aspect ratio adjustments.
2. Adjust the MPC-HC Settings Temporarily, you can disable "Apply aspect ratio compensation for anamorphic videos" in MPC-HC settings. However, this might cause issues for other anamorphic videos.
3. Use an Advanced Renderer Consider switching to a renderer like madVR or similar, which handles HEVC metadata and unusual SAR values more gracefully.
++++++++
NOTE: I always used madVR.
+++++++
5. Conclusion
+++++++
The playback issue with the re-encoded file is caused by its incorrect SAR value (255:360), not just the re-encoding itself. Fixing the SAR to 1:1 using ffmpeg will resolve the problem without needing to alter MPC-HC's global settings or affect other files.
+++++++
My conclusion is that ChatGPT is wrong, because running that command mentioned in step #4 will probably not work without a reencode.
So, I spent hours reencoding this, for nothing? And need to do this from scratch?
I don't think ffmpeg will fix this in 2 minutes as suggested above, just like MKVTOOLNIX isn't, if I select a new display AR like 16/9 or 2.35 for the file (with no reencode)
What needs to be done here?
I reencoded 1080p files before, and this was the 1st time subtitles were displayed like that.
These were the HANDBRAKE options I used:
https://i.postimg.cc/x1vGNBT7/OP1.jpg
https://i.postimg.cc/F9bGYkYR/OP2.jpg
https://i.postimg.cc/R0v77GW0/OP3.jpg
https://i.postimg.cc/6QzdYRZf/OP4.jpg
If there was a single mistake (besides some personal choices), I am not seeing anywhere in HANDBRAKE. The goal was to reencode into a H.265 file, with a bitrate of 5000, in regular H.265, and that's it. FPS = same as source, again as MKV, and nothing more.
P.S. I tried a reencode with another 4K file totally different, and the same problems were repeated.