HDMI Video Tut / Crash Course (Submissions welcome)
-
Hope I've chosen the correct forum location for this one. If not please advise and I'll move it.
Have spent about four months on and off attempting a stable Retropie build off of the 4.8 image, with all of my roms and data. First, I’ll have sound, then I’ll lose sound after an update, the video gets squished while I’m trying to remedy sound, and then my controller became self-aware and attacked my cat and so on and so on ad infinitum. Finally, I’m cobbling something together that contains not just the included systems but also some optional and experimental stuff, and, amazingly, I might soon be able to play some games without fretting about things not working.
So, I’m going to detail some helpful info that I’ve come across in my efforts, hopefully rolling it into a more useful starter guide for those looking to take some of the frustration out of their builds. This is my best attempt at my current level of comprehension, so don’t torch me if I have something a bit off- please bring it to my attention and I’ll edit the post. I hope that others will chime in with their experiences. My hope is that it can be used to supplement some of the guides in the Retropie docs.
My first post will detail “Video Stuff”, then I’ll do a post on “Audio Stuff,” and then hopefully “Controller Stuff” and “CFGs Stuff.”
If you can’t manage video, audio, a controller, and your configs, you don’t have much of a RetroPie at all… Flashing and other stuff have been covered extensively elsewhere. But if you can get those four things, I think you could be on track. My goal is to write something that addresses the specific needs of RetroPie, in layperson-understandable terminology and cut out as much filler/confusion as humanly possible to give you the most direct route to what this is all about- enjoying yourself playing games.
I found some of the Retropie docs didn’t clarify certain topics in a way that made sense to me. I wanted more clarity on what some of these terms mean, so it isn’t just throwing random stuff at config.txt you saw in some 2018 Reddit comment and praying. Anyhow, here it is:
VIDEO STUFF
This will mostly be helpful to those running a 4.8 image, using fkms with an RPI4 going into a standard Television that has both CEA and DMT modes, or a Monitor. It doesn’t cover more complex examples like separate cabling for audio/video (i.e. HDMI + audio over 3.5mm analog or usb sound cards), which will be covered in the “Audio Stuff” section.
HDMI DRIVES, GROUPS & MODES
In essence:
HDMI_DRIVE = Is it a computer display, a TV, Computer Monitor, or what?
HDMI_GROUP= Essentially the same question, posed differently
HDMI_MODE= Resolution, Refresh Rate (But also contains Group-specific information, and thus, drive information)hdmi_drive chooses between HDMI and DVI
hdmi_group chooses between CEA and DMTBriefly:
hdmi_drive= 1 # Normal DVI mode (No sound, unless force_edid)
hdmi_drive= 2 # Normal HDMI mode
hdmi_group=1 # CEA (Television signal)
hdmi_group=2 # DMT (Monitor signal)
hdmi_drive= 1 Normal DVI mode (No sound) - Normally used with DMT Modes (hdmi_group=2)
You can force sound in DMT by using the force_edid_audio=1 in your config.txt, however, it might be more sensible to attempt CEA if using a TV.
Thus, I assume that force_edid_audio=1 flag would only be functional when using hdmi_drive=1, as there would be no need to force it otherwise... except maybe in an odd use case of a CEA mode using some unusual audio format... but I'm doubtful.
hdmi_drive= 2 Normal HDMI mode (Sound will be sent if supported and enabled) - Normally used with CEA Modes (TV) (hdmi_group=1)
So, I assume that the best outcomes would be:
hdmi_drive=1 should be utilized with hdmi_group=2 and may benefit from force_edid_audio=1, and hdmi_drive=2 should be used with hdmi_group=1…. confused yet?
HDMI_MODE: EDID.dat / CEA / DMT Format
I still have yet to find definitive information regarding the optimal modes to select for an RPI4 going into a standard television (in my case a Samsung Frame) with a single HDMI capable, ideally carrying both audio and video.
“hdmi_mode defines screen resolution in CEA or DMT format”
elinux shows hdmi_modes that seem to match pretty well those from me pulling edid info from a TV,
i.e. eLinux example:
These values are valid if hdmi_group=1 (CEA)
hdmi_mode=1 VGA hdmi_mode=2 480p 60Hz hdmi_mode=3 480p 60Hz H hdmi_mode=4 720p 60Hz hdmi_mode=5 1080i 60Hz hdmi_mode=6 480i 60Hz hdmi_mode=7 480i 60Hz H hdmi_mode=8 240p 60Hz hdmi_mode=9 240p 60Hz H
however there’s useful missing information. I think it would be best practice to follow the steps below.
Generating and Understanding EDID.DAT
Edid.dat info parsed, using this as my source/ general guide:
https://focuslcds.com/raspberry-pi-configuration-modes-cea-vs-dmt-fan9204/
To generate your own edid (with device plugged in) run:
~$ tvservice -d edid.dat
this generates a file /home/pi/edid.dat
$~ edidparser edid.dat > edid.txt
this gives you a text file with human readable data
~$ cat edid.txt | less
this enables you to browse it by page (space bar to go to next page, q to quit)
My parsed edid.dat as an example:
* HDMI:EDID version 1.3, 1 extensions, screen size 142x80 cm * HDMI:EDID features - videodef 0x80 !standby !suspend !active off; colour encoding:RGB444|YCbCr422; sRGB is not default colourspace; preferred format is native; does not support GTF * HDMI:EDID found monitor range descriptor tag 0xfd * HDMI:EDID monitor range offsets: V min=0, V max=0, H min=0, H max=0 * HDMI:EDID monitor range: vertical is 24-120 Hz, horizontal is 15-135 kHz, max pixel clock is 300 MHz * HDMI:EDID monitor range does not support GTF * HDMI:EDID found monitor name descriptor tag 0xfc * HDMI:EDID monitor name is SAMSUNG * HDMI:EDID found preferred CEA detail timing format: 3840x2160p @ 30 Hz (95) * HDMI:EDID failed to find a matching detail format for 2560x1440p hfp:48 hs:32 hbp:80 vfp:3 vs:5 vbp:33 pixel clock:241 MHz * HDMI:EDID calculated refresh rate is 60 Hz * HDMI:EDID guessing the format to be 2560x1440p @60 Hz * HDMI:EDID found unknown detail timing format: 2560x1440p hfp:48 hs:32 hbp:80 vfp:3 vs:5 vbp:33 pixel clock:241 MHz * HDMI:EDID established timing I/II bytes are BD EF 80 * HDMI:EDID found DMT format: code 4, 640x480p @ 60 Hz in established timing I/II * HDMI:EDID found DMT format: code 5, 640x480p @ 72 Hz in established timing I/II * HDMI:EDID found DMT format: code 6, 640x480p @ 75 Hz in established timing I/II * HDMI:EDID found DMT format: code 9, 800x600p @ 60 Hz in established timing I/II * HDMI:EDID found DMT format: code 10, 800x600p @ 72 Hz in established timing I/II * HDMI:EDID found DMT format: code 11, 800x600p @ 75 Hz in established timing I/II * HDMI:EDID found DMT format: code 16, 1024x768p @ 60 Hz in established timing I/II * HDMI:EDID found DMT format: code 17, 1024x768p @ 70 Hz in established timing I/II * HDMI:EDID found DMT format: code 18, 1024x768p @ 75 Hz in established timing I/II * HDMI:EDID found DMT format: code 36, 1280x1024p @ 75 Hz in established timing I/II * HDMI:EDID standard timings block x 8: 0x714F 81C0 8100 8180 9500 A9C0 B300 D1C0 * HDMI:EDID found DMT format: code 21, 1152x864p @ 75 Hz (4:3) in standard timing 0 * HDMI:EDID found DMT format: code 85, 1280x720p @ 60 Hz (16:9) in standard timing 1 * HDMI:EDID found DMT format: code 28, 1280x800p @ 60 Hz (16:10) in standard timing 2 * HDMI:EDID found DMT format: code 35, 1280x1024p @ 60 Hz (5:4) in standard timing 3 * HDMI:EDID found DMT format: code 47, 1440x900p @ 60 Hz (16:10) in standard timing 4 * HDMI:EDID found DMT format: code 83, 1600x900p @ 60 Hz (16:9) in standard timing 5 * HDMI:EDID found DMT format: code 58, 1680x1050p @ 60 Hz (16:10) in standard timing 6 * HDMI:EDID found DMT format: code 82, 1920x1080p @ 60 Hz (16:9) in standard timing 7 * HDMI:EDID parsing v3 CEA extension 0 * HDMI:EDID monitor support - underscan IT formats:yes, basic audio:yes, yuv444:yes, yuv422:yes, #native DTD:0 * HDMI:EDID found CEA detail timing format: 1920x1080i @ 50 Hz (20) * HDMI:EDID found CEA detail timing format: 1920x1080p @ 60 Hz (16) * HDMI:EDID found CEA format: code 95, 3840x2160p @ 30Hz * HDMI:EDID found CEA format: code 16, 1920x1080p @ 60Hz * HDMI:EDID found CEA format: code 31, 1920x1080p @ 50Hz * HDMI:EDID found CEA format: code 4, 1280x720p @ 60Hz * HDMI:EDID found CEA format: code 19, 1280x720p @ 50Hz * HDMI:EDID found CEA format: code 5, 1920x1080i @ 60Hz * HDMI:EDID found CEA format: code 20, 1920x1080i @ 50Hz * HDMI:EDID found CEA format: code 32, 1920x1080p @ 24Hz * HDMI:EDID found CEA format: code 33, 1920x1080p @ 25Hz * HDMI:EDID found CEA format: code 34, 1920x1080p @ 30Hz * HDMI:EDID found CEA format: code 93, 3840x2160p @ 24Hz * HDMI:EDID found CEA format: code 94, 3840x2160p @ 25Hz * HDMI:EDID found CEA format: code 98, 4096x2160p @ 24Hz * HDMI:EDID found CEA format: code 100, 4096x2160p @ 30Hz * HDMI:EDID found CEA format: code 7, 1440x480i @ 60Hz * HDMI:EDID found CEA format: code 22, 1440x576i @ 50Hz * HDMI:EDID found CEA format: code 3, 720x480p @ 60Hz * HDMI:EDID found CEA format: code 18, 720x576p @ 50Hz * HDMI:EDID found CEA format: code 63, 1920x1080p @ 120Hz * HDMI:EDID found CEA format: code 64, 1920x1080p @ 100Hz * HDMI:EDID found audio format 2 channels PCM, sample rate: 32|44|48 kHz, sample size: 16|20|24 bits * HDMI:EDID found audio format 6 channels AC3, sample rate: 32|44|48 kHz, bitrate: 640 kbps * HDMI:EDID found audio format 8 channels Dobly Digital+, sample rate: 32|44|48 kHz, codec define: 0 * HDMI:EDID found Video Capability DB length 2 * HDMI:EDID video capability: CE:3 IT:3 PT:0 QS:1 * HDMI:EDID extended data block tag 0x05 length 3 not supported * HDMI:EDID found HDMI VSDB length 14 * HDMI:EDID HDMI VSDB has physical address 2.0.0.0 * HDMI:EDID HDMI VSDB supports AI:yes, dual link DVI:no * HDMI:EDID HDMI VSDB deep colour support - 48-bit:no 36-bit:yes 30-bit:yes DC_yuv444:yes * HDMI:EDID HDMI VSDB max TMDS clock 300 MHz * HDMI:EDID HDMI VSDB does not support content type * HDMI:EDID HDMI VSDB supports extended resolutions 1,2,3,4 * HDMI:EDID extended data block tag 0x06 length 3 not supported * HDMI:EDID extended data block tag YCbCr420VideoData - length 5 * HDMI:EDID Disabling mode 96 as YUV420 only * HDMI:EDID Disabling mode 97 as YUV420 only * HDMI:EDID Disabling mode 101 as YUV420 only * HDMI:EDID Disabling mode 102 as YUV420 only * HDMI:EDID extended data block tag VendorSpecificVideo - length 5 * HDMI:EDID adding mandatory support for CEA (1) 640x480p @ 60Hz * HDMI:EDID adding mandatory support for CEA (2) 720x480p @ 60Hz * HDMI:EDID adding mandatory support for CEA (17) 720x576p @ 50Hz * HDMI:EDID filtering formats with pixel clock unlimited MHz or h. blanking unlimited * HDMI:EDID best score mode initialised to CEA (1) 640x480p @ 60 Hz with pixel clock 3 MHz (score 25) * HDMI:EDID best score mode is now CEA (1) 640x480p @ 60 Hz with pixel clock 25 MHz (score 61864) * HDMI:EDID best score mode is now CEA (2) 720x480p @ 60 Hz with pixel clock 27 MHz (score 66472) * HDMI:EDID CEA mode (3) 720x480p @ 60 Hz with pixel clock 27 MHz has a score of 66472 * HDMI:EDID best score mode is now CEA (4) 1280x720p @ 60 Hz with pixel clock 74 MHz (score 135592) * HDMI:EDID DMT mode (4) 640x480p @ 60 Hz with pixel clock 25 MHz has a score of 18432 * HDMI:EDID best score mode is now CEA (5) 1920x1080i @ 60 Hz with pixel clock 74 MHz (score 149416) * HDMI:EDID DMT mode (5) 640x480p @ 72 Hz with pixel clock 31 MHz has a score of 5529 * HDMI:EDID DMT mode (6) 640x480p @ 75 Hz with pixel clock 31 MHz has a score of 5760 * HDMI:EDID CEA mode (7) 1440x480i @ 60 Hz with pixel clock 27 MHz has a score of 45736 * HDMI:EDID DMT mode (9) 800x600p @ 60 Hz with pixel clock 40 MHz has a score of 28800 * HDMI:EDID DMT mode (10) 800x600p @ 72 Hz with pixel clock 50 MHz has a score of 8640 * HDMI:EDID DMT mode (11) 800x600p @ 75 Hz with pixel clock 49 MHz has a score of 9000 * HDMI:EDID best score mode is now CEA (16) 1920x1080p @ 60 Hz with pixel clock 148 MHz (score 273832) * HDMI:EDID DMT mode (16) 1024x768p @ 60 Hz with pixel clock 65 MHz has a score of 47185 * HDMI:EDID CEA mode (17) 720x576p @ 50 Hz with pixel clock 27 MHz has a score of 66472 * HDMI:EDID DMT mode (17) 1024x768p @ 70 Hz with pixel clock 75 MHz has a score of 13762 * HDMI:EDID CEA mode (18) 720x576p @ 50 Hz with pixel clock 27 MHz has a score of 66472 * HDMI:EDID DMT mode (18) 1024x768p @ 75 Hz with pixel clock 78 MHz has a score of 14745 * HDMI:EDID CEA mode (19) 1280x720p @ 50 Hz with pixel clock 74 MHz has a score of 117160 * HDMI:EDID CEA mode (20) 1920x1080i @ 50 Hz with pixel clock 74 MHz has a score of 232360 * HDMI:EDID DMT mode (21) 1152x864p @ 75 Hz with pixel clock 108 MHz has a score of 43662 * HDMI:EDID CEA mode (22) 1440x576i @ 50 Hz with pixel clock 27 MHz has a score of 45736 * HDMI:EDID DMT mode (28) 1280x800p @ 60 Hz with pixel clock 83 MHz has a score of 86440 * HDMI:EDID CEA mode (31) 1920x1080p @ 50 Hz with pixel clock 148 MHz has a score of 232360 * HDMI:EDID CEA mode (32) 1920x1080p @ 24 Hz with pixel clock 74 MHz has a score of 124532 * HDMI:EDID CEA mode (33) 1920x1080p @ 25 Hz with pixel clock 74 MHz has a score of 128680 * HDMI:EDID CEA mode (34) 1920x1080p @ 30 Hz with pixel clock 74 MHz has a score of 149416 * HDMI:EDID DMT mode (35) 1280x1024p @ 60 Hz with pixel clock 108 MHz has a score of 103643 * HDMI:EDID DMT mode (36) 1280x1024p @ 75 Hz with pixel clock 135 MHz has a score of 24576 * HDMI:EDID DMT mode (47) 1440x900p @ 60 Hz with pixel clock 106 MHz has a score of 102760 * HDMI:EDID DMT mode (58) 1680x1050p @ 60 Hz with pixel clock 146 MHz has a score of 130840 * HDMI:EDID CEA mode (63) 1920x1080p @ 120 Hz with pixel clock 297 MHz has a score of 149416 * HDMI:EDID CEA mode (64) 1920x1080p @ 100 Hz with pixel clock 297 MHz has a score of 128680 * HDMI:EDID DMT mode (82) 1920x1080p @ 60 Hz with pixel clock 148 MHz has a score of 149416 * HDMI:EDID DMT mode (83) 1600x900p @ 60 Hz with pixel clock 108 MHz has a score of 111400 * HDMI:EDID DMT mode (85) 1280x720p @ 60 Hz with pixel clock 74 MHz has a score of 80296 * HDMI:EDID best score mode is now CEA (93) 3840x2160p @ 24 Hz with pixel clock 297 MHz (score 423130) * HDMI:EDID best score mode is now CEA (94) 3840x2160p @ 25 Hz with pixel clock 297 MHz (score 439720) * HDMI:EDID best score mode is now CEA (95) 3840x2160p @ 30 Hz with pixel clock 297 MHz (score 5771496) * HDMI:EDID CEA mode (98) 4096x2160p @ 24 Hz with pixel clock 297 MHz has a score of 224065 * HDMI:EDID CEA mode (100) 4096x2160p @ 30 Hz with pixel clock 297 MHz has a score of 273831 * HDMI0:EDID preferred mode remained as CEA (95) 3840x2160p @ 30 Hz with pixel clock 297 MHz * HDMI:EDID has HDMI support and audio support
Note: Not sure the difference between 1080i and 1080p?
I'd like to also call attention to this juicy info which I’ll return to later in the audio portion:
HDMI:EDID found audio format 2 channels PCM, sample rate: 32|44|48 kHz, sample size: 16|20|24 bits
HDMI:EDID found audio format 6 channels AC3, sample rate: 32|44|48 kHz, bitrate: 640 kbps
HDMI:EDID found audio format 8 channels Dobly Digital+, sample rate: 32|44|48 kHz, codec define: 0
HDMI:EDID has HDMI support and audio support
This tells us that we should be good with audio over HDMI in CEA mode.
If you don’t have CEA Modes, have a monitor, and want to pass audio over HDMI in DMT mode, follow the suggestions above re: force_edid.
Re: modes, I believe what’s most relevant is choosing an aspect ratio that works with your type of display (i.e., 16x9 if you have a widescreen TV) and that isn’t too resource intensive like 1920x1080 or in that range (we are playing vintage games after all) and then 60hz would be nice too.
Also, note: This is only mostly relevant for Emulation Station as Retroarch has it’s own resolutions that can be selected via runcommand, however, it’s important to get this right if you are relying on the audio signal as well. Also, you don’t want Emulation Station looking wonky anyhow.
My assumption would be, contrary to other how-tos, would be to use the modes that have detailed timing formats rather than simply selecting the EDID mode with the highest “score” (which would be 4k and obnoxiously small text on a TV screen)
HDMI:EDID found CEA detail timing format: 1920x1080i @ 50 Hz (20) HDMI:EDID found CEA detail timing format: 1920x1080p @ 60 Hz (16)
And the best score in the range I am shooting for (1920x1080) would give us:
HDMI:EDID best score mode is now CEA (16) 1920x1080p @ 60 Hz with pixel clock 148 MHz (score 273832)So, if I were using this formula, I’d choose HDMI CEA Format 16, which would translate to:
hdmi_drive=2 # Normal HDMI Mode
hdmi_group=1 # CEA
hdmi_mode=16 # CEA (16) 1920x1080p @ 60 Hz with pixel clock 148 MHz (score 273832)
I’m unsure if all of these necessitate being explicitly stated in config.txt but I don’t see how it could hurt. In other words, perhaps the hdmi_mode=16 implicitly states hdmi_group=1... I don't know.
Also, perhaps grouping a DMT group with a CEA mode or attempting to force edid audio on a CEA group may create unexpected results. (uncertain).
Regarding the use of 3.5mm output, this might be best addressed in the forthcoming “Audio Stuff” thread.
Again, I made some educated guesses as best I could from the Raspberrypi and Retropie docs, so feel free to correct if there’s something I’ve gotten wrong, something you’d like to add, or think I overlooked that deserves mention.
Hope this helps.
Next up, how to un**** your audio... (once I un**** my own).
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.