Actual NES/FAMICON/FAMICLONE framerate?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Actual NES/FAMICON/FAMICLONE framerate?

Post by tokumaru »

Hi guys
I was experimenting the other day with my new DV camcorder and it's analog to digital feature, and decided to capture some clips of me playing one of my famiclones. The video quality was very good and all, but the audio got out of sync after a while, it was going faster than the video. None of my other tests had this effect, only this one.
Then I remembered reading somewhere that the NES framerate wasn't the actual 29.97 fps of the NTSC standard. Could this be the cause of the bad sync? Has anyone experienced anything like this?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Yes, the NES video deviates from the NTSC standard. Instead of 262.5 lines per field it has 262 lines, in order to get a progressive image. (At the time the NES came out, there wasn't enough memory to make a decent interlaced image. In fact, the first major console to have "most" games interlaced was the Dreamcast.) It also has 227.333 color clock periods per scanline rather than the expected 227.5. Thus (not counting the differences between even and odd frames) the NES frame rate is 3579545.45 / 227.333 / 262 = about 60.10 FPS instead of the 59.94 that your equipment expects.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust »

Another very minor detail is that every other frame, one single scanline (the 'dummy' before actual video rendering starts) is 2/3 of a color clock period shorter (340 NES pixel clocks instead of 341, which translates to 226.667 instead of 227.333).

The exact framerate can be expressed as 1789772.7272727 / 29780.5 ([341 ticks per scanline * 262 scanlines - 1/2 tick per frame of skew] / 3 ticks per CPU cycle), or ~60.098814 frames per second.

When dealing with PAL, the "every other frame is a pixel clock shorter" does not happen, so it simplifies to 1662607 / 33247.5 (341 ticks per scanline * 312 scanlines per frame / 3.2 ticks per CPU cycle), or ~50.006978 frames per second, which is much closer to standard PAL than NTSC NES video is to standard NTSC video.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Guest

Post by Guest »

Hum... I see... so the video is actually a bit faster than 29.97. That makes perfect sense, as the my captured file is 29.97 fps, wich means it has been slowed down, thus, the audio is going faster. I didn't think there would be any trouble capturing videogame footage. I'll try changing the video's framerate to the values you showed and see if I can get a good sync then.
Thanks for the explanation!
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

This board is crazy... it's me up here...

Hey, turns out there was a difference in the duration of video and audio in the captured file, and VirtualDub (for those not used to video editing, it's a freeware video editor) sugested changing the framerate to 30.051 frames per second (60,102 fields per second) to have both tracks match their lengths... This value is pretty close to what you guys calculated, and the sync is now perfect.

I could never imagine this would happen... so, in order to make a standard NTSC movie from the NES I'll have to drop frames... live and learn!
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

tepples wrote:Yes, the NES video deviates from the NTSC standard. Instead of 262.5 lines per field it has 262 lines, in order to get a progressive image.
How does it achieve a progressive image? The captured video looks very interlaced to me... I can see that 2 NES frames turn into 1 interlaced frame, where each NES frame becomes 1 field of the new frame.

I can't say I understand much about it, so I want to ask, how does that qualify as progressive?
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg »

It's progressive in the sense that it's not interlaced. Most (all?) NTSC TVs determine whether a field is even or odd by counting the scanlines of the previous field. If you output fields that all have the same number of scanlines, you trick the TV into becoming a non-interlaced 60 frames-per-second display with half the usual vertical resolution.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

blargg wrote:If you output fields that all have the same number of scanlines, you trick the TV into becoming a non-interlaced 60 frames-per-second display with half the usual vertical resolution.
Then how come all frames look exactly as regular interlaced ones when captured through a camcorder or a capture card of any sort? Are TVs all that sophisticated to distinguish the types of fields that are comming in and all? I thought this was a standard and period.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust »

Simple - your camcorder/capture card is not smart enough to recognize a non-interlaced NTSC signal and is rendering it as interlaced regardless.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

tokumaru wrote:so, in order to make a standard NTSC movie from the NES I'll have to drop frames
Or just change the video to 29.97 frames per second and resample the audio to match the video.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

tepples wrote:Or just change the video to 29.97 frames per second and resample the audio to match the video.
Thats a very good idea! Messing with the audio is less noticeble than messing with video. I have never resampled audio before, though. I might be a little hard to get it right if not doing the more common procedures (PAL to NTSC, NTSC to PAL, etc), wich usually have templates for them.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

  1. Look for length of video, in minutes, seconds, and partial seconds.
  2. Extract audio to AIFF or WAVE format.
  3. In an audio editor such as Audacity or Audition, resample the audio to match the length of the video. For instance, in Cool Edit Pro (which is now called Audition), use Effects > Time/Pitch > Stretch... and make sure to choose Resample rather than Time Stretch or Pitch Shift.
  4. Reinsert audio.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Thanks, tepples! I have SoundForge, and I bet it has the resampling option, even though it is a bit old version. I'll give it a try soon, but I see no reason for this not to work! =)
johannesmutlu
Posts: 31
Joined: Fri Mar 11, 2011 2:22 pm

Re:

Post by johannesmutlu »

blargg wrote:It's progressive in the sense that it's not interlaced. Most (all?) NTSC TVs determine whether a field is even or odd by counting the scanlines of the previous field. If you output fields that all have the same number of scanlines, you trick the TV into becoming a non-interlaced 60 frames-per-second display with half the usual vertical resolution.
You know what,i first alway's tout that the nes could only view 30 frames per second and that it uses both the odd and even field from a crt tv set to do that at 240i,yeah i tout that the nes has a 3.2 pulldown filter to convert those 30 whole frames per second into 60 fields per second,by using 120 odd and 120 even fields to round up to 240 signal,to view those graphics in a letterbox way like the pal nes,but ,o,o,o,man what was i wrong because it turns out that those old crt tv sets are able to opperate in 240p modes by only using the odd or even fields and then refresh at 60 frames per second with added blacklines to it.
So the nes is splitting it's graphics into odd or even fields instead and NOT use both of them.
HOWEVER,this will be problematic for lcd screen since they don't recognize 240p signals being at 60 frames per second,so not only will it view those graphics incorrectly but also leaves a slight blur during motion, well that explains alot,since lcd screens were only designed with 480i signals at 60 fields per second in mind to be reconstructed/deinterlaced at 30 frames per second,so no luck for us retro gamers unless we get the frame meister wich is designed for 240p recognision.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Actual NES/FAMICON/FAMICLONE framerate?

Post by tepples »

Speaking of Framemeister, I've been porting Artemio's 240p test suite to NES.
Post Reply