Log in

View Full Version : How to convert 4k 60 FPS to real 1080i (29.970)with Avisynth?


frank_zappa1
9th November 2017, 22:22
hello guys good afternoon, a favor if I want to create a 1080i from this video 4k (60 FPS), but be really a 1080i at 29.970, how could I create it in avisynth someone will have some example please, first time I try this. The point is to use the output file to create a real 1080i bluray.
Is interpolation necessary?

thanks for your help

this is the original source :

Vídeo
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L5.2
Format settings : CABAC / 3 Ref Frames
Format settings, CABAC : Sí
Format settings, RefFrames : 3 fotogramas
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 3 h 9 min
Source duration : 3 h 9 min
Bit rate mode : Variable
Bit rate : 35,0 Mb/s
Width : 3 840 píxeles
Height : 2 160 píxeles
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 59,940 (59940/1000) FPS
Minimum frame rate : 59,940 FPS
Maximum frame rate : 60,000 FPS
Original frame rate : 59,940 (60000/1001) FPS
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progresivo
Bits/(Pixel*Frame) : 0.070
Stream size : 46,2 GiB (99%)
Source stream size : 46,2 GiB (99%)
Encoded date : UTC 2017-11-09 13:42:29
Tagged date : UTC 2017-11-09 13:53:24
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

StainlessS
9th November 2017, 23:29
Maybe something like this (barebones script in blue)

# TESTCLIP
Colorbars(Width=3840,height=2160).AssumeFps(60000,1001).Killaudio
###############
ConvertToYV12
BicubicResize(1920,1080) # some resizer
AssumeTFF # Choose BFF or TFF (its actually progressive, this controls result parity)
SeparateFields
SelectEvery(4,0,3) # Same Parity as above AssumexFF()
Weave
Info
Return Last


Others will correct if in error. ( they love doing that, so much more of a lure than posting answer :) )

EDIT:

# TESTCLIP
I_W=1280 I_H=720
#I_W=3840 I_H=2160
BlankClip(Length=I_H/8,Width=I_W,height=I_H).AssumeFps(60000,1001).Killaudio
### resize for OP
O_W=I_W/2 O_H=I_H/2
BicubicResize(O_W,O_H)
OB_W=O_W/4 OB_H=O_H/4
OB_COL=$FFFF00FF # MUST be RGB with Alpha set $FF000000
OB=Last.BlankClip(width=OB_W, height=OB_H, color=OB_COL)
# create demo graphic
Last.Animate(0,Last.FrameCount-1, "Layer", OB,"add",257, 0, 0, OB,"add",257, O_W-1, O_H-1)
###############
ConvertToYV12
AssumeTFF # Choose BFF or TFF
SeparateFields
SelectEvery(4,0,3)
Weave # Same Parity as above AssumexFF()
Info
Return Last

johnmeyer
10th November 2017, 00:31
I had this code kicking around. Same as StainlessS except it gives you different field parity because of the different SelectEvery() that I used. Since the original is progressive, I'm not sure the field order flag matters, but I would certainly test the result for field reversal by temporarily adding a "separatefields()" statement at the end of this script. You should see no retrograde motion between fields (i.e., where they stutter backwards). If you get that switch over to StainlessS' SelectEvery() statement (or vice versa).

# This script takes 60p material and outputs 60i
AVISource("E:\fs.avi").assumeTFF()
SeparateFields() # 60 frames becomes 120 fields
SelectEvery(4, 1, 2) # 120 fields to 60 fields (selects 2 from 4)
Weave()

StainlessS
10th November 2017, 01:13
Since the original is progressive, I'm not sure the field order flag matters
EDIT: Yes progressive but used here to determine output parity.

Not sure, think is default bottom field first in AVS, so if not explicitly set as eg AssumeTFF, then
field 0=Bottom, field 1=top, 2=bot, 3=top.
So if selecting 1 and 2, then after weave is TFF. (selected 1=top, and 2=bot)
If is explicitly set AssumeTFF, then
field 0=top, field 1=bot, 2=top, 3=bot.
So if selecting 0 and 3, then after weave again TFF.

Parity (TFF/BFF) affects how separatefields behaves (which field is first afterwards), and so selecting 0,3 would select T/B if AssumeTFF or B/T if AssumeBFF. (selecting 0,3, same as input parity, selecting 1,2, inverse of input parity).

For the OP, we would also need resize prior to making interlaced.

real.finder
10th November 2017, 01:29
I have function

# 60p or 50p progressive to interlaced

FUNCTION interlaced60or50(clip c1, bool "BFF") {
BFF = default ( BFF, false )
Ifrate = round(framerate(c1))==60 ? 1 : framerate(c1)==50 ? 2 : 3
assert(ifrate!=3 && c1.IsFrameBased, "only Frame Based with 50 or ~60 fps is allowed.")

desiredoutputfieldorder = BFF ? c1.AssumeTFF() : c1.AssumeBFF() # opposite to the desired output field order
outputfieldDoubleWeave = desiredoutputfieldorder.DoubleWeave()
return outputfieldDoubleWeave.SelectEvery(4,1)
}

it's part of https://pastebin.com/Av385Vub

frank_zappa1
10th November 2017, 01:53
I have function

# 60p or 50p progressive to interlaced

FUNCTION interlaced60or50(clip c1, bool "BFF") {
BFF = default ( BFF, false )
Ifrate = round(framerate(c1))==60 ? 1 : framerate(c1)==50 ? 2 : 3
assert(ifrate!=3 && c1.IsFrameBased, "only Frame Based with 50 or ~60 fps is allowed.")

desiredoutputfieldorder = BFF ? c1.AssumeTFF() : c1.AssumeBFF() # opposite to the desired output field order
outputfieldDoubleWeave = desiredoutputfieldorder.DoubleWeave()
return outputfieldDoubleWeave.SelectEvery(4,1)
}

it's part of https://pastebin.com/Av385Vub

I took a screenshot, maybe you can confirm if it would work, in the image has the info

thanks so much

https://i.imgur.com/RTRbOwq.jpg

------------------------------------------------------------------------------
by chance you will have at hand some method to do the inverse but in a real way with interpolation, etc.

let say to go from 23.976 or 29.970 = 60 FPS, so that it has greater fluidity, starting from a DVD NTSC or PAL for example to perform an upscale.

I tried a lot of scripts that are on the net, interframe, etc. but nothing really looks good... do you know any effective methods?

also thanks to StainlessS & johnmeyer for trying to help me :)

StainlessS
10th November 2017, 02:18
by chance you will have at hand some method to do the inverse but in a real way with interpolation, etc.

let say to go from 23.976 or 29.970 = 60 FPS, so that it has greater fluidity, starting from a DVD NTSC or PAL for example to perform an upscale.

That is pretty much double rate bob deinterlacing, QTGMC is considered by many one of the better ones.
EDIT: At least it is for 29.970 = 60 FPS.

frank_zappa1
10th November 2017, 02:22
That is pretty much double rate bobbing, QTGMC is considered by many one of the better ones.

you'll have some sample script, is the first time I see this but... the interpolation makes it look a lot better, right?

thanks so much

StainlessS
10th November 2017, 02:32
the interpolation makes it look a lot better, right?
Hopefully, I hardly ever use it (rarely have need, and too slow for my machine).

Script:- http://avisynth.nl/index.php/QTGMC

Plenty of threads on it, use search.

frank_zappa1
10th November 2017, 02:38
Hopefully, I hardly ever use it (rarely have need, and too slow for my machine).

Script:- http://avisynth.nl/index.php/QTGMC

Plenty of threads on it, use search.
thanks so much

real.finder
10th November 2017, 02:49
I took a screenshot, maybe you can confirm if it would work, in the image has the info

thanks so much

https://i.imgur.com/RTRbOwq.jpg



it should work with any ~60 or 50 sources, regardless of anything else

it convert 60p to 60i(29.970 Interlaced) or 50p to 50i

frank_zappa1
10th November 2017, 16:34
it should work with any ~60 or 50 sources, regardless of anything else

it convert 60p to 60i(29.970 Interlaced) or 50p to 50i

Will you have any functionality that detects the interlacing whatever it is and makes it progressive with the best option available? would be something like the QTGMC (although this is not very good for detecting all types of interlacing)

FranceBB
10th November 2017, 21:14
interpolation makes it look a lot better, right?


No. Unless you really need to bring everything at an higher frame rate, interpolation is not a good idea. It would be, if it worked like a charm, but it's not always the case and it might create artifacts visible in high resolution contents. If your source it's interlaced, QTGMC can Bob deinterlace it to 50p, 60p; if it's progressive, you'll have to use motion vectors to create frames. You could also use blending in order to create a new frame by using two contiguous frames overlapped; that will make the "illusion" of motion.


Will you have any functionality that detects the interlacing whatever it is and makes it progressive?


We are not miracle worker, nor avisynth scripts xD
Anyway:/


#standard deinterlace.
#It won't Bob anything,
#it will probably be fine to deinterlace "automatically"

tdeint(mode=2, order=-1, field=-1, mthreshL=6, mthreshC=6, map=0, type=2, debug=false, mtnmode=1, sharp=true, cthresh=6, blockx=16, blocky=16, chroma=false, MI=64, tryWeave=true, link=1, denoise=true, slow=2, opt=4)

