This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Filter to align lines of jittering VHS originating content

Tags: None
(comma "," separated)
hanshansh
Registered Member
Posts
6
Karma
0
Hello everybody,

I want to digitize all the old home videos from VHS. The last VHS recorder I own has the ability of copiing from VHS to DVD and since it's the last, I decided it's time to copy everything.
Unfortunatly I had to realize that the resulting MPEG2 stream isn't nearly as nice as I hoped. It seems aside from bad color transistions the main reason is that all the lines start with different horizontal offsets.

The offsets are depending on two things:
- When the content is darker its starting more left, lighter parts are starting righter
- The videos are interlaced PAL; between even and odd lines a noticeable offset of 2 or 3 pixels exists

Since the problem can be described pretty easily, I decided to write a filter bringing the lines into sync.
My first approach was to write a frei0r plugin, which is (well) documented. I soon noticed that frei0r doesn't give me any information if the material is interlaced or not. I didn't find the word interlaced in the whole documentation, so I thought maybe frei0r is designed to work on progressive content only.
In this case, I think, Kdenlive will deinterlace befor the filter is used, so the bad, non matching, lines are already mixed up when the filter gets the data.

So I decided to directly write a filter for melt. Soon I realized that there is no documentation at all, or I just cannot find it.

Maybe anybody already had the same problem and could solve it.
Please comment if my assumptions on deinterlacing are correct and if I it would be easier to use frei0r or melt directly for my filter. And maybe you can give me a hook on creating it.

After all these points, can anybod tell me if Kdenlive correctly handles PAL interlacing since I think NTSC has exactly the opposit splitting in half frames.

Many thanks,
Florian
Granjow
Moderator
Posts
247
Karma
0
I guess you are right about frei0r only working on progressive input and the deinterlacing happening before.
Isn't MLT documented quite well? Otherwise you should ask on the mailing list there.

Simon
hanshansh
Registered Member
Posts
6
Karma
0
It seemed too easy writing a frei0r plugin. How can I check that all data is deinterlaced before frei0r processing?
There is a mlt documentation describing processing and framework in general, but I didn't find anything on writing filters.
I had a look at the source code but I would have to study it all to understand what I have to do to implement an own filter. I also searched in modules/frei0r/ to see if all frei0r data gets deinterlaced first, but couldn't find it.

I will try to ask my questions to the mlt team.

Thank you Simon,
Florian
ddennedy
Registered Member
Posts
1315
Karma
1
Regarding deinterlacing and frei0r. You are correct that the frei0r plugin does not know the scan mode of its input nor does it necessarily assume progressive. Basically, for MLT as a frei0r host, the rules goes like this: if the profile or consumer indicates it needs progressive and the input is not progress, then it will be deinterlaced prior to frei0r. Same goes for "ordinary" melt filters; however, a filter could check some frame properties to learn that. I put ordinary in quotations because there are "normalizing" filters that are automatically included that take care of things like this. Also note that a consumer in MLT does not necessarily mean the _end_ consumer. For example, for an interlaced output, the composite transition's geometry could affect the vertical resolution of its overlay input. If so, then it will indicate it needs progressive because otherwise fields would be mixing and produce bad results.

With that said, for personal use, you could make it a frei0r plugin if you plan to use interlaced output and keep your projects simple (no fancy affine transformations or compositing stuff).

To write a MLT filter, simply base it on one of the simpler ones from the source code.


hanshansh
Registered Member
Posts
6
Karma
0
So deinterlacing always happens prior to all filtering if anything in the chain of processing wants progressive, or is it applied just before the first progressive-only action?

A side question on interlaced videos:
Are these (1) 25 pictures per second split in half-frames or (2) 50 pictures per second of half size?
Or are both ways possible?
If it would be (1), fancy yadif shouldn't be necessary (I think Kdenlive uses it always). If it is (2) creating interlaced material with intermediate progressive steps (compositing) would result in style (1) results when they should be (2).

When using frei0r approach, I could first correct with my filter interlaced. And in a second phase do compositing. I guess I have to render in between and cannot just import the project, which makes it not my favorite.
When interlaced content is provided to frei0r, does it get the half-frames as two frames of half height or one frame with all the information in it?

I think there might me some other melt users out there who have similar problems. I can see them on all VHS output, it's normally not so bad as on the videos I recorded with the old Hi8 camera. So I would take the challenge of writing a melt filter.
Dan, can you tell me one of the easier ones to start with. For me they are all not looking easy.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], lockheed, Sogou [Bot]