Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output 240p (instead of 480i) on composite RCA #683

Closed
starquake opened this issue Nov 18, 2016 · 224 comments
Closed

Output 240p (instead of 480i) on composite RCA #683

starquake opened this issue Nov 18, 2016 · 224 comments

Comments

@starquake
Copy link

starquake commented Nov 18, 2016

I use my Raspberry Pi to emulate old computers/consoles. A common trick with these systems is the output of 240p. Examples are: ZX Spectrum, Nintendo Entertainment System, Commodore 64. It would be great if I could connect my CRT monitor to it. Right now it only outputs 480i which is interlaced and flickers a lot. 240p removes this flicker and also adds scanlines which make it look more authentic.

More info: http://scanlines.hazard-city.de/

Is it possible to get 240p out of the composite port of the Raspberry PI? Or is there more to it than a change in the firmware?

I think you would make a lot of people even happier than they already are about classic gaming/computing on the Raspberry Pi!

@popcornmix
Copy link
Contributor

I'm afraid this has been asked before and it is not supported.
I'm not certain if the hardware supports it or not, but it's certainly never been tested.

There is, a bit (PROG_SCAN) in VEC CONFIG2 register which potentially is useful, but when I asked about it:

To change from interlaced to progressive, you can't just change a bit in VEC. You also have to turn it off in the HVS and maybe change some parameters in PixelValve, though I'm not sure what. DispmanX probably configures all this, but I forget where.

So I'm afraid there isn't a simple fix for this. It may or may not be possible to make this work, but it's very low priority so I can't promise anything.

@starquake
Copy link
Author

Thanks a lot for the reply! Wasn't expecting a quick fix. I'll just keep hoping someday it will be possible.

@alessioscand
Copy link

I'll keep hoping too. Thanks!

@starquake
Copy link
Author

I did find a way to output 240p over RGB. More info here:
http://www.retrorgb.com/rpi240pvga.html

In short you can use a Gert VGA and connect it to a Ultimate Scart Adapter.

@alessioscand
Copy link

@starquake I'm aware of this, thank you. But It would be useful also to output in 240p via Composite.

@MrBrax
Copy link

MrBrax commented Jan 2, 2017

Been researching this for the past 3-4 months, went with composite 480i in the end, flickering garbage.

I don't feel very tempted to buy a product (UMSA) that has "Just make sure that your PC outputs VGA lower resolution with 15Khz" in the description..

So I'm really hoping this is gonna work at some point!

@keilmillerjr
Copy link

keilmillerjr commented Jan 25, 2017

+1 240p over component would be very important for retro gaming.

Edit: I mean composite.

@jimbothegigolo
Copy link

jimbothegigolo commented Jan 25, 2017

I'm very interested in this feature as well.
I am hesitant to buy a Raspberry Pi knowing it will only output 480i and the 240p over HDMI is very lackluster, complicated and leaves much to be desired. Most converters also upscale to 480i automatically nowaday.

