Log in

View Full Version : Some kind of puzzle with DV deinterlacing


TVT
3rd September 2007, 08:46
Hi, Guys!

I've got MiniDV camera JVC GR-D290E.

I'm using WinDV to capture video from the camera. I've also got Cedocida DV codec installed.

I'm trying to encode captured video with AviSynth+XviD+VirtualDub.

The encoded video has one very unpleasant effect -- jumping object edges. As far as I understand it is produced by incorrect deinterlacing.

Source sample is here: file-dv.avi (~15MB) (http://depositfiles.com/files/1660638). It has FourCC dvsd, size 720 x 576 (5:4) and FPS 25Hz.

My AVS script

LoadPlugin("xxx\AviSynth 2.5\plugins\Decomb.dll")

AVISource("file-dv.avi")

AssumeBFF().Telecide(guide=2)

produces this output: file-bff.avi 696KB (http://depositfiles.com/files/1660681).

I tried to reverce field order

LoadPlugin("xxx\AviSynth 2.5\plugins\Decomb.dll")

AVISource("file-dv.avi")

AssumeTFF().Telecide(guide=2)

but results in output with identical effect: file-tff.avi 696KB (http://depositfiles.com/files/1660699)

Meanwhile Microsoft Media Player playing the source gives excellent playback with smooth object edges moving, ~25FPS and even exact 4:3 ratio.

Any suggestion, Guys? I badly need your assistance.

Boulder
3rd September 2007, 10:25
Telecide(guide=2) does not reverse the field order but tries to do field matching in which it most likely fails because you have a pure interlaced source.

For deinterlacing, you might want to try YADIF. Use the search to find the thread where it is discussed.

TVT
3rd September 2007, 20:07
Telecide(guide=2) does not reverse the field order but tries to do field matching in which it most likely fails because you have a pure interlaced source.

For deinterlacing, you might want to try YADIF. Use the search to find the thread where it is discussed.

As far as I figured out the DV has bottom field order so Telecide has information about it and I even let it know about it with AssumeBFF(). Moreover I also tried to reverse field order manually with SwapFields().

I also investigated the video using SeparateFields+SelectEvery+Weave and could not find any combination that can be deinterlaced correctly (to my mind). Correct smooth output is produced only if I use AssumeBFF().SeparateFields() but then FPS becomes 50 and ChangeFPS/ConvertFPS won't help. So I can conclude that the task is more complex that I thought before.

I tried YADIF but the result was the same. Now I don't think this video can be deinterlaced by only using a deinterlacer. It needs some kind of advanced handling before.

More variants, profies?

Guest
3rd September 2007, 20:31
The cip is progressive and is already field matched, so you don't need Telecide. It is not combed, so you also don't need a deinterlacer. The edge business is a DCT noise artifact. Here is a closeup:

http://neuron2.net/misc/edges.png

Did you set your camera to progressive mode or was this deinterlaced and re-encoded?

Boulder
3rd September 2007, 21:00
The cip is progressive and is already field matched, so you don't need Telecide. It is not combed, so you also don't need a deinterlacer. The edge business is a DCT noise artifact.

Did you set your camera to progressive mode or was this deinterlaced and re-encoded?Ha, I kind of expected that the source is interlaced as it's DV. My bad:)

TVT
3rd September 2007, 22:25
The cip is progressive and is already field matched, so you don't need Telecide. It is not combed, so you also don't need a deinterlacer. The edge business is a DCT noise artifact. Here is a closeup:

http://neuron2.net/misc/edges.png

Did you set your camera to progressive mode or was this deinterlaced and re-encoded?

My camera is a cheap one so it's only interlaced mode.

I supply source partial snapshot and 2 AVS scripts with their snapshots.

First (the source):

http://www.imagehosting.com/out.php/i1098101_filedv65crop3.gif

Second (without postprocessing):

LoadPlugin("xxx\AviSynth 2.5\plugins\Decomb.dll")

AVISource("file-dv.avi")

AssumeBFF().Telecide(guide=2, post=0)

http://www.imagehosting.com/out.php/i1098121_filebff065crop3.gif

Third (with default postprocessing):

LoadPlugin("xxx\AviSynth 2.5\plugins\Decomb.dll")

AVISource("file-dv.avi")

AssumeBFF().Telecide(guide=2)

http://www.imagehosting.com/out.php/i1098137_filebff65crop3.gif

In the last case deinterlacing seems to be satisfactory but if you watch file-dv.avi (http://depositfiles.com/files/1660638) and file-bff.avi (http://depositfiles.com/files/1660681) (look above) with Microsoft Media Player (or with GraphEdit) you can conclude that deinterlacing match made by AviSynth+Telecide is not correct.

So what would you tell, Guys?

Guest
4th September 2007, 01:53
The stream you posted is progressive and you claim the camera is shooting interlaced.

Therefore, please post an *unprocessed* source clip. We can't do anything with your processing screenshots.

Guest
4th September 2007, 13:46
TVT has sent me the source stream in PM. It is in fact interlaced TFF.

TVT, you cannot use Telecide() on an interlaced stream! Telecide() is a field matcher for progressive streams.

All you can do is try various deinterlacers and choose the one you prefer.

TVT
4th September 2007, 20:20
TVT has sent me the source stream in PM. It is in fact interlaced TFF.

Well, if I correctly understand results of AssumeBFF().SeparateFields()/AssumeTFF().SeparateFields() tests the stream seems to be BFF-interlaced. As far as I know most of MiniDV cameras give BFF-interlaced streams.

All you can do is try various deinterlacers and choose the one you prefer.

Oh! I tried most of them and continue doing my best trying them with different parameters. Nothing improves. :( Results are almost equal.

I'm starting to think that only deinterlacer is not enough ...

Boulder
5th September 2007, 03:33
One reason for the problem might be the limitations of the YV12 colorspace - and unfortunately there's pretty much no way around it. The red colors seem to bleed quite bad.

Guest
5th September 2007, 03:37
Well, if I correctly understand results of AssumeBFF().SeparateFields()/AssumeTFF().SeparateFields() tests the stream seems to be BFF-interlaced. You're right. I typed it from my (bad) memory. The same conclusion applies.

Blue_MiSfit
7th September 2007, 20:06
Give a really hardcore bobber like MCBob a try. It will be slow as molasses, but it should give you as much quality as avisynth can juice out of it (for now).

Remember though that a bobber will return double frame rate (50p in your case). So you will probably want to SelectEven() or SelectOdd() after MCBob(), so that you will get 25p back. You will of course lose half the motion :(

~MiSfit

TVT
8th September 2007, 14:15
Give a really hardcore bobber like MCBob a try. It will be slow as molasses, but it should give you as much quality as avisynth can juice out of it (for now).


Yeah, I tryed several BOB filters but ...

Remember though that a bobber will return double frame rate (50p in your case). So you will probably want to SelectEven() or SelectOdd() after MCBob(), so that you will get 25p back. You will of course lose half the motion :(

... there's one disadvantage -- they all produce 50fps output. I need 25fps. When I use SelectEven() or SelectOdd() rate becaumes 25fps but the result is much like TDecimate() does.

Meanwhile Microsoft's Video Renderer playbacks excellent video with smooth motion. Look at this shot:

http://img175.imageshack.us/img175/1964/graphedit2lq6.png

"Avarage frame rate" is ~25. How does the renderer achieves that? Or it's just a lier?

A one more notice. Why does the renderer show 111 frames count if the source stream containrs 112?

zambelli
10th September 2007, 03:45
Bobbing with SelectEven() produces identical results to deinterlacing to the same framerate directly.

When you render DV video in DirectShow with VMR7, deinterlacing is performed to the same framerate. If you switch to VMR9, you'll probably see the framerate double (via bobbing).

2Bdecided
11th September 2007, 13:15
I'm starting to think that only deinterlacer is not enough ...What you're trying to do is really easy. When you figure out what you're doing wrong, I'm fairly sure any half-decent method of deinterlacing will be more than good enough.

So don't waste your time trying exoctic slow deinterlacers - I'm fairly sure this is not the problem, and won't solve it!

Now, what is it you are trying to do? Why do you want to deinterlace this? What are you going to do with it next?

If you do just...
AVISource("file-dv.avi")

AssumeBFF()

bob()
...and then watch the result (e.g. drop that script into virtualdub) what do you see?

Cheers,
David.

TVT
11th September 2007, 20:28
Hi!


If you do just...
AVISource("file-dv.avi")

AssumeBFF()

bob()
...and then watch the result (e.g. drop that script into virtualdub) what do you see?


Thanks a lot. I can see excellent picture with smooth motion. But it has rate 50fps. My home DVD does not support that rate. It just divudes it by 2 and motions become twice slower. But when I apply SelectOdd/Even the motion get some kind of slight strobing. It has very unnatural look.

What I can say more? I'm starting to think that there is some kind of mislead that PAL DV stream has 25fps rate and is field-based. TFF and BFF concepts do not have their original sense because I cannot combine appropriate top and bottom field pair to reproduce correct frame. Am I wrong?

I'd like to get acquainted better with the specification or description of DV Sony Digital stream format. Could you direct me to appropriate source?

Boulder
11th September 2007, 21:12
To me it sounds like you don't completely understand what interlacing means. As your source is truly interlaced, you cannot combine bottom and top field and expect to get a perfect frame. Both the bottom and top field represent a different moment in time whereas progressive material would show almost if not completely identical fields for every frame.

zambelli
11th September 2007, 23:14
What I can say more? I'm starting to think that there is some kind of mislead that PAL DV stream has 25fps rate and is field-based.
Are you trying to say PAL DV is a myth? :)

Jay Bee
12th September 2007, 05:42
But it has rate 50fps. My home DVD does not support that rate.

That's why you don't deinterlace for DVD. Just encode as interlaced and you will get perfect results on both DVD players and PCs.

2Bdecided
12th September 2007, 10:44
That's where I was heading Jay Bee.

Is there something misleading on doom9 somewhere that actually tells people to deinterlace home movies to put them onto DVD?!

Cheers,
David.

halsboss
12th September 2007, 12:16
I do DV from a PAL Canon MV920 to DVD... incoming is normal PAL BFF interlaced captured with WinDV ... converts nicely and easily to BFF interlaced DVD mpeg2 using HC.

If I want to motion stabilise it, I take a deep breath and go here http://forum.doom9.org/showthread.php?t=129781

TVT
13th September 2007, 20:08
Is there something misleading on doom9 somewhere that actually tells people to deinterlace home movies to put them onto DVD?!

If you read heading post you might notice that I wasn't intended to encode to DVD MPEG-2 but to XviD which does not support interlaced streams as commonly known. This is my first time to encode the DV stream so it may be expected to run into certain troubles. Before that I just ripped DVD's and TV-tuner captured video. Sorry for my incompetence.

2Bdecided
14th September 2007, 11:00
Sorry TVT - my mistake - I didn't read your first post well enough.

I'll leave it to people more familiar with XviD.

Cheers,
David.

Jay Bee
15th September 2007, 05:40
Your source is interlaced. If you don't want to destroy the resolution you need to either keep it interlaced or use a 50fps deinterlacer. MPEG-2 is fine with interlaced. Xvid doesn't work well with interlaced as most decoders don't know how to deal with it. AVC should work reasonably well with interlaced as it's an industry standard and the industry cares more about interlacing than the open source/doom9 community.

communist
15th September 2007, 12:30
If you read heading post you might notice that I wasn't intended to encode to DVD MPEG-2 but to XviD which does not support interlaced streams as commonly known.
XviD does support interlaced encoding. Decoding wise it seems to blend or weave, it doesnt look as smooth as DV when played in MPC. You can use ffdshow and apply bob deinterlacing to pretty much get the same result.
The interlaced structure is preserved, just open it in VirtualDub and you'll see.

bb
15th September 2007, 18:39
Earlier XviD versions did not have an "interlaced encoding" option; as far as I know DivX was the first MPEG-4 ASP codec which introduced this feature. But nowadays XviD supports interlaced encoding as well.

To find the option in XviD 1.1.3, you click on the "more" button next to the "Profile & Level" settings in the configuration dialog. On the "Profile" tab there is a checkbox labeled "Interlaced Encoding", and next to that you can select whether your source video is "Top field first" or not.

bb

TVT
18th September 2007, 17:44
Hi!

Al last I refrained from converting my DV stream to XviD. If I correctly understand MPEG2/DV rendering technology it's not possible (so far). Using your advice and without any difficulty I converted my DV stream into BFF interlaced MPEG2. It's played back absolutely correctly on my home DVD player. Not very satisfactory but quite acceptable. Thank you all.

zambelli
19th September 2007, 04:42
Decoders really shouldn't be doing their own deinterlacing these days anyway - they should just use VideoInfoHeader2 instead to signal interlaced video to the renderer and let the video card handle deinterlacing.

TVT
19th September 2007, 08:03
Decoders really shouldn't be doing their own deinterlacing these days anyway - they should just use VideoInfoHeader2 instead to signal interlaced video to the renderer and let the video card handle deinterlacing.

I see. But that approach narrows your choice of en/decoders because some of them don't "appeal" to video card's deinterlacing capabilities.

zambelli
21st September 2007, 10:21
I see. But that approach narrows your choice of en/decoders because some of them don't "appeal" to video card's deinterlacing capabilities.
You can use hardware deinterlaced independent of DXVA decoding. It's not restricted to only certain codecs.