Log in

View Full Version : Silent Film


TruthOverFacts
20th April 2022, 07:14
What script would I use to get this to 23.976 and run the correct speed?

https://www.mediafire.com/file/0s5xh43foc9kzps/VTS_01_1.avi/file

johnmeyer
20th April 2022, 09:01
Silent film was almost never shot at 24 fps (which was modified to 23.976 before telecine was applied for NTSC broadcast).
You'll want to use IVTC. Something like:

tfm(display=false)
tdecimate(display=false,mode=0,cycleR=6,cycle=20)

I am not at my main computer, so I didn't have a chance to try those cycle values. You simply separate fields or bob(), count the number of unique frames (where the motion is something other than up/down bobbing), and then simultaneously count the number of duplicate fields, where you get more than two fields in a row where there is no motion other than the bob up/down.

Once you have recovered the original frames, you'll need to time the playback to the correct speed. Old silent film can be pretty slow, sometimes as slow as 12 fps. Use an AssumeFPS(12) at the end of your script to set playback to the correct speed.

TruthOverFacts
22nd April 2022, 10:14
Thanks johnmeyer but AssumeFPS(12) won't work for my situation.

Here is the same clip from another source which is 23.976:

https://www.mediafire.com/file/uoxo0lp2d4ca044/clip23976.avi/file

The first clip I posted is the same film but has footage in different scenes that I plan to combine with this one and they need to match. Hope this makes sense.

hello_hello
22nd April 2022, 14:34
It looks like there's blending in the first sample and some of it's probably there to stay, as it appears to be frame blending rather than field blending, although I'm not certain how it was done

The second sample has a duplicate frame in each cycle of 6. Decimating those results in a frame rate of 20fps.

The following should produce very close to a frame identical output for your samples.
If you remove the two AssumeFPS()s and start off at NTSC frame rates, you'll probably want to specify 20000.0/1001.0 as the output frame rate for TDecimate rather than 20fps.

LWLibavVideoSource("D:\VTS_01_1.mkv")
AssumeFPS(30)
TFM()
TDecimate(Mode=2, Rate=20, m2PA=true)
A = Last

LWLibavVideoSource("D:\clip23976.mkv")
AssumeFPS(24)
TDecimate(Cycle=6)
Trim(2, 0)
B = last

StackVertical(A, B)

Mind you I do wonder if it's running a bit fast. Slowing it down to 16fps seems more natural to me. Obviously you can just add AssumeFPS(16) to the end of the script above if you think 16fps is closer to the original speed.

If you need a 24fps or 23.976fps output for some reason, you can add duplicate frames to the first sample after it's decimated, as decimating to 20fps first seems to remove a lot of the blended frames, and if you decimate first you'll end up with the same 1 in 6 cycle for both videos, so there'd be no need to decimate the second sample.

LWLibavVideoSource("D:\VTS_01_1.mkv")
AssumeFPS(30)
TFM()
TDecimate(Mode=2, Rate=20, m2PA=true)
ChangeFPS(24)
A = Last

LWLibavVideoSource("D:\clip23976.mkv")
AssumeFPS(24)
Trim(2, 0)
B = last

StackVertical(A, B)

Edit: It just occurred to me you could decimate the first sample with Cycle=3 and the result appears to be the same as for Mode=2. If that's the case Cycle=3 should be faster, but maybe try comparing the two.

LWLibavVideoSource("D:\VTS_01_1.mkv")
AssumeFPS(30)
TFM()
TDecimate(Cycle=3)
A = Last

LWLibavVideoSource("D:\clip23976.mkv")
AssumeFPS(24)
TDecimate(Cycle=6)
Trim(2, 0)
B = last

StackVertical(A, B)

johnmeyer
23rd April 2022, 01:23
Thanks johnmeyer but AssumeFPS(12) won't work for my situation.Unless you want the motion to be speeded up, you HAVE to use AssumeFPS() to set the speed.

Then, if you have to match other footage, or you have to match some standard (23.976, 24, 25, 29.97, or 30 fps), you can either repeat fields (for interlaced material) or frames (for progressive material) in order to get the correct number of frames per second. You can also use motion estimation to add frames so that the motion is the correct speed when played at your final rate.

It would be a major, and very amateurish, mistake to have the motion at any other than the correct speed.

TruthOverFacts
23rd April 2022, 02:45
LWLibavVideoSource("D:\VTS_01_1.mkv")
AssumeFPS(30)
TFM()
TDecimate(Mode=2, Rate=20, m2PA=true)
ChangeFPS(24)
A = Last

LWLibavVideoSource("D:\clip23976.mkv")
AssumeFPS(24)
Trim(2, 0)
B = last

StackVertical(A, B)

Edit: It just occurred to me you could decimate the first sample with Cycle=3 and the result appears to be the same as for Mode=2. If that's the case Cycle=3 should be faster, but maybe try comparing the two.

LWLibavVideoSource("D:\VTS_01_1.mkv")
AssumeFPS(30)
TFM()
TDecimate(Cycle=3)
A = Last

LWLibavVideoSource("D:\clip23976.mkv")
AssumeFPS(24)
TDecimate(Cycle=6)
Trim(2, 0)
B = last

StackVertical(A, B)

Thanks hello_hello, this seems to work!

A few questions...the original source file is an MPEG2 which is TFF so do I need to add AssumeTFF()?

Also, instead of AssumeFPS(24) can I use AssumeFPS(23.976)?

Thanks again!

hello_hello
23rd April 2022, 05:55
Thanks hello_hello, this seems to work!

A few questions...the original source file is an MPEG2 which is TFF so do I need to add AssumeTFF()?

If you're indexing with DGIndex, it should report the correct field order to Avisynth and TFM will use that order as it's default: TFM(Order=-1).
Normally you don't have to change it, but TFM(Order=0) forces TFM to expect BFF, while for TFF it's TFM(Order=1). AssumeTFF() shouldn't be necessary. It's normally only needed if the field order isn't being reported to Avisynth and Avisynth is making an incorrect assumption.

Also, instead of AssumeFPS(24) can I use AssumeFPS(23.976)?

Yes, but if 23.976fps is the original frame rate it won't be necessary, unless the two samples result in slightly different frame rates, in which case AssumeFPS will ensure they match. It's technically more accurate to use AssumeFPS(24000,1001) though as 23.976 is more of an approximation, but the difference is very small.
24000/1001 = 23.976023976023976023976023976024
Likewise 3000/1001 is slightly more accurate than 29.97fps.

I thought AssumeFPS(30) for the first sample and AssumeFPS(24) for the second might be preferable because the decimation will result in 20fps rather than 20000/1001 (19.98fps). If there is audio involved though, AssumeFPS(24) will effect the A/V sync and you'd have re-encode the audio to change it's speed to match. Starting from 29.97fps and 23.976fps and decimating to 19.98fps won't effect the A/V sync.

Did you try slowing it down to 16fps after decimation? (16fps was just my guess, so use whatever frame rate you think looks most natural) If you do that it'll obviously change any A/V sync anyway, so starting from either 30/24fps or 29.97/23.976fps won't make a difference. I assume there's no audio to worry about though?

TruthOverFacts
25th April 2022, 01:50
ok I reread my question and I made a mistake I was referring to the script

LWLibavVideoSource("D:\VTS_01_1.mkv")
AssumeFPS(30)
TFM()
TDecimate(Mode=2, Rate=20, m2PA=true)
ChangeFPS(24)

from what I gathered the first
AssumeFPS(30) could also be AssumeFPS(29.97)

and the last line could be
ChangeFPS(24) or ChangeFPS(23.976)

I wanted the end result of interlaced clip to be 23.976 to match other clip so I can edit them together into a composite. You are correct there is NO audio at this stage as this is a silent film :)

I ran the clip on the entire film and I still see remaining interlacing in some frames is there anyway to fix this? is the TFM not catching all the field matching?

thanks

hello_hello
25th April 2022, 03:47
I wanted the end result of interlaced clip to be 23.976 to match other clip so I can edit them together into a composite.

I'd still decimate them both to 20fps/19.98fps and possibly slow them down from there. Obviously you'll have to re-encode both videos but it's probably the easiest way to splice one video into another, as long as you ensure the frame rates and resolutions match. Unless you actually need 23.976fps for some reason, or you have a way of splicing them without re-encoding both?

This sort of thing.

A = LWLibavVideoSource("D:\VTS_01_1.mkv")
B = LWLibavVideoSource("D:\clip23976.mkv")

C = A.TFM().TDecimate(Cycle=3)\
.SomeFilter()\
.SomeFilter()\
.AssumeFPS(16)

D = B.TDecimate(Cycle=6)\
.SomeFilter()\
.AssumeFPS(16)

D.Trim(0, 1457) + \
C.Trim(594, 863) + \
D.Trim(1458, 0)

ChangeFPS(24000,1001) # You can still duplicate frames afterwards for 23.976 if need be

I ran the clip on the entire film and I still see remaining interlacing in some frames is there anyway to fix this? is the TFM not catching all the field matching?

I assume you're referring to left over combing?
I'm still not sure how that video was created but the only frames that seem to have combing are the blended ones, which might make the combing harder to detect. It's not unusual for field matching to result in some combed frames. It's probably not that TFM isn't finding the best matches, but rather it's because there's not always a perfect match, and any residual combing needs to be de-interlaced to repair it.

It's possible TFM isn't detecting all the combing though. Try TFM(Mode=1).
It's an alternative metric for detecting combing that sometimes works better.

Here's a trick for determining what's being detected as combed and deinterlaced. Try not to get too carried away with increasing the combing detection because ideally you only want to deinterlace the parts of the image that require it. Check the TFM help file too as it has lots of options, but below are the main arguments you'd probably want to play with.

Instead of TFM taking pixels from an externally de-interlaced clip to repair combing as the clip2 argument is intended for, it's taking them from a red frame so you can see what it's detecting as combed. Once you happy you can remove the clip2 argument and let TFM do the deinterlacing.

Vid = LWLibavVideoSource("D:\VTS_01_1.mkv")
Red = BlankClip(Vid, color=color_red)
Vid.TFM(pp=5, metric=1, slow=2, cthresh=9, MI=80, clip2=Red)

If you don't have any luck, try posting another sample from a problem section.

https://i.ibb.co/tYR7Qgt/red.jpg

hello_hello
25th April 2022, 05:46
After playing around a bit trying to fix combing I thought I'd contradict what I said before, disable TFM's de-interlacing and use QTGMC to de-interlace the entire picture, followed by some de-flickering I didn't try to refine beyond the defaults.

I also played around with different frame rates, and while I'm not sure even 12fps is too slow, I compromised at 15fps.
While I was at it I doubled the frame rate for a 29.97fps version with FrameRateConverter, although I'm not sure I like it as it no longer has the same "low frame rate", "silent film" look. You could use ChangeFPS(3000, 1001) to simply repeat every frame instead.

Just an idea. It's all very subjective.

