Log in

View Full Version : Virtual (simulated) interlacing?


grigory
24th March 2002, 02:53
I hope I am not breaking any forum rules, but I kinda had an amusing thought (I am new to this, so it may not be so amusing to some of you more experienced people). I have spent many hours researhing this forum (and other sources), asking questions (and getting very helpful answers), all to learn how to deal with interlacing artifacts in a captured movie.

Now, as far as I understand, the problem is that PC Displays are not interlaced (unlike TV screens), and thus all these problems with visible interlacing artifacts. I even read some posts that said that if you make a SVCD, for example, to play on TV screen, you don't have to worry about deinterlacing, since on an interlaced TV Screen it will look fine.

My question is, wouldn't it be possible to write a decorder/player which would simulate interlacing an a PC screen? For example, encode top and bottom fields separately, and display them in sequence, like on TV, "plugging" the lines of the bottom field inbetween the lines of the top field that is already displayed on the screen, then "plugging" the next top field into the previously displayed bottom field, etc.? Wouldn't it eliminate, or at least minimize the deinterlacing problem?

Sorry if this is a clueless question.
But I'd like to hear someones thoughts on this.
Thanks!

dragoman
24th March 2002, 03:37
Hi,

The reason for interlaced video is lost in technology history.

Orignally, TV's could only disply a maximum of 30fps...but the US uses a 60hz power cycle.

The need for interlaced tv became apparent when the bandwidth for tv signals was 30fps, but in order to achieve "persistance of vision" (ie smooth video) the fps needed to be 60fps, since a framerate that did not correspond with the power frequency of 60hz produced flickers in the video.

So interlaced frames were invented, which solved both problems. Each frame of an interlaced video has two fields, an upper and a lower, each of which is displayed approximately 1/60 sec each.

Sidenote: Ever wonder why PAL video is at 25fps? Guess why.....Europe uses a 50hz power cycle! Each frame of a PAL signal has two fields, each displayed at 1/50 of a second each.

However, a computer monitor can display much higher framerates than a NTSC or PAL tv. Therefore "progressive frames" are used on monitors. Progressive frames are an entire frame displayed at once (both fields of an interlaced signal combined), usually at a framerate of ~24 fps. (Technically, a motion picture film is progressive scan, because the projector displays an entire frame at once onto the screen...hence the term FILM for de-interlaced video)

You might ask: Why does the US and related countries still use interlaced video when technology has increased to the point where they can support progressive frames, which is better?

The reason is that interlaced video can produce persistance of vision at a lower bandwidth than progressive frames, even though progressive is better. (Why do you think Progressive-scan dvd players are more expensive? Also, why don't you have to buy a new tv to use progressive scan dvd players? The reason is your tv can support progressive scans already, but TV signals are still interlaced.)

Lower bandwidth means less money the tv stations have to lay out in order to provide service.

Now to your question:

"My question is, wouldn't it be possible to write a decorder/player which would simulate interlacing an a PC screen?"

No, you can't "simulate" interlacing because interlacing is a property of the video, not the monitor or screen. Because the display frequency (i.e. refresh rate) of your computer monitor is not the same as your tv, a interlaced signal will not look the same as on your tv. You can watch an interlaced video on your monitor just fine, but you will see horizontal black lines in the video.

The problem is that computer monitors only have one display mode, that is progressive frame. A tv has both interlaced and progressive frame mode. Any interlaced source displayed on a progressive display screen will display the lines.

Theoretically, if you could get a monitor that could display video that has a interlaced-video output (the same way as a tv), the interlaced video will not display any lines. But as of right now I don't know of any that have this function (and I doubt that it would be in great demand anyway).

Hope this helps...

dragoman

avih
24th March 2002, 06:16
Originally posted by dragoman
... No, you can't "simulate" interlacing because interlacing is a property of the video, not the monitor or screen. Because the display frequency (i.e. refresh rate) of your computer monitor is not the same as your tv, a interlaced signal will not look the same as on your tv. You can watch an interlaced video on your monitor just fine, but you will see horizontal black lines in the video.

The problem is that computer monitors only have one display mode, that is progressive frame. A tv has both interlaced and progressive frame mode. Any interlaced source displayed on a progressive display screen will display the lines.
...

that is partially correct.

indeed, progressive monitor won't display interlaced material correctly, however, the guy was talking of a "simulation" which is a broad term. it u take a look at the dscaler project (http://www.dscaler.org/ - displays tv in real time on computer, de-interlaced possible in MANY different algorythems) u'll see that it takes the interlaced signal, and applies smart algorythms such that it looks smooth on pc monitor. more than that it uses more advanced de-interlacing techniques that the simplest one (simplest=bob=show only half if the frame=only odd lines or even lines, twice the fps, more or less as real tv does=half vert resolution@twice fps) but it also have algo's to retain some of the original vertical resolution without causing these interlace artefacts. yes, of course, for best results, your monitor refresh rate should be a multiple of your your broadcast vertical freq (50hz for europe, 60hz for usa).

the guys at descaler project, even made a direct-show plugin, that does de-interlacing on arbitrary material (very perliminary version though). this might fall into the category of "simulation" as well.


buttom line. u can use software to "simulate" an interlaced display smoothly on a progressive monitor.

cheers
avi.

dragoman
24th March 2002, 06:26
Hi,

Okay, I wasn't aware of that particular bit of software, so I guess I was wrong.

You can watch smooth interlaced video on your comp.

But from what I see, all it does is deinterlace-as-you watch, not display true interlaced material on your comp.

The reason it looks smooth is that it is progressive (interlaced on-the-fly).

So if you are using the term "simulated" in a broad sense, you are correct.

However, if you wish to do some editing of interlaced material, this will not help you. As far as I can tell, it does not de-interlace the material if you are say, capturing the video to the hard drive (copying tv show). You would still have to de-interlace the video later.


dragoman

avih
24th March 2002, 08:00
Originally posted by dragoman
.. display true interlaced material on your comp.

define pls "display true interlaced"

"fact"#1: pc monitors display progressive (most newer displays at least) and we want to keep it that way (debatable, but usually correct).

"fact"#2: some sources (captures, real-time-video-in/some-dvd/etc) are interlaced.

"fact"#3: there's no "direct" way interlaced sources would show correctly on progressive display.

solution: u can't modify the hardware, so MODIFY the source (during capture(=recording) OR encoding OR playback) such that it displays without interlaced artefacts, and with maximum (not such a trivial definition here) spatial (especially vertical) and temporal (=fps) resolution.

implementation:

CAPTURE: de-interlace during capture with various virtualdub filters - i, at least, am unaware of a way to increase temporal resolution during capture in case of true (=originated from video [and NOT film which is not "truely" interlaced]) interlaced source. alternatively, u may also use a codec which CORRECTLY supports interlaced source (divx5 falls into this category so i hear, xvid will follow very soon. divx4 doesn't match this definition afaik) with the latter solution, u'd still need a deinterlacing facility during playback (see next sections).

ENCODING: capture original interlaced material WITH artefacts (usually damages compressibility), and apply deinterlacing algos for increased vertical and temporal resolution during encoding (i.e. use avisynth with separate_fields->doubleweave->smart_deinterlace->select_odd). now your newly encoded video will have a progressive nature.

PLAYBACK: projects such as dscaler are a good starting point here. it's dshow filter may enable (some time in the future) to play interlaced sources (i.e. not only real-time-video-in) in real time, while keeping the original interlaced nature of the source. another solution would be to use avisynth for playback (u'll need a STRONG computer) with same settings as suggested in the "encoding" section of my reply. i've been using the latter with satisfying results.

imho, these methods are not such a bad definition for "simulation" of interlaced display, again in the broader sense of matching an interlaced source to the capabilities of a progressive display.

it doesn't change the display hardware, but modifies the signal to the hardware's capabilities.

does it matter if u modify the hardware or the source? ;) u get very similiar final result....

cheers
avi

dragoman
24th March 2002, 08:25
Hi,

I agree with you on all points.

My point was that it is impossible for a computer monitor to display interlaced material the same way that a tv does.

That's it. Yes, these programs are better for viewing interlaced material on a progressive display....no argument. If that is all the person was interested in, fine.

My idea of "true interlaced material" is watching the orginal tv material, unfiltered, on your computer monitor and having it appear without horizontal lines. In a sense, having a dual display mode on your monitor, similar to a modern tv. That, as far as I know, does not exist.

