Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th February 2020, 13:00   #1  |  Link
nfv
Registered User
 
Join Date: Aug 2007
Posts: 44
Silent Film (Framerate Question) Help

https://www.mediafire.com/file/kkyx3...ilent.avi/file

I noticed this has an odd cadence. What is the proper way to make it progressive but at the right speed? Also, is there a way to determine what the framerate should be? So many questions and variables...

I have seen many DVD's and BluRay's of silent films that are 23.976 and are the correct speed. The above sample seems to be a common cadence for the interlaced films to bring them to the correct speed I'm guessing?

Any help would be much appreciated.
nfv is offline   Reply With Quote
Old 19th February 2020, 16:38   #2  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Try something like
Code:
TFM(mode=1,pp=1).fdecimate(rate=18.0,threshold=10)
Sharc is offline   Reply With Quote
Old 19th February 2020, 17:36   #3  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
The weird cadence is probably from the edits

It's closer to about 21.72 . 18 will drop too many good frames . fdecimate is tricky, in that you have to go linearly way back or it will mix up frames

The other option to assuming a single constant framerate is to use VFR such as dedup or related methods
poisondeathray is offline   Reply With Quote
Old 19th February 2020, 20:15   #4  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
or perhaps this:
Code:
TFM().tdecimate(cycle=32,cycleR=9)
Yields 21.54fps. Not perfect, but yields CFR with most frames kept.
Sharc is offline   Reply With Quote
Old 20th February 2020, 02:13   #5  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
If the cadence is a little strange, and doesn't repeat, you have to do something like what Sharc posted, where you set a really high cycle size so that Tdecimate can analyze huge chunks at once. This cuts way down on deleting good frames or preserving dups that should be decimated when you have a pattern which doesn't repeat often, if at all.

So, I did the same thing as Sharc, but used an even longer cycle. I came up with the following values, after walking through a very large number of fields (you should always do your analysis by first doing a separatefields() operation and then walking through a large number of fields). I stepped through 128 fields and got 47 unique images (i.e., where the motion moved horizontally). This means that I should have 94 (2 * 47) pairs of fields instead of 128. Subtracting 94 from 128 yields 34. Thus, if I use a Cycle of 128 and a CycleR of 34, I should get really good decimation, even if the pattern varies. I used the following script and seemed to get perfect results. Of course there is no guarantee it will do the entire movie without any errors, but it should get pretty darned close.

Note that I end the script with an AssumeFPS() statement. This is where you re-time the video to play at what you think is the correct rate. There is absolutely no set number for old silent films, many of which were hand-cranked. Also, because this is Harold Lloyd, there is a possibility that some scenes are undercranked so that the footage would look to be sped up when projected, for comedic effect.

Code:
loadPlugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\TIVTC.dll")

AVISource("e:\fs.avi").killaudio()
AssumeTFF() #change to BFF is you get field reversal
tfm(display=false)  
tdecimate(display=false,mode=0,cycleR=34,cycle=128) 
AssumeFPS(12)
The only downside to using a long cycle is that it slows down the script.

Last edited by johnmeyer; 20th February 2020 at 03:08. Reason: removed word that has multiple definitions; it was confusing
johnmeyer is offline   Reply With Quote
Old 20th February 2020, 09:23   #6  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
john
Thanks for the analysis. I just noticed that your script has still 3 duplicates (101,102), (142,143), (413,414) if I am not mistaken.
My prodedure has basically been much the same as you described.

For what it's worth here a script which I occasionally use for analyzing and visualizing progressive vs interlaced vs phase-shifted vs telecined video:
Code:
clip="your source filter"
clip=clip.AssumeTFF().converttoYV12(interlaced=true)

current=clip.trim(0,-0).showframenumber(scroll=true,x=60,y=260,size=24)  #the current frame n
next=clip.trim(1,-0).showframenumber(scroll=true,x=60,y=260,size=24,offset=1)  #the next frame n+1
even_current=current.separatefields().selecteven().subtitle("current (even field)",align=5,size=24)
odd_current=current.separatefields().selectodd().subtitle("current (odd field)",align=5,size=24)
even_next=next.separatefields().selecteven().subtitle("next (even field)",align=5,size=24)
odd_next=next.separatefields().selectodd().subtitle("next (odd field)",align=5,size=24)
matched=current.TFM(pp=0,display=true).subtitle("field matched",align=5,size=24)

