absolutedestiny: (Default)
[personal profile] absolutedestiny
For [livejournal.com profile] quu and [livejournal.com profile] trythil

Based on previous discussions, a telecine script for converting 24fps to 29.97fps using blankclip with showframes as base clip.

The following has a number of predefined functions that can be easily called from an external script for simplicity.

Have fun, guys :D


(EDIT: I think there's a problem with the 196 model which means that the last section isnt a multiple of 4. However, given our telecine pattern, it should be fine I think.)

(EDIT2: Actually, no this isnt perfect- frame 799 gets its fields swapped - or so it seems.... we'll have to rethink the pattern a little. I think copying frames 0,201,402,603 might be ok, though.

Yeah, it seems to work better. Script updated with changes)





function Telecine(clip c)
{
c.AssumeFrameBased()
SeparateFields()
SelectEvery(8, 0,1, 2,3,2, 5,4, 7,6,7)
return Weave()
}


function min(int m, int n)
{
return (m < n) ? m : n
}



function NullClip(clip c)
{
return c.BlankClip(length=0)
}



function Trim2(clip c, int start, int "end", int "length")
{
assert(!(defined(end) && defined(length)),
\ "Trim2: end and length parameters cannot be used together")
assert(!defined(length) || length >= 0, "Trim2: invalid length")

end = defined(length) ? (start + length) : default(end, c.FrameCount())
end = (end < 0) ? (c.FrameCount() + end) : end

assert(start >= 0 && start <= c.FrameCount(), "Trim2: start frame out of bounds")
assert(end >= start && end <= c.FrameCount(), "Trim2: end frame out of bounds")

# we can't use Trim(start, end - 1) in case end == 1
return (start == end)
\ ? c.NullClip()
\ : c.Trim(start, -(end - start))
}



function NewTelecineHelper(clip c, int iterLeft)
{
iterLeft = iterLeft - 1

start = iterLeft * 800
end = min(c.FrameCount(), (iterLeft + 1) * 800)

seg = c.Trim(start, -800)

seg1 = seg.Trim( 0, -1) + seg.Trim( 1, 200).Telecine()
seg2 = seg.Trim(201, -1) + seg.Trim(202, 401).Telecine()
seg3 = seg.Trim(402, -1) + seg.Trim(403, 602).Telecine()
seg4 = seg.Trim(603, -1) + seg.Trim(604, 0).Telecine()


c = c.Trim2(0, start) + seg1 + seg2 + seg3 + seg4 + c.Trim2(end)

return (iterLeft == 0)
\ ? c
\ : NewTelecineHelper(c, iterLeft)
}



function NewTelecine(clip c)
{
c.NewTelecineHelper(Ceil(c.FrameCount() / 800.0))
AssumeFPS(29.97)
return AudioDub(last, c)
}




video= BlankClip(length=14400, width=720, height=480, fps=24, color=$000000).ShowFrameNumber()
NewTelecine(video)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

absolutedestiny: (Default)
absolutedestiny

February 2019

S M T W T F S
     12
3456789
10111213141516
17181920212223
2425262728  

Style Credit

Page generated Jul. 26th, 2025 07:42 pm
Powered by Dreamwidth Studios

Expand Cut Tags

No cut tags