Dwedit
8th October 2020, 08:16
This is an idea I have about how to fix vertically scrolling credits.
This is for cases where a DVD was encoded as 29.97FPS, and has 3:2 pulldown. Video is normally 24FPS, but there are 60FPS scrolling overlays.
Normally, when you encode them, you see horrible weave artifacts.
Field 2+3 Weaved - This is usually what you see after a Telecine filter has finished.
https://i.imgur.com/vcTggZu.jpg
This is an alternative approach where you reconstruct the Credits layer.
First, you need to see how fast the credits layer is moving. For this step, only consider the same kind of field (even/odd), and look for an identical image for the credits layer.
In this case, we find that the credits layer has moved 6 pixels upward after 4 fields have passed.
Field 2 by itself:
https://i.imgur.com/WkGPUPL.jpg
Field 6 by itself:
https://i.imgur.com/n62PmGH.jpg
Take difference between the frames, move it up and down to see when the text becomes darkest (smallest difference), and we find that it has moved 6 pixels after 4 fields.
https://i.imgur.com/ihNo1Ub.jpg
Given that Field 2, 6, 10, 14... has half of the original scanlines, and it is moving at a constant speed, that means that Fields 4, 8, 12, 16... will have the other half of the scanlines.
So if we weave Field 2+4 (Move field 4 downward by 3 pixels), we get this:
https://i.imgur.com/2d0XtEB.jpg
Text now looks perfect, but the picture behind the text looks awful.
So here's a quick and dirty solution, make a simple mask around the text.
Take the difference between Field 2 and 4, you get this:
https://i.imgur.com/pJ58CQ2.png
Go to Gimp, Dilate 6 times, Erode 4 times, here's a mask:
https://i.imgur.com/mypdhmY.png
Now put the Clean Text over the original frame, and we get this:
https://i.imgur.com/zdsw4qm.jpg
Not perfect, as there are combing artifacts around the text, but it looks much much better than what you'd get by other means.
Now I'm wondering if anyone has ever made a script or plugin before that would do something like this, then how would I go about making a script or plugin to do this?
The critical steps:
* Identify that a scrolling layer exists
- - This can be seen when looking at the fields. Normally there's a period where 3 fields are repeated, then 2 fields are repeated. So look for the motion in the fields that are supposed to match.
* Identify the speed of the scrolling layer
- - In this example, it was 6 pixels over 4 fields.
* Take the missing scanlines from another field that has the other half.
- - Does not necessarily need to be the same even/odd as the first field.
* Make a mask for the text
- - Right now, I'm just comparing two frames to see what moves, then making a crude mask from there
* Paste the restored text over a detelecined frame.
This is for cases where a DVD was encoded as 29.97FPS, and has 3:2 pulldown. Video is normally 24FPS, but there are 60FPS scrolling overlays.
Normally, when you encode them, you see horrible weave artifacts.
Field 2+3 Weaved - This is usually what you see after a Telecine filter has finished.
https://i.imgur.com/vcTggZu.jpg
This is an alternative approach where you reconstruct the Credits layer.
First, you need to see how fast the credits layer is moving. For this step, only consider the same kind of field (even/odd), and look for an identical image for the credits layer.
In this case, we find that the credits layer has moved 6 pixels upward after 4 fields have passed.
Field 2 by itself:
https://i.imgur.com/WkGPUPL.jpg
Field 6 by itself:
https://i.imgur.com/n62PmGH.jpg
Take difference between the frames, move it up and down to see when the text becomes darkest (smallest difference), and we find that it has moved 6 pixels after 4 fields.
https://i.imgur.com/ihNo1Ub.jpg
Given that Field 2, 6, 10, 14... has half of the original scanlines, and it is moving at a constant speed, that means that Fields 4, 8, 12, 16... will have the other half of the scanlines.
So if we weave Field 2+4 (Move field 4 downward by 3 pixels), we get this:
https://i.imgur.com/2d0XtEB.jpg
Text now looks perfect, but the picture behind the text looks awful.
So here's a quick and dirty solution, make a simple mask around the text.
Take the difference between Field 2 and 4, you get this:
https://i.imgur.com/pJ58CQ2.png
Go to Gimp, Dilate 6 times, Erode 4 times, here's a mask:
https://i.imgur.com/mypdhmY.png
Now put the Clean Text over the original frame, and we get this:
https://i.imgur.com/zdsw4qm.jpg
Not perfect, as there are combing artifacts around the text, but it looks much much better than what you'd get by other means.
Now I'm wondering if anyone has ever made a script or plugin before that would do something like this, then how would I go about making a script or plugin to do this?
The critical steps:
* Identify that a scrolling layer exists
- - This can be seen when looking at the fields. Normally there's a period where 3 fields are repeated, then 2 fields are repeated. So look for the motion in the fields that are supposed to match.
* Identify the speed of the scrolling layer
- - In this example, it was 6 pixels over 4 fields.
* Take the missing scanlines from another field that has the other half.
- - Does not necessarily need to be the same even/odd as the first field.
* Make a mask for the text
- - Right now, I'm just comparing two frames to see what moves, then making a crude mask from there
* Paste the restored text over a detelecined frame.