(ex: http://celso.io/2012/12/17/connecting-a-raspberry-pi-to-an-old-15khz-arcade-monitor.html)

I'm mainly buying the Raspberry Pi to make custom arcade machines and DOSBox arcades.
240p on S-Video, Component or even Composite would be great as well.

Something I've seen on the PSP Go that I found interesting was the way they used the headphone jack, it's very close-packed and I could see something similar on the Pi.

37

@MrBrax
Copy link

MrBrax commented Jan 25, 2017

I've almost achieved it, getting a cheap HDMI->VGA adapter (Powered, important!), and a VGA -> RCA converter i had for my arcade cabinet (it does not produce 240p/15khz however, but it looks a lot sharper), and setting up the resolution to be 240p via hdmi_mode.

Getting an UMSA would be the last step, but i'm not really feeling like buying a €30 gizmo as said earlier. Some countries have stores with cheaper cables but i'm not that lucky to have those.

In a few years, maybe someone will have hacked the firmware on this 👌

also, did these kind of threads get attention recently from somewhere?

@starquake
Copy link
Author

starquake commented Jan 25, 2017

@jimbothegigolo The Raspberry PI 2 and later also has a headphone jack that also can output composite when using the right cable.

Unfortunately it doesn't output 240p and that's exactly what this request is all about.

image

@starquake
Copy link
Author

BTW Arcadeforge is working on this:
http://arcadeforge.net/PiJamma/PI2SCART-Preorder::264.html

And there's also this:
http://www.rgb-pi.com/

@MrBrax
Copy link

MrBrax commented Jan 25, 2017

@starquake i've seen that, looks promising! However, that means no GPIO pins left for non-controller use push buttons sadly.

@jimbothegigolo
Copy link

jimbothegigolo commented Jan 25, 2017

@starquake I am aware of that, but composite over 480i isn't exactly ideal, if not eye gouging.

There's also the Gert VGA666 if you're willing to settle for VGA. You might be able to convert it to SCART too with a Ultimate SCART Adapter (also from Arcadeforge)

@alessioscand
Copy link

@MrBrax @keilmillerjr @jimbothegigolo excuse me but the original request is different.

Indeed is yet possible to easily get a 240p by HDMI > VGA > SCART or GPIO (VGA 666) > SCART.

The original request is instead for 240p on Composite out (not component) that should allow to get a video mode faithful to some old retro-gaming consoles like NES or Genesis (that had a composite out). A kind of sdtv_mode=3 option would be great.

@MrBrax
Copy link

MrBrax commented Jan 25, 2017

@antiriad yes, it would be amazing to do it via composite, but due to the firmware, it doesn't really sound possible. Perhaps in a future hardware revision?

@alessioscand
Copy link

alessioscand commented Jan 25, 2017

@MrBrax yes, but @popcornmix gave a small glimmer of hope.
Even a RP1 can emulate NES, Genesis, PC Engine etc. at 60fps in full speed at low resolution (480i) on a CRT TV.
It would be great if, with some kind of "magic", we could set in config.txt a sdtv_mode=3 with, e.g., a 320x224 resolution. Not 100% accurate but surely much better than 480i.

I want to believe! ;D

@starquake
Copy link
Author

The console also looks great on 240p. You'll only get something like 80x25 characters, maybe even less but the picture is sharp and stable.

@starquake
Copy link
Author

@jimbothegigolo

I am aware of that, but composite over 480i isn't exactly ideal, if not eye gouging.

I agree. That's exactly what I described when creating this issue.

There's also the Gert VGA666 if you're willing to settle for VGA. You might be able to convert it to SCART too with a Ultimate SCART Adapter (also from Arcadeforge)

Yep that's what I said in another post and it's pretty much what I'm using.

Don't want to be annoying but you might want to read up on my other posts.

@keilmillerjr
Copy link

@antiriad I meant composite. I would have thought that had been an obvious error. I know what I meant to type, but the two words are closely spelled and are both nouns for a type of analogue video transmission.

@kevinfishburne
Copy link

kevinfishburne commented Feb 4, 2017

I've been researching this for a long time now and it blows my mind there is apparently no good solution. Here's the deal: (1) Arcade 15KHz CRTs with RGB/SCART are no longer manufactured and are rare and expensive. (2) NTSC/PAL CRT TV's are also no longer manufactured, but they are cheap and plentiful at thrift stores (Goodwill in the U.S., for example) and they typically have composite and S-Video inputs. (3) Current solutions involve daisy-chaining multiple sketchy adapters; we need something more elegant. (4) HDMI is the most common modern video output format. Conclusion: In the interest of classic gaming preservation, if you do the math, what we need for maximum usefulness to the most number of people is an adapter to take an HDMI video signal and convert it to 240p/288p signal over both composite and S-Video. This will allow anyone with a RPi/PC/laptop/etc. and $10 CRT TV to run classic games exactly as they were intended to look. I say we find a communication hub (Discord/Quip/Facebook/whatever) and start planning a Kickstarter to design and fabricate this active adapter using completely open specifications. Who's with me? I started a Discord server for the idea if anyone wants to take the discussion there: https://discord.gg/zqUdBn6

@tekn0x
Copy link

tekn0x commented Feb 4, 2017

I was able to get pretty close with an off the shelf HDMI to Component cable. This is outputting true 240p. I just have a vertical sync issue. https://www.youtube.com/watch?v=VLBHWZV1dZ4

I know it's not composite, but I thought it might interest someone.

@jimbothegigolo
Copy link

jimbothegigolo commented Feb 4, 2017

@starquake
If you use a Pi2SCART you should be able to breakout that signal into S-Video (S-VHS) without much trouble at all, just like there are RGB SCART sockets on some sets that will accept all three composite, S-Video and RGB signals, I don't see why the opposite wouldn't work.
No need to spend hundreds on fancy adapters either, you can just get a cable to go from SCART to composite without problem, methinks.
You might want to buy one of one of those RGB Scart to S-VHS adapters, they go 'round for 2 bucks each and to get composite from it, simply rid the S-Video cable and keep the RCA cables.

That seems like the best way to do it, as RGB SCART is a multi-purpose connector rather than a signal itself. At bottom, getting 240p composite directly from the RPi is impossible unless you're willing to spend a few bucks.

The confusion arises from the ''RGB'' part of RGB SCART. People assume that SCART and RGB are the same thing, but there are cheap SCART cables out there and they only out composite.

@kevinfishburne
Copy link

@tekn0x - I've seen that video and think it may be an illusion based on the vertical scrolling of the video output. I noticed in certain TG16 games on my RPi on a CRT TV that when the background was scrolling at a speed matching the refresh rate that it created what looked like perfect scan lines. I could be wrong, but if the output were stabilized the scanlines might go away.

@starquake - Apparently Pi2SCART is still taking pre-orders. Is it open-spec? I don't see anything about that. There are HDMI to SCART converters, but no idea if they'll keep vsync and do 240p when daisy chained to an SCART to S-Video adapter. I've been researching this for a while and everything I've found is a mess within a mess to infinity and beyond.

@starquake
Copy link
Author

@kevinfishburne

I think Pi2SCART will make an end to at least a part of the mess. The spec of GERT VGA is open. And you there's lot of schematics to find on how to convert VGA to RGBHV. Pi2SCART is just a solution with everything rolled into one.

For now I think the GERT VGA 666 + Ultimate SCART is the best solution.

@popcornmix
Copy link
Contributor

I have a test firmware here:
https://drive.google.com/uc?id=0B-6zmEDJwxZEME9lSEFZRmQ5RGs&export=download
Can you set (in config.txt):
sdtv_progressive_scan=1
and report back.
We have a progressive scan bit in the VEC (composite) register set.
We've tested that before and it wasn't sufficient. I've also tried disabling the interlaced signal that gets set. I'm not sure if it does the right thing (my composite TV's quality is a bit too low to tell).

@MrBrax
Copy link

MrBrax commented Feb 28, 2017

@popcornmix How would i "install" this?

@2skoops
Copy link

2skoops commented Mar 1, 2017

popcornmix:
You're amazing! I just bought an old SOny Trinitron CRT that I'm planning on RGB modding and putting into an arcade cabinet. I'm still waiting on a Gert's VGA adapter though, so until then I've been playing around with composite 480i... which looks like a total flickering mess! I happened to check the thread today and saw your new firmware, so I just briefly tested it out.

It's such a huge improvement running this monitor over 240p. No more flickering, just beautiful stable scanlines. Everything seemed to be solid for the few minutes I played around with it. The only thing I noticed was that my picture was noticeably warped and slightly titled near the edges of the screen. It could just be my TV, since it's opened up right now, but I didn't notice it when I was running 480i. Could be an issue with the sync over composite... not sure. I'll have to do a better comparison with 240p vs. 480i on the set tomorrow. (There was also a high-pitched whine from the speakers, but I'm guess that's just because the TV's guts are exposed right now)

I still plan on moving to 15kHz 240p VGA -> RGB once I get the parts I need, but having a 240p composite hookup is just so convenient and will please a lot of retro gamers! Thanks again for your hard work!

MrBrax:
Basically you need to copy all of the files into your /boot/ folder. Probably the easiest way is to power off your Pi, take out the microSD card, and plug it into a card reader on your computer. Then copy all of the files from the zip over into the boot folder (remember to back up the old versions first). After that, open /boot/config.txt and add the line popcornmix mentions above:
sdtv_progressive_scan=1
Save, close, eject, put it back into your Pi, and boot it up.

@alessioscand
Copy link

alessioscand commented Mar 1, 2017

@popcornmix awesome!
Will it work also on a good old Raspberry Pi 1 B?

@Henrito
Copy link

Henrito commented Mar 1, 2017

@popcornmix @antiriad 240p composite works with my Raspberry Pi 1 B and 2.

@alessioscand
Copy link

Thank you @Henrito !!! Can't wait to test it with Lakka!

@danieljg
Copy link

@Regulations it should be as simple as looking at the crt.

If the image flickers like it does when you play a dvd on that same screen, it's interlaced, if the image is dead stable, like you'd get on a NES, then you have a progressive image.

Look it up on youtube, it's not hard at all to tell.

@jayare5
Copy link

jayare5 commented Sep 2, 2017

Is there a way to make the 240p behave a little differently?
I just finally realized something is wrong with this but wasn't sure what. This could potentially increase the quality of the image.
Normally, game consoles use an interlacing technique even though they output 240p, each line updates differently (maybe it alternates between the odd and even lines?) and it makes some NTSC artifacts less noticeable. These are all static at least in the 240p firmware I have and it makes games with white text look like they have red dots around them. Of course, I use a filter which makes it look REALLY close to the original systems, but maybe somewhere in the firmware there's an option to make it behave even more like original videogame consoles? We might need popcornmix opinion on this :P unless this has already been discussed?

@hizzlekizzle
Copy link

There are some things that consoles did to minimize artifacts such as rainbowing in Sega Genesis/MD games, but I don't believe it's possible to reproduce those strategies in the firmware because they depend on the exact timing of the console in question.

@oguzcantasci
Copy link

@jayare5 which filter are you using, sir?

@jayare5
Copy link

jayare5 commented Sep 3, 2017

@oguzcantasci
Depends on the system, I have shader tvout-tweaks as the all-around reliable! There are others that work better in specific cases but terrible in other cases. TVout-tweaks also for some reason makes the black not as pure black. Makes me a little hesitant to recommend.
Wish I could develop my own shader :(
All you really need is a slight horizontal pixel softening. That's it. Im assuming it must be difficult to develop because almost all the "Blur horizontal" ones can look really bad on this.

@hizzlekizzle
Ahhhh I see! I mean, this is super amazing as it is already!
Maybe the only improvement at this point is really for a new mini computer to be made that has more flexible 240p, but considering how long it took to get the RPi to do it, I won't hold my breath xD
The videogame console I've seen with the cleanest and best 240p output is the PlayStation 2 (I have slim, not sure about phat one)
But to be honest, I DO love the NTSC artifacts in some cases, like for emulating NES games, because the NES did show quite a noticeable amount of it too, so in the end I still like the Pi EXACTLY as it is now :D

Again, thanks so much @popcornmix !!!!!!

@Clive75
Copy link

Clive75 commented Sep 30, 2017

Hey guys, I need some help with my Pi3. Trying to output in 240p through the RCA to my NTSC CRT. I'm using Retropie. I updated to the latest firmware, added sdtv_mode=16 to the config file, but the TV is still outputting interlaced. Tried mode 0,1,2,18 and even tried to switch to PAL and somehow its not working, when I typed tvservice -s, it tells me its outputting in NTSC 4:3 720x480 60hz interlaced despite the changes in config file. I tried tvservice -c "NTSC 4:3 P" and it gives me a black screen.
I have no clue what is wrong.

@starquake
Copy link
Author

@Clive75 You say you added a line, but there already should be one IIRC. Does it have 2 lines now? If so, remove one.

@Clive75
Copy link

Clive75 commented Sep 30, 2017

I dont think there was one.
Here's my config file, just in case

https://gist.github.com/Clive75/ba425fff946893603a0fe511341de3e6

EDIT: I fixed it. I removed the spaces from "sdtv_mode = 16" to "sdtv_mode=16" and it worked. Finally no more flickering! Thanks Starquake!

@ultraover
Copy link

@Clive75 Did you update manually or used the rpi-update?

@starquake
Copy link
Author

@ultraover You did see it was fixed, right?

@ultraover
Copy link

@starquake yo, as a matter of fact, i was reading your post at libretro #73

i will be honest here, I asked that question because i am really confused about implementations and updates involving the rpi-update. Take issue #811 for instance, i have no ideia if I can get changes discussed there using the rpi-update instead of downloading the files popcornmix linked to.

Now, being more specific: i am running batocera linux 5.9 and trying to make 240p over composite. The question is: will rpi-update give me what it takes to enable "new" sdtv_modes?

I am new to the community and to the whole pi3 scene, so bear with me for a while :)

@Clive75
Copy link

Clive75 commented Oct 4, 2017

@ultraover I used rpi-update. Lost a few hours because of some spaces but lesson learned.

@ultraover
Copy link

@Clive75 thanks!

@HellTazer
Copy link

So i can output 240p on a sony wega crt just using Clive75 configs and the the 3.5mm jack of the Pi3? over my composite AV? no need for adaptors? thanks to all :)

@GerryHolt
Copy link

Is there a way to change the resolution while the machine is running or to set up a script to reboot the machine in a different resolution based on what's launched?

@sdubrick
Copy link

@HellTazer Yes
@GerryHolt Yes, see this comment for the commands to switch resolution during runtime

@jayare5
Copy link

jayare5 commented Nov 26, 2017

Does anyone here use ASUS' Tinker Board? It has very good specs but doesn't output video for CRTs through the Audio jack. I was wondering, how will we do it moving forward with possible better / future boards that only have HDMI?
tinker board

@hizzlekizzle
Copy link

@jayare5 We'll just have to use the costlier GPIO-based output hats.

@jayare5
Copy link

jayare5 commented Nov 26, 2017

@hizzlekizzle Huh! So that's possible for 240p?
Also the cost would be worth it if the games that can already be emulated on the Pi3 B could take advantage of the more powerful hardware! (Like reducing input lag even further.)

@KoolKiller
Copy link

KoolKiller commented Dec 16, 2017

Thanks for all the effort, especially to @popcornmix.

Is there a way to enable the firmware fix on a PAL system? I get it to work in black and white/NTSC, but when I set sdtv_mode=2, the pcture begins to scroll continuously from top to bottom (otherwise it looks fine). I'm on a CRT monitor.

@manekinekodesu
Copy link

manekinekodesu commented Dec 16, 2017

Hey @KoolKiller, maybe check out this issue Support for PAL60 in config.txt/sdtv_mode

sdtv_mode=2 will get you standard interlaced pal 720x576p output.
sdtv_mode=18 will get you progressive pal 720x288p output.
sdtv_mode=34 is for interlaced pal60.

@KoolKiller
Copy link

@manekinekodesu, thanks for the tip!

Sadly, sdtv_mode=18 doesn't fix it in connection with sdtv_progressive_scan=1. I assume that it works fine on NTSC. Has anybody successfully tested it on a PAL CRT monitor? I'm on a Commodore 1084S, if that helps.
I would really like to figure this out. My only other output device is a HD projector. 8-bit looks fine, but anything above tends to strain my eyes.

@manekinekodesu
Copy link

manekinekodesu commented Dec 20, 2017

I'm using PAL CRT TV. And pal50 progressive mode works just fine (sdtv_mode=18 or sdtv_mode=0x12).
I'm not sure, if you need sdtv_progressive_scan=1 line.
@KoolKiller, You can compare your config file with mine here(it's a bit messy though, sorry):
https://github.com/manekinekodesu/lakka-PAL50-config/blob/master/flash/config.txt

@rayanfer32
Copy link

The composite pin on my pi zero is not responding ..... was working fine before ....and now its like pin is dummy ... i tried all possible ways to make it work ... the problem is now i want to change the default TV out pin config ... any idea

@jayare5
Copy link

jayare5 commented May 10, 2024

@starquake @alessioscand @MrBrax @jimbothegigolo @kevinfishburne @tekn0x @KoolKiller @danieljg @danmons @hizzlekizzle

Hey, are you guys still interested in this? Check this out, we've made a Lakka branch specifically for the Composite output of Raspberry Pi, with updated RetroArch + cores!

https://lakka.tv/articles/2024/05/02/rpi-composite/

@ibex-are-goats
Copy link

@jayare5 Thank you for the composite output release of Lakka!!!!

@jayare5
Copy link

jayare5 commented May 15, 2024

We've made important updates for PAL TVs! If anyone was having trouble getting a progressive signal, you should redownload from that same article and please read the changes made to the "PAL users" section for instructions.

@sharmashivanand
Copy link

Is this still possible with Pi 4 in 2024? Which version of Raspberry OS should I be using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests