Log in

View Full Version : Playing XVID on an interlaced PAL CRT TV


mbrickman
19th February 2008, 09:10
Expert Help Needed!

I do not seem to be able to encode interlaced source material (DVDs) and get them played on my interlaced TV without getting motion artefacts and juddering. It seems to me that whatever I do my videos are de-interlaced (badly) and then re-interlaced when sent to the TV.

This is what I am trying to do: I have a large collection of DVDs in UK PAL Format (a combination of films and TV shows) and I want to create a DVD jukebox (like an iPod for video). I also want to add to the collection using recordings from live TV. I have built a HTPC and am using MediaPortal (for now) as my main software. I have a conventional (CRT) Panasonic TV (ie it requires an interlaced PAL feed).

Having tried various encoders, I have selected XVID as it seems to give the best blend of speed, compression and quality.

I am using DVDFab to extract the movie or TV programme to a single VOB file which I rename to an MPG file. I then use the XVID codec (version 1.1.3 28/06/2007) in VirtualDubMod to convert this to a compressed AVI file. I tick the 'Interlaced Encoding' and 'Top field first' boxes.

My HTPC comprises: a Biostar TF7050-M2, AMD Athlon 64 X2 4800+ CPU and 2GB memory. The board contains an NVIDIA GeForce 7050 PV. I have the latest NVIDA driver installed from their website (7.15.11.6925 11/12/2007). I am using Windows Vista with all the latest patches. The TV is connected to the s-video port on the motherboard. Vista reports the display as 25Hz Interlaced. The television section of the NVIDA software has been configured to show the correct connection (s-video) and UK-PAL has been selected.

To debug the problem, I have taken a clip of some scrolling credits. When I play this back using the XVID codec the motion is jerky and the titles are clearly combed - obviously the video has been 'weaved' either by the XVID codec or by the NVIDIA driver. I can find no setting for the codec or NVIDA that alters this behaviour. As an alternative I have tried using ffdshow with both the libavcodec and xvid codecs with the same result. I have had some success setting the ‘Set interface flag in output media type’ and choosing the ‘Bob’ method. This is supposed to pass the interlace related information on to the next filter. While this does seem to remove the combing effect and smooth out the motion, it results in frame losses and consequent lip sync problems. I suspect that I am actually seeing some very well de-interlaced pictures and the frame losses are as a result of the additional processing load required to create these.

Please can someone who really knows what they are talking about give me some pointers. Surely it must be possible to pass the interlaced content right through the filter chain to the TV? Ideally I would like to stick with the XVID decoder as ffdshow just adds unnecessary complexity.

Thanks in advance.

cmw
20th February 2008, 05:45
You do not need to feed interlaced content to a CRT TV. Interlacing is basically a means of compression so that cable networks can handle the bandwith better. The TV should playback progressive material fed by S-Video just fine.