#if your source it's telecined
# and you want to make it progressive 23.976

tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3))
tdecimate()

#if your source it's interlaced
#and you want to Bob it to 50p or 60p

QTGMC( Preset="Slow", EdiMode="EEDI3", EdiMaxD=16)

#frame interpolation to 60fps
# use "num" and "den" to set the new desired framerate
#beware: it might produce artifacts

InterFrame(GPU=false, Preset="Medium", NewNum=60000, NewDen=1000, InputType="2D", OverrideAlgo=13, FrameDouble=false)

#blending
#convert to 60 fps with frame blending

ConvertFPS(60)



Anyway, my suggestion is to leave framerate as it is unless you really need to increase it, 'cause no matter how you increase it, there's always gonna be a drawback.

johnmeyer
10th November 2017, 22:47
This is typical of the similar posts by the same person over in Videohelp: he asks one question, never does anything with the answers, and then morphs into asking something that is in complete conflict with the original question. In this case, he started out with a reasonable question about converting 60p material to 60i (a.k.a. 29.97 interlaced). Now he suddenly wants to have a script that can detect interlacing (not impossible, but not easy) which, of course, is not needed if the source is progressive, as Mediainfo states.

real.finder
10th November 2017, 23:23
This is typical of the similar posts by the same person over in Videohelp: he asks one question, never does anything with the answers, and then morphs into asking something that is in complete conflict with the original question. In this case, he started out with a reasonable question about converting 60p material to 60i (a.k.a. 29.97 interlaced). Now he suddenly wants to have a script that can detect interlacing (not impossible, but not easy) which, of course, is not needed if the source is progressive, as Mediainfo states.

do you think he ingoldie, or someone relatives or friend or fan of ingoldie? or it's just a coincidence that both are almost same?

frank_zappa1
10th November 2017, 23:28
This is typical of the similar posts by the same person over in Videohelp: he asks one question, never does anything with the answers, and then morphs into asking something that is in complete conflict with the original question. In this case, he started out with a reasonable question about converting 60p material to 60i (a.k.a. 29.97 interlaced). Now he suddenly wants to have a script that can detect interlacing (not impossible, but not easy) which, of course, is not needed if the source is progressive, as Mediainfo states.

Hahah you're out of your mind. Do you have something good to contribute?

johnmeyer
11th November 2017, 00:07
Hahah you're out of your mind. Do you have something good to contribute?First of all, that is a statement just like the ones you make all the time over in Videohelp.com. For the record, look at post #3. Who wrote it? Me. Did I post a script that addresses your original question: "60 FPS [progressive] to real 1080i (29.970)"? Yes, I did.

So, in this thread, I DID have something "good" to contribute. In light of that fact, I don't understand your comment.

What is more, you obviously have never read any of my almost 2,000 posts in this forum. Almost every post is intended to help the OP.

For instance, see if you can write a script like this, which along with VideoFred's original has helped dozens of people restore their 8mm film:

Film Restoration (https://forum.doom9.org/showthread.php?p=1406847#post1406847)

See if you can write a script that can do this:

NFL Kinescope Noise Bars (https://www.youtube.com/watch?v=qx26T6WOZ_4)

That was done for a sports film collector with ties to the "NFL Films" company in New Jersey.

Or try to help someone who posted this impossibly screwed up interlaced video that was re-sized without first being deinterlaced:

Repair Bad Deinterlacing (https://forum.doom9.org/showpost.php?p=1685187&postcount=1)

I helped that person, by writing custom code, to get it to look like the lower right corner in this post:

Result (https://forum.doom9.org/showpost.php?p=1686429&postcount=52)

StainlessS actually made that particular post because he was helping me feather the thin horizontal lines. Most of the work prior to that was mine.

So, I did try to help you, but you ignored not only what I did for you, but also almost everything else other people provided to you; you did not post any results to show your progress; and then you went off in a completely orthogonal direction.

StainlessS
11th November 2017, 04:40
John, I think that you are a good and worthwhile contributor to the forum, I dont care who or how much everybody else hates you, I think that you are lovely. :)

frank_zappa1
11th November 2017, 05:40
First of all, that is a statement just like the ones you make all the time over in Videohelp.com. For the record, look at post #3. Who wrote it? Me. Did I post a script that addresses your original question: "60 FPS [progressive] to real 1080i (29.970)"? Yes, I did.

So, in this thread, I DID have something "good" to contribute. In light of that fact, I don't understand your comment.

What is more, you obviously have never read any of my almost 2,000 posts in this forum. Almost every post is intended to help the OP.

For instance, see if you can write a script like this, which along with VideoFred's original has helped dozens of people restore their 8mm film:

Film Restoration (https://forum.doom9.org/showthread.php?p=1406847#post1406847)

See if you can write a script that can do this:

NFL Kinescope Noise Bars (https://www.youtube.com/watch?v=qx26T6WOZ_4)

That was done for a sports film collector with ties to the "NFL Films" company in New Jersey.

Or try to help someone who posted this impossibly screwed up interlaced video that was re-sized without first being deinterlaced:

Repair Bad Deinterlacing (https://forum.doom9.org/showpost.php?p=1685187&postcount=1)

I helped that person, by writing custom code, to get it to look like the lower right corner in this post:

Result (https://forum.doom9.org/showpost.php?p=1686429&postcount=52)

StainlessS actually made that particular post because he was helping me feather the thin horizontal lines. Most of the work prior to that was mine.

So, I did try to help you, but you ignored not only what I did for you, but also almost everything else other people provided to you; you did not post any results to show your progress; and then you went off in a completely orthogonal direction.

You don't tell me what to do. If you want to collaborate your help is welcome and if you don't want to help Don't Fu... with your silly comments.. Because I don't have time for fools like you. Okay.

Stop telling people what to do, this is a forum to help,

If I ask a thousand questions and people in this forum want to help me and respond, that's fine. because this is a forum to HELP. Do you understand that? This is not a forum to annoy or tell people what to do....

Now that it's clear, I'm going to keep asking a thousand times more if I want and need because I have doubts and if the users of this forum want to help me. many thanks

Anyway, thanks for your help.

But ..the staff should do something about these freaks....:readrule::readrule::readrule:

manono
11th November 2017, 09:24
johnmeyer is absolutely right. Unlike videohelp.com, this forum doesn't suffer fools lightly. If you ask for help, then accept it in the spirit in which it is offered. Otherwise, you're welcome to move along.

But ..the staff should do something about these freaks....
I'm a staff member and you're in violation of the rules (https://forum.doom9.org/forum-rules.htm), particularly rule 4. But I won't hand you a strike. Yet. If something is done about anyone, it'll be you. You've been warned.

frank_zappa1
11th November 2017, 17:06
johnmeyer is absolutely right. Unlike videohelp.com, this forum doesn't suffer fools lightly. If you ask for help, then accept it in the spirit in which it is offered. Otherwise, you're welcome to move along.


I'm a staff member and you're in violation of the rules (https://forum.doom9.org/forum-rules.htm), particularly rule 4. But I won't hand you a strike. Yet. If something is done about anyone, it'll be you. You've been warned.

when I refuse help? :logfile: ?

I am free to ask whatever I want and as many times as I want and no one will stop me ok, if someone wants to answer and help me I will thank you accordingly.

Everything else is a waste of time. this guy just comes to piss me off.

and I'm not afraid of your warning from the staff, Knowledge is free and I never disrespect anyone, I'm free to ask everything I want and I'll keep doing it as long as I want, okay?

now if you have something to contribute instead of wasting time, get to the point.

Thank you for your help,

johnmeyer
11th November 2017, 18:07
John, I think that you are a good and worthwhile contributor to the forum, I dont care who or how much everybody else hates you, I think that you are lovely. :)Ah, StainlessS, my knight in shining armor, defending me from the barbarians at the gate. Thank you!

frank_zappa1
11th November 2017, 20:01
Ah, StainlessS, my knight in shining armor, defending me from the barbarians at the gate. Thank you!

I think you're totally crazy, and you need help. everything you do. Apparently nobody gives you any attention at home...

and I'm gonna keep asking as many times as I want to ok.

....Thank you, everyone who really helped. :thanks:

johnmeyer
11th November 2017, 23:36
I think you're totally crazy, and you need help. everything you do. Apparently nobody gives you any attention at home...

and I'm gonna keep asking as many times as I want to ok.

....Thank you, everyone who really helped. :thanks:Thank you for those kinds comments.

frank_zappa1
12th November 2017, 01:54
Thank you for those kinds comments.

You're welcome, buddy.

wonkey_monkey
12th November 2017, 22:45
You don't tell me what to do.

Stop telling people what to do

This is not a forum to [...] tell people what to do....

I don't see where anyone has "told you what to do," except in the sense of answering your questions with regard to video processing.

frank_zappa1
13th November 2017, 04:34
I don't see where anyone has "told you what to do," except in the sense of answering your questions with regard to video processing.

it's obvious that this guy wants to fuc... and not contribute anything ...you don't realize? but he's wasting his time, I'm still going to ask a thousand times more questions if I want.

manono
13th November 2017, 06:12
The original question was answered several times, competently and politely. Everything after was extraneous to the original topic. If you have questions on other subjects you're welcome to open a new thread about them because this one is closed.