pic1=stackvertical(even_current,odd_current)
pic2=stackvertical(even_next,odd_next)

return stackhorizontal(pic1,pic2,matched)

Last edited by Sharc; 20th February 2020 at 10:14. Reason: added pp=0 in TFM()
Sharc is offline   Reply With Quote
Old 20th February 2020, 12:08   #7  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Here an interpolated version with framerate doubling, for smoother playback at 23.976 fps. Judge yourself regarding interpolation artifacts etc.
https://www.mediafire.com/file/z9bqr...lated.mp4/file
Sharc is offline   Reply With Quote
Old 20th February 2020, 18:29   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Code:
TFM(pp=0)
Apparentfps(Dupethresh=1.5)
Shows 21.978 FPS.
Dupethresh is quite high [noisy clip] but plenty of movement in clip so reasonably good result I think. [Although any edits could have affected result (result would a bit be too high where dupes edited out)]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 20th February 2020 at 18:31.
StainlessS is offline   Reply With Quote
Old 20th February 2020, 18:32   #9  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by Sharc View Post
Here an interpolated version with framerate doubling, for smoother playback at 23.976 fps. Judge yourself regarding interpolation artifacts etc.
https://www.mediafire.com/file/z9bqr...lated.mp4/file
Much better to convert the original to 60p and apply an appropriate cadence.

For instance here is an original 16p source converted to 60p using 60p using an AAA,BBBB,CCCC,DDDD cadence:

https://www.youtube.com/watch?v=YHYaYOMc4eo&t=86s

Last edited by Cary Knoop; 20th February 2020 at 18:35.
Cary Knoop is offline   Reply With Quote
Old 20th February 2020, 18:55   #10  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
I have occasionally used motion estimation on movie film, but the artifacts are so severe, as shown in that test clip, that I almost always recommend against it. Also, these days most displays can show any frame rate and are not locked in to 25 or 29.97 fps.

So my recommendation, which I made in my other post, is to experiment with AssumeFPS() to find a frame rate that makes the motion look to be the right speed, and then not do anything else. Just save the file and watch it. You'll have it at the correct speed; you won't have any funky, and sometimes awful, motion estimation artifacts; and you won't have the additional judder that any pulldown cadence is going to impart.
johnmeyer is offline   Reply With Quote
Old 21st February 2020, 07:31   #11  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by johnmeyer View Post
(you should always do your analysis by first doing a separatefields() operation and then walking through a large number of fields).
Only if you like counting twice as much as is necessary. We've been through this before. Apply TFM to field match and then begin counting.

It's a pretty simple one, with a cycle of only 22 frames:

TFM(pp=0).TDecimate(Cycle=22,CycleR=6)


For which you get 21.796fps. You might not want to leave pp=0 for the whole thing, in case there are some quirks along the way. If for another DVD, it can be soft telecined using DGPulldown. Otherwise I'd leave the framerate alone.

Last edited by manono; 21st February 2020 at 07:34.
manono is offline   Reply With Quote
Old 21st February 2020, 16:20   #12  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
Quote:
Originally Posted by manono View Post
Only if you like counting twice as much as is necessary. We've been through this before.
The reason I do a separatefields() -- and will continue to do so -- is that it is the only way to truly see whether an individual field has been screwed up. If you leave fields paired together, it is very difficult to detect reversed fields; phase shifted fields; fields that have artifacts from re-sizing interlaced video without first deinterlacing; etc. When getting ready to IVTC, all of these things are a possibility, and you need to know if the video needs more than just a simple TFM/TDecimate.

You can also do a bob(), but given how bob() works in AVISynth, you can get distorted results if you don't use the correct parameters.
johnmeyer is offline   Reply With Quote
Old 21st February 2020, 20:03   #13  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by johnmeyer View Post
I have occasionally used motion estimation on movie film, but the artifacts are so severe, as shown in that test clip, that I almost always recommend against it. Also, these days most displays can show any frame rate and are not locked in to 25 or 29.97 fps.

So my recommendation, which I made in my other post, is to experiment with AssumeFPS() to find a frame rate that makes the motion look to be the right speed, and then not do anything else. Just save the file and watch it. You'll have it at the correct speed; you won't have any funky, and sometimes awful, motion estimation artifacts; and you won't have the additional judder that any pulldown cadence is going to impart.
In a few (5) blind tests on TV screen people unanimously preferred the IVTCed motion interpolated double framerate variant, either at 'original' playback speed of 43.6fps (=2x21.8fps) or slowed down to 23.976fps. As "uneducated" viewers they didn't notice the interpolation artefacts but preferred the reduced strobing vs the original 'vintage' look.
Of course this is subjective and I would not use it for the archive.
Sharc is offline   Reply With Quote
Old 22nd February 2020, 01:53   #14  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
Quote:
Originally Posted by Sharc View Post
In a few (5) blind tests on TV screen people unanimously preferred the IVTCed motion interpolated double framerate variant, either at 'original' playback speed of 43.6fps (=2x21.8fps) or slowed down to 23.976fps. As "uneducated" viewers they didn't notice the interpolation artefacts but preferred the reduced strobing vs the original 'vintage' look.
Of course this is subjective and I would not use it for the archive.
Your point is quite valid, and I like the idea of a "blind" test (interesting adjective to apply to a visual test).

I've observed the same thing, namely that people always notice the judder on horizontal camera pans in low framerate film (12-16 fps that is typical on these really old films), but seldom notice what, to me, are very obvious ME artifacts. I think the reason for this is that most ME artifacts persist for only one frame. By contrast, the judder can go on for 5-10 seconds (or more) in many scenes.

Also, some of the ME artifacts, while pretty obnoxious when viewed on a freeze frame, don't always call attention to themselves when that degraded frame is shown in motion.

While I can still make other arguments for not doing ME, such as maintaining more sharpness (watch the sprinklers in the background, for instance and see how fuzzy they get), funky grain morphing (it's probably a good idea to do grain reduction if you're going to do ME); occasional REALLY bad artifacts (I can link you to my usual moose antler doozie in a 1940's parade clip which uses ME in order to reduce judder), I think your tests trump any argument I can make.

Last edited by johnmeyer; 22nd February 2020 at 05:54.
johnmeyer is offline   Reply With Quote
Old 26th February 2020, 01:08   #15  |  Link
nfv
Registered User
 
Join Date: Aug 2007
Posts: 44
Quote:
Originally Posted by manono View Post
Only if you like counting twice as much as is necessary. We've been through this before. Apply TFM to field match and then begin counting.

It's a pretty simple one, with a cycle of only 22 frames:

TFM(pp=0).TDecimate(Cycle=22,CycleR=6)


For which you get 21.796fps. You might not want to leave pp=0 for the whole thing, in case there are some quirks along the way. If for another DVD, it can be soft telecined using DGPulldown. Otherwise I'd leave the framerate alone.
manono, this seems to work great! But..DGPulldown only accepts MPEG's correct? I tried loading the AVI in DGPulldown and it gave me an error and said "The input file must be an elementary stream".

The software I use to encode MPEG2 doesn't accept 21.796 as a legal framerate either. What should I do know? My endgame here is a DVD by the way.
nfv is offline   Reply With Quote
Old 26th February 2020, 08:19   #16  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by nfv View Post
But..DGPulldown only accepts MPEG's correct?
Yes, sort of, it's for applying soft telecine to MPV/M2Vs (the 'elementary stream' mentioned) encoded for DVD. Don't know why you'd try to open an AVI in it.

Quote:
The software I use to encode MPEG2 doesn't accept 21.796 as a legal framerate either.
Add an AssumeFPS(23.976) to the bottom of the script and try again. Be sure and adjust your bitrates by a factor of 23.976/21.796= about 1.1. Multiply what you'd use for an ordinary 23.976fps encode by 1.1. I don't know what encoder you're using or how you're figuring your bitrates. Use DGPulldown when done the encoding by opening the MPV/M2V, ticking the "Custom" box and then 21.796->29.97.

Oh, also, later I figured it was even simpler than I had written earlier. You can use this instead:

TFM().TDecimate(Cycle=11,CycleR=3)

Good luck!

Last edited by manono; 26th February 2020 at 08:25.
manono is offline   Reply With Quote
Old 26th February 2020, 11:48   #17  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by nfv View Post
….My endgame here is a DVD by the way.
Hmmm, I think we arrived almost where we started:
Your .avi was actually prepared for DVD compliance by hard telecining the original film to 29.97fps. The pattern was unusual because of the unusual base rate of the original film.

If you don't succeed with DGpulldown try this and compare with your .avi:
Code:
AVISource("silent.avi")
converttoYV12(interlaced=true)
TFM().tdecimate(mode=0,cycle=11,cycleR=3) #progressive frames with unusual framerate, as discussed
#assumeFPS(16)   #adjust the playback speed as you prefer
separatefields()
changeFPS(59.94)  #hard telecine, DVD compliant field rate
weave()
and encode as mpeg-2 interlaced, 29.97fps

Last edited by Sharc; 26th February 2020 at 12:47. Reason: added #assumeFPS() ....
Sharc is offline   Reply With Quote
Old 26th February 2020, 18:22   #18  |  Link
nfv
Registered User
 
Join Date: Aug 2007
Posts: 44
Quote:
Originally Posted by manono View Post
Yes, sort of, it's for applying soft telecine to MPV/M2Vs (the 'elementary stream' mentioned) encoded for DVD. Don't know why you'd try to open an AVI in it.


Add an AssumeFPS(23.976) to the bottom of the script and try again. Be sure and adjust your bitrates by a factor of 23.976/21.796= about 1.1. Multiply what you'd use for an ordinary 23.976fps encode by 1.1. I don't know what encoder you're using or how you're figuring your bitrates. Use DGPulldown when done the encoding by opening the MPV/M2V, ticking the "Custom" box and then 21.796->29.97.

Oh, also, later I figured it was even simpler than I had written earlier. You can use this instead:

TFM().TDecimate(Cycle=11,CycleR=3)

Good luck!
So just so I understand this correctly...I add AssumeFPS(23.976) to the bottom of the script and my MPEG2 encoding software will recognize it as 23.976? Then after I encode the file into an MPEG2/M2V at 23.976 then I have to run DGPulldown on that (ticking the "Custom" box and then 21.796->29.97)?

Do I have that right?

Another question, since the film doesn't just start, it has some junk before it so if I trim that how do I know I'll be in the right place for the cadence to begin?

Here's the clip: https://www.mediafire.com/file/17yid...start.avi/file

Or is the script smart enough to recognize where the cadence starts?

Thanks!
nfv is offline   Reply With Quote
Old 26th February 2020, 19:05   #19  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by nfv View Post
So just so I understand this correctly...I add AssumeFPS(23.976) to the bottom of the script and my MPEG2 encoding software will recognize it as 23.976? Then after I encode the file into an MPEG2/M2V at 23.976 then I have to run DGPulldown on that (ticking the "Custom" box and then 21.796->29.97)?

Do I have that right?
Yes, all correct.
Quote:
Another question, since the film doesn't just start, it has some junk before it so if I trim that how do I know I'll be in the right place for the cadence to begin?
It doesn't matter. Start anywhere. Count off 11 frames after applying TFM alone and three of them will be duplicates. Pick up where you left off and do it again, same thing. Plus, TFM and TDecimate are adaptive so that if the cadence changes briefly (it doesn't, not in the sample anyway), it can still get it right.

There are two 'patterns' at work here. One goes 533, the other 443. That means for each frame count, there's one duplicate. When I write 5, it goes 1,2,3,4,4. 4 unique frames and one duplicate. 5+3+3=11, three numbers listed means 3 duplicates. The cycle is 11 frames (5+3+3=11, 4+4+3=11) and within that 11 frame cycle are 3 dupe frames. To figure that out you do have to start at the beginning of a cycle and not at any old place.

Once you learn how it's done, you can do most silent films this way, being sure to also know how to look for the possible problems as outlined by johnmeyer. And with respect to Sharc, the whole point to encoding it progressively and adding soft pulldown later on is to avoid the problems associated with hard pulldown. The bitrate savings are considerable, something like 40% for the same quality, as compared to encoding the interlacing. I didn't look at your new sample. Was there some reason I should? Is it different somehow from the earlier sample?
manono is offline   Reply With Quote
Old 26th February 2020, 20:10   #20  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by manono View Post
And with respect to Sharc, the whole point to encoding it progressively and adding soft pulldown later on is to avoid the problems associated with hard pulldown. The bitrate savings are considerable, something like 40% for the same quality, as compared to encoding the interlacing. I didn't look at your new sample. Was there some reason I should? Is it different somehow from the earlier sample?
I posted the hard telecining script as a workaround for an DVD 29.97i compliant output in case the OP should not succeed with DGpulldown. I don't know the OP's encoder, DVD authoring and playback scenario, so just in case. No doubt that soft telecining with DGPulldown is more efficient and preferable, especially for mpeg2.

Last edited by Sharc; 26th February 2020 at 20:13.
Sharc is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.