The interlaced encoding with top field first afaik tells the encoder that your *source* is interlaced (with top field first) (i.e your DVD's are interlaced), which is not true though, resulting in horrible quality. Just do not use this option.

Also I advise you not to use single pass (most probably fixed bitrate) encoding, but rather 2 Pass Encoding, as it yields far better quality. There are more convenient tools for this than Virtual Dub. You can find Guides on this matter either here in the Forum or on the main Doom9 site.

communist
20th February 2008, 13:12
You do not need to feed interlaced content to a CRT TV. Interlacing is basically a means of compression so that cable networks can handle the bandwith better. The TV should playback progressive material fed by S-Video just fine.

The interlaced encoding with top field first afaik tells the encoder that your *source* is interlaced (with top field first) (i.e your DVD's are interlaced), which is not true though, resulting in horrible quality. Just do not use this option.
Thats not fully correct. The OP most likely has interlaced material (TV-shows), he encoded them as interlaced XviD (with TFF). He is seeking advise on how to properly play it back on a TV via TV-Out and retain the interlace nature so it looks correct.

To the original problem: mbrickman you're trying to debug it with a clip from scrolling credits. Make sure it really is interlaced, a simple Avisynth script like this should do it:

Source()
Assume?FF() #set fieldorder with T or B
SeparateFields()

Step through it in VirtualDub, do you see motion in every field(frame)? Yes -> it's interlaced.
Is the motion forward->backward->forward? Yes -> you have the wrong field order.

Also make sure that the resolution is 704/720x576 and that this is the resolution you output via TV-Out.
I once tried to do this too (with DV/MPEG2) and an ATI card but never could tell if its really correct.. its quite a messy situation. Your best bet is to output 50 fps (simple bob should do it), the TV should take care of playing it correctly.

Also see http://forum.doom9.org/showthread.php?t=131681

Lenny_Nero
20th February 2008, 21:15
There is no need for interlaced material to be used, and the resolution point is not important either (but keeping under 720x544 might be a good idea), well ...not on any of my PAL CRT's.

I encode a large amount of DVB-TV as well as having an amount of my DVD's backed up onto my HTPC/media server, and I have yet to find anything I can not play back via SAP, SCART or S-Video cable.

I use StaxRip for all of my encoding work now, but Auto GordianKnot is very good for getting started with Xvid encoding.

Didée
20th February 2008, 21:51
There is no need for interlaced material to be used, and the resolution point is not important either
Congratulations for missing the point. The question isn't whether you "have to" use interlaced material or not.

The point is: If you DO HAVE interlaced material, and you ARE using a PC's graphic card to feed a standard TV, then it might get easy, or difficult, or even impossible to feed the TV with a "proper" signal. It depends on the capabilities of the card and/or the card's drivers. Some equipment will give you no choice, and braindeadly deinterlace everything before putting it out.

My bet is that many people claiming to have no problems in that respect would be surprised when using a suited test signal to actually check what they're really getting from their wonderful TV-out ...

Lenny_Nero
21st February 2008, 19:00
Sorry, but I did not 'miss the point', from what I read the OP has some media that they want to show via a CRT TV set. Something I have been doing for many years via many video cards and onboard graphics setups, and I have yet to come across a setup that I cant do (i.e. show media), I have used ATI 9250, 9550, 1650, 1950, nVidia nforce [2] motherboard onboard, 7600 GT and 7900 GT cards and every single one of them has been able to show direct from my DVB-TV cards, via mpeg2 (interlaced or not) or what I use most Xvid from hard drives or optical media. It matters not if the media is interlaced or not and I dont see why it would make more of a problem, as I understand it PAL TV's can show both ...well all of mine can.

I use S-video cable the most to a Phillips match line set with the screen resolution set to 1024 x 768 at 60 Hz and use media player classic to play the output via overlay, but also have a SCART setup to do the same.
I have always found it very simple to set the graphics drivers to run the sets, but ATI/AMD drivers/cards are much better easer to get running quickly and take only minutes to do so.

Didée
21st February 2008, 23:08
Well, if things are so easy, then sorry for my comment.


Oh, wait, we forgot something ... the OP does have a problem!


*You* told that one just needs to plug-in, press a knob or two, and everything will run flawlessly.

*I* told about technical reasons that explain the problems the OP is having.


Now what.

mbrickman
23rd February 2008, 10:23
Thanks for your various comments - unfortunately I have not got the definitive answers I need. Also, as I feared, this has sparked off some heated debate.

I wish things were as simple as Lenny_Nero makes out. I had expected setting up a HTPC to be a little more complex than a DVD player - but this is like studying astro-physics. I am a programmer, so I am used to dealing with technical stuff, but I did not expect this level of complexity. Part of the problem is there seems to be a lot of confusion and misunderstanding about and very little definitive documentation.

Taking some of your comments:

cmw - In a way, you are right that interlacing "is basically a means of compression". However it is a very clever means of compression that relies on a combination of a CRT and a human eye to decompress the signal. As computers have yet to come equipped with human eye chips, it is actually quite difficult to 'decompress' interlaced signals. This is why there are so many de-interlacing tools available as it is not easy to replicate the way our brains fill in the blanks - especially in real time. Actually interlacing is really a brilliant way of using 1930’s technology to render acceptable TV pictures over very limited bandwidth. Unlike a modern compression method which retains all the data (albeit with varying degrees of distortion), interlacing renders half of the signal without any loss and simply ignores the other half of the signal. All a decompression filter needs to do is extract the data from the compressed file and arrange it back into frames – essentially all the pixels for each frame are described in that file. A de-interlacing filter on the other hand already has half the pixels in its input stream . Unfortunately the other half are just not there – so it has to ‘guess’ them.

For de-interlacing to be effective (in a PAL region), it must convert your signal from 25i (ie 25 frames per second, 2 fields per frame) to 50p (ie 50 frames per second, 1 field per frame). Moreover the signal must be displayed on a monitor with a refresh rate of 50Hz (or a multiple thereof). Also the missing lines in each frame need to be reproduced as accurately as possible – which can involve a lot of processing if there is a lot of motion. And remember, all this has to be done in real time without dropping frames. This is a very tall order and in practice the different solutions trade off accuracy for CPU usage. For example, it is much easier to ‘blend’ the frames together and create a 25p signal which is fine for slow scenes, but makes action scenes look ‘artificial’.

This is why I do not want to de-interlace my material. My brain already has the software to do the job in real time without any of the unnatural artefacts that computers produce. Also this avoids me wasting CPU cycles and risking frame losses which can lead to AV sync problems.

cmw also seems to think that DVDs are not interlaced – this is not true. All DVDs are interlaced (at least all the ones I have looked at). Perhaps what he means is that films/movies are not interlaced. But they are when transposed onto a DVD. However it is much easier to de-interlace movies (again in a PAL region) as the two fields can simply be woven together to create a 25p source which is close enough to the original 24fps so as to make no difference. NTSC is more problematic.

communist: Thank you for your clear and insightful input. You have clearly understood the question and restricted your comments to the issue. I had not considered using an Avisynth script into VirtualDub to get a better understanding of what is going on – this has been very helpful.

Lenny_Nero: Hopefully the comments above explain why I want to preserve the interlacing. I suspect on your setup, you are either de-interlacing when you compress or de-interlacing on the fly and put up with the artefacts. Also as you say your monitor is refreshing at 60Hz you will definitely be seeing motion artefacts even if the material has been perfectly de-interlaced so these obviously do not bother you.

didée: Thank you for trying to keep the discussion on topic. Do you have any specific suggestions? You mentioned a ‘test signal’, do you have anything in mind?

Progress so far:

Using communist’s suggestion (and examining DirectShowSource) I have confirmed that the stream is not being de-interlaced by the xdiv decoder. So the problem is happening further downsteam. I assume by the Video Renderer. This is where my knowledge gets shaky. Is it the Video Renderer that interacts with the NVIDIA drivers to generate the TV-OUT signal. If this is the case, then this points the finger at NVIDIA. I believe that either these drivers are trying to de-interlace the stream OR the data remains interlaced, but is scaled by a routine that does not understand interlacing.

I have also played around with ffdshow and enabled the de-interlace filters. Unfortunately these are not very well documented and I have yet to find a filter/setting combination that is free of artefacts and frame losses. I am not discounting the de-interlace option as at least it would be a solution – but I will not put up with strange or jerky motion or AV sync problems.

Any further suggestions and pointers will be gratefully received.

cmw
25th February 2008, 02:10
When I orginally read your post I came to the believe that you wanted to convert your DVD collection to files to play Juke-Box like, and that you want to encode all these files interlaced. Obviously, I was mistaken there.

I can see why you wouldn't want already interlaced content de-interlaced, but that should be no problem. It should be simplest to just convert your DVD collection to xvid, without using either "interlaced encoding" nor deinterlacing. If you Source is interlaced, it should stay that way without de-interlacing and if it's progressive already, it will turn out progressive (there would be no sense in interlacing it). I am also very sure that most retail DVD's are progressive and not interlaced, this of course is not the case if you recorded TV-Shows without de-interlacing them and burnt them to DVD.

As for the de-interlacing with the video renderer: I do not own a nVidia card, but in the driver settings of my ATI card, i can disable video postprocessing/deinterlacing done by the driver with one mouseclick, I assume the nVidia driver should offer a similar option.

Best regards.

Lenny_Nero
25th February 2008, 04:00
mbrickman, in your first post you give the info of the box you want to use as your HTPC, this is a much more powerful box than the AMD XP2600 (~1900MHz) 2GB radeon 9550 box that I use has, and I know that Vista will sap a large amount of power against the win2000 that I use...but even so I would have thought that saving CPU cycles would be the last thing you need to think about. As for the amount of compression saved, against a well encoded Xvid I would expect the point to be moot, but YMMV.

As for the "you will definitely be seeing motion artefacts" again I still see none even when I just time shift the raw mpeg from the +1 channels that always use interlacing over here, I have also yet to hear anyone else say anything about this either, which I find strange as there are more people that use this for watching my media servers that I do. But as with "My bet is that many people claiming to have no problems in that respect would be surprised when using a suited test signal to actually check what they're really getting from their wonderful TV-out ..." it is something that is very easy to simply just say and quite a bit harder for someone like me to prove without me going to all of the effort to point out the facts, something which I would just not waste any time in doing so ...and rather sit back and server my time better by sifting thru the TB's of data and watching them via my HTPC/media server and feel that my use of such tools as HQV Benchmark and Everest's monitor diagnostics among others have served me very well in the setting up of things.

As for setting up a HTPC just what is the problems that you are facing ? I would be glad to help via here, PM or any other method, as I said (and it seems so does another) that setting up of the TV out via ATI/AMD or nVida drivers needs only a few mouse clicks and a working cable. But if it is only that you cant get the interlacing to look the way you think that I should than I doubt that I can help you.

The only area I can offer no help is Vista, all I see of it is when I am asked to remove it from others computers. Something I do understand about it is that a very large amount of its code is there for no other reason than to stop the showing of quality video streams, I wonder if that is more the area of your problems and something like MythTV or some of the many run-out-of-the-box HTPC setups might suite you better.

Just thinking out loud, but I see no problems when using either of my monitors which are at 120 Hz and 85 Hz, its only the TV's that I run at 60Hz to keep that the same as the manufacturers spec.

Maccara
26th February 2008, 10:55
@mbrickman:

You might want to consider trying an el-cheapo Matrox G400 for your HTPC (you don't need any 3D card for that use anyway). Although, it is an old brand and might have some other issues on newer hw/sw...

From the multitude of vidcards I've owned, that is the _only_ card that has _proper_ interlaced output to CRT. None of the nVidia / ATI cards have done this correctly (and I haven't bothered to try to fix this much, since there is a solution that works out of the box :)).

SeeMoreDigital
26th February 2008, 19:22
The following might be useful....

Software Decoding
As far as I know, only DivX's (and Nero's) software decoder fully supports playback of "pure interlaced" encoded MPEG-4 sources (ie: natively within the decoder). Regardless of what video card you may have installed.

Hardware Decoding
As far as I know, most stand-alone players fully support playback of "pure interlaced" encoded MPEG-4 sources.


Cheers

Inventive Software
26th February 2008, 19:36
I have several Xvid videos that looked absolutely fine on my CRT TV. The method I used was S-Video out from my Geforce FX5200 to my DVD recorder which has S-Video in, and it was connected to my TV via RGB SCART. :)

SeeMoreDigital
26th February 2008, 19:46
I have several Xvid videos that looked absolutely fine on my CRT TV. The method I used was S-Video out from my Geforce FX5200 to my DVD recorder which has S-Video in, and it was connected to my TV via RGB SCART. :)Your Xvid video sources are most probably "not" pure interlaced.

Try confirming by running them thru' MPEG4Modifier or AVInaptic.

EDIT: Here's an pure interlaced MPEG-4 sample (http://www.mediafire.com/?dfwtwugzj2l)

Inventive Software
26th February 2008, 19:57
Most of what I have isn't pure interlaced, but I thought I'd add my playback solution. ;)

I'm quite amazed that DVD recorders and the like can accept a computer's S-Video output and display it without much problem.