I'm not trying to debate the definition of "simulate" or anything else with you....

dragoman

avih
24th March 2002, 08:31
:) hey, we're NOT fighting .. ;)

the guy was looking for a solution for interlaced material on a pc monitor. i was marely trying to help with theoretical background (actually, you excelled in that area ;) ) AND some practical suggestions.

no offence :)

cheers
avi.

ps
> " My idea of "true interlaced material" is watching the orginal tv material, unfiltered, on your computer monitor and having it appear without horizontal lines. In a sense, having a dual display mode on your monitor, similar to a modern tv. That, as far as I know, does not exist. "

if u insist on "unfiltered" than u're correct, however, if u'll try dscaler, u'll find that u get 50/60fps, full vert resolution (i.e. 576/480) AND NO TV-LIKE interlaced artefacts (i.e. vertical jitter on sharp edges). it actually theoretically and practically IS BETTER THAN REAL-TV (as long as the de-interlacing algo's are working well, as they are most of the time). so imho, we're not talking definitions here, but percieved visual quality. progressive display + good algorithms can produce BETTER results than plain TV (some exception with 100Hz tv sets, as some of them also deinterlace).

also, if your sole aim is reproducing real-tv quality, you'll find any of the 'bob' deinterlacing methods (of dscaler or others) very good.

they have same pros and cons of standard tv (i.e. absolutely no horizontal interlacing artefacts, half vertical resolution for each field with appearant double vertical resolution for a sequence of fields, field rate which is double the frame rate, small jitter with sharp vertical bounderies etc.) it's as close as u can get to actual interlaced display, and u probably won't be able to tell the difference between real interlaced display and progressive display+bob-deinterlace. if u don't find the other (and better) de-interlacing algorithems satisfying (they do have occasional undesirable effects) bob gives very good results.

dragoman
24th March 2002, 10:38
Hi,

Thanks, I don't like to fight other people....

Yes, I was referring to unfiltered video, but the program you are "plugging" looks very interesting. I plan to use it myself since I watch tv on my computer monitor.

Do you know if it applies it's filters while capturing to the hard drive? If so, this would eliminate the need to de-interlace the video later....

dragoman

avih
24th March 2002, 12:17
>" Do you know if it applies it's filters while capturing to the hard drive? If so, this would eliminate the need to de-interlace the video later....
"

it's one of theig goals. it has capture, but it has many flaws in that area, and it's not as polished as the rest of the app or other capture apps. i didn't have the time to test the newly released version (came out today or yesterday) fully. all i was talking earlier was regarding the previous version. i'm sure the new one is better though.

the main aim of this application afaik atm is to act as a tv player instead of the one that comes with tv card.

also, many deinterlacing algorithms (including bob) are available for virtualdub and avisynth. as far as i understand they intend to make the direct-show filter act as an external plug-in for other applications that need deinterlacing facilities.


cheers again
and good luck ;)

trbarry
24th March 2002, 14:49
On a fast computer DScaler can deinterlace 60 fields / second of interlaced video source and output 60 frames / second of a progressive 720x480 display.

I ported the DScaler Greedy (High Motion) plug-in to Avisynth as the GreedyHMA (Greedy HM for Avisynth) filter so you can get mostly the same results. With some limitations ...

Good capture cards can capture the full (for NTSC) 60 fields / second, as 30 interlaced frames, so the data is still all there. But after deinterlacing and compressing only 30 frames / second are usually kept. I don't think current computers could easily decompress and display a 720x480 progressive image at 60 frames / second yet.

But this means the display of a captured file will not be quite as smooth for moving images like sports or scrolling stock tickers at only 30 fps as you would see on DScaler real-time at 60 fps.

Also DScaler on current computers probably does not quite have the power to both real-time deinterlace and save the data in mpeg2 or mpeg4 form giving decent compression ratios (but it's not far away).

30 progressive frames / second at 720x480 is a huge amount of data without good compression. So it is still probably better to capture in a normal fashion and deinterlace later as you re-encode it.

But give it another year or two and this may change.

- Tom

Kedirekin
24th March 2002, 15:41
This is just idle rumination, but as a theoretical concept, I believe it would be possible to emulate interlaced display. The key concept, I believe, is emulating phosphor fade.

If you had a monitor with a 28,800 Hz refresh rate, you could emulate an NTSC TV effectively perfectly (update on every emulated scan line). Kind-a pie in the sky, but this a theoretical discussion.

Obviously, since monitor refresh rates are currently in 80-120 Hz range, we can't get 'perfect' emulation, but even with a 120 Hz refresh rate, I think you could get fairly good emulation. You could maybe even get fairly good emulation if you could set the monitor to exactly 59.97 Hz (or whatever the NTSC field rate is).

avih
24th March 2002, 15:44
tom
(OT) i saw the new version of dscaler... seems it has some bugs :(

back to topic.
i use my pc as a vcr, and i like motorsport stuff (bikes, rally etc). i definately enjoy 50fps (europe) playback and i don't wanna re-encode in 50fps since i watch it only once or twice afterwards and re-encoding takes too much time.

so i capture using xvid (used to use divx4.11 before that) with decreased vertical and horizontal rez, that still keeps the interlaced nature (i.e. (x,y)=(320x480)) at quality=~85-90%. yes, i loose much vertical information (pal is 576 rows) but it still has 2 fields.

for playback, i use avisynth's bob feature (with resize to 320x240) to play the file (through zoom player). the final result is definately not the best de-interlaced output quality u can get, BUT it does have 50fps output, with descent quality and is VERY watchable. 50fps is SO much better than 25fps, even with all the above mentions shortcuts.

all this, on a humble duron 800 :) (i cross the boundery though if i increase the quality of each of those steps)

so it is possible to use current computers to deal with interlaced material in real time with descent results, allthough it would be much more fun with at least twice that power :)

ahh, the future :)
;)

grigory
24th March 2002, 16:01
HI,
Wow, what a discussion I started...:)
I guess I did not express my idea clearly - Kedirekin phrased it much better:

The key concept, I believe, is emulating phosphor fade.
If you had a monitor with a 28,800 Hz refresh rate, you could emulate an NTSC TV effectively perfectly (update on every emulated scan line).

That was basically my idea (purely theoretical, of course - I have done some amateur programming, but I am not anywhere near the level needed for any kind of video proccessing).

But I'll try the DScaler - sounds great!

Thanks!

trbarry
24th March 2002, 17:41
avih -

Are you sure you are displaying 50 frames / second? If you open that avs script in Vdub does it say that?

I wasn't aware of any way to capture PAL at more than 50 fields (25 frames) / second. Does Avisynth Bob double the frame rate? I've never used it. (oops, just looked it up, maybe it does)

- Tom

avih
24th March 2002, 20:28
Originally posted by trbarry
avih -

Are you sure you are displaying 50 frames / second? If you open that avs script in Vdub does it say that?

I wasn't aware of any way to capture PAL at more than 50 fields (25 frames) / second. Does Avisynth Bob double the frame rate? I've never used it. (oops, just looked it up, maybe it does)

- Tom
yes, yes and... yes :)

well, it's not MORE than 50fields/sec, it's exactly capturing @ 25frames/sec (as u would normally capture interlaced material) displayed as 50fields/sec.
i use: "clip.complementparity.bob(0.3,0.3,clip.height/2)".
complement parity since my card reverses the order. and yes, it displays 50fps bobbed and vdub confirms that (although it's VERY obvious it's more than 25 fps, SO much smoother playback).

quite fun to capture once, and playback it right away in 50fps :)

ps
i used a batch file to create an auto.avs file. i put this batch file in windows\sendto directory, so i can right click on an interlaced captured file, send it to this batch file and generate an automatic avisynth file that playes automatically. here's the content of this "avi50fps.bat" file:

rem start of auto de-interlace avs generator
rem filename is "avi50fps.bat" in windows\sendto

set file="c:\auto.avs"
delete %file%
echo clip=aviSource("%1") >> %file%
echo clip.complementparity.bob(0.3,0.3,clip.height/2) >>%file%
start /w %file%

rem end of auto de-interlace avs generator


remarks:
1. i must capture pcm audio since avisynth doesn't play encoded audio. this causes the audio part to as large as the video part inside the captured *.avi file. still MUCH smaller than mjpeg, and plays right away after capture @50fps.

2. to get smoothest playback, i set my monitors refresh rate to 100Hz such that every field remains exactly 2 refresh cycles.