14.985 fps.mkv (https://files.videohelp.com/u/210984/14.985%20fps.mkv) (8.6 MB)
29.97 fps.mkv (https://files.videohelp.com/u/210984/29.97%20fps.mkv) (7.6 MB)

TFM(pp=1)
TDecimate(cycle=3)
QTGMC(FPSDivisor=2, SourceMatch=2, Lossless=2, TR2=2)
Deflicker()
AssumeFPS(15000, 1001)
FrameRateConverter(FrameDouble=true) # for 29.97fps
CropResize(640,480, 48,20,-44,-28, InDAR=15.0/11.0)

TruthOverFacts
25th April 2022, 06:59
wow that looks really good no left over combing :)

I don't have Deflicker() I will need to download that one

as for the 19.98 or 20fps both sources are running at this frame rate correct?

I am using their frame rate as the "correct speed"

so once interlaced clip is decimated I will get 19.98fps correct? and then I can
ChangeFPS(23.976) ? or ChangeFPS(24000, 1001)

and essentially have 19.98 at 23.976?

thanks

hello_hello
25th April 2022, 09:36
It's possible that as well as having duplicate frames added for an NTSC frame rate, it was also sped up from the original speed to make it look smoother. I've no idea what that movie is, so maybe ask google to see if you can find out what the original frame rate was. According to Wikipedia the frame rate for silent films was generally between 20 and 26 fps by the 1920's, so it could be correct. It just looks a bit fast to me.
https://en.wikipedia.org/wiki/Frame_rate#Silent_films

so once interlaced clip is decimated I will get 19.98fps correct? and then I can
ChangeFPS(23.976) ? or ChangeFPS(24000, 1001)

and essentially have 19.98 at 23.976?

Yes. That's what your second sample is already if you don't decimate it.

Having another look at the encodes I uploaded, I'm wondering if QTGMC made it look a bit "washy", for want of a better description. QTGMC has settings for denoising and/or restoring noise that might improve it, but a compromise might be to make sure TFM sees all the combing by adjusting it's detection and then repairs it by taking the pixels from QTGMC, so the picture will only be de-interlaced by QTGMC where combing is detected and the rest will be left as-is. It's all personal taste, and I'm really indecisive, but here's something else to try. As you can see, more of the noise is left intact rather than QTGMC making it "mushy". Hopefully it's repairing all the combing. I haven't had a thorough look, but this is the idea,

19.98 fps.mkv (https://files.videohelp.com/u/210984/19.98%20fps.mkv) (10 MB)

Vid = LWLibavVideoSource("D:\VTS_01_1.mkv")

DeintClip = Vid.QTGMC(FPSDivisor=2, SourceMatch=2, Lossless=2, TR2=2)
Vid.TFM(metric=1, slow=2, cthresh=4, MI=60, clip2=DeintClip)
TDecimate(cycle=3)
Deflicker()
CropResize(640,480, 48,20,-44,-28, InDAR=15.0/11.0)

TruthOverFacts
27th April 2022, 05:06
ok so I have had some time to compare some scenes from the 23.976p film source to the interlaced source after running the following script

AVISource("f:\interlacedsource.avi")
AssumeFPS(30)
TFM(pp=1)
TDecimate(cycle=3)
QTGMC(FPSDivisor=2, SourceMatch=2, Lossless=2, TR2=2)
Deflicker()
ChangeFPS(24000, 1001)

after comparing a few scenes it seems the script accurately brings the interlaced source to 19.98 and matches the film source...the film source is NOT exactly the same as the interlaced source as it seems splices were deleted to make film look cleaner between scene cuts as you will also see in clips below. This is NOT an issue for me. Like I had mentioned I am using the two sources to make a composite as the interlaced source has more footage then the film source. I am doing the composite on a 23.976p timeline of my editing software.

but...I did notice left over interlacing or missed field matching? as you can see in the clip below as the guy is walking to the door right before he gets to the door there are 2 or 3 frames were you can see missed field matching?? right before it goes to next scene

here are the 3 clips to examine

Original 29.97 interlaced clip
https://www.mediafire.com/file/7n96t115qyhkv7l/original2997.avi/file

clip after I ran script on above clip
https://www.mediafire.com/file/d4t9qf9lcdhgi27/script.avi/file

clip I am using for guide track
https://www.mediafire.com/file/dxyypucha99z3c1/originalfilm23976.avi/file

many thanks

hello_hello
29th April 2022, 13:19
I wonder if it's a field order problem.

I had to use AssumeTFF() on your sample because without it Avisynth was assuming BFF and with just TFM in the script I was seeing this (I was indexing your sample with FFMS2):
TFM(pp=1)

https://i.ibb.co/k1mLrtg/A.jpg

TDecimate(cycle=3) just removes one frame from each group of three starting from the first frame, so it might work out that the group of three the combed frame belongs to contains a duplicate, so the combed frame is being kept, which QTGMC then de-interlaces, and you end up with a blurry looking frame.

When I add AssumeTFF() the field matching changes and that combed frame has a better match.
AssumeTFF()
TFM(pp=1)

Without AssumeTFF(), telling TFM it's TFF seems to produce the same result.
TFM(pp=1, Order=1)

So maybe use Info() to check whether Avisynth thinks it's TFF or BFF and correct it if need be. If it's a DVD and you're indexing with DGIndex it should be correct, but maybe for some reason I led you astray by saying you shouldn't need to add AssumeTFF().

https://i.ibb.co/LtMD1X8/B.jpg