PDA

View Full Version : Help with ImageWriter for subtitles


Septimus
23rd November 2008, 12:09
I've written a small script to create subtitles for dvds.

I intend to make a very low bitrate DVD movie < 500 Mbps (not sure how low I can go without breaking the DVD spec) This is just a black filler video so I can make a jukebox DVD. I only intend to encode one video and repeat for each song, overlaying subtitles in each case.

The subtitle has a moving timecode, a title and the total track length displayed.

I have setup Imagewriter to output the subtitles with the standard colours as bitmaps for every frame. I want to output the subtitle only every second. What I am stuck with is how to make a conditional filter to trigger Imagewriter every 25 frames ( for PAL ).

I know how to use b = (a==true) ? 1 : 2 , but I can't seem to get any kind of boolean or variable value out of FrameEvaluate for current_frame.

Any help with (a=true) would be appreciated Thanks :)

J_Darnley
23rd November 2008, 12:41
Can you get ( current_frame%25 == 0 ) to work in FrameEvaluate? If not try ScriptClip like below.

ScriptClip( """( current_frame%25 == 0 ) ? ConvertToRGB24().ImageWriter().ConvertToYV12() : last""" )

ScriptClip cannot return a different colour space so if you need to change colour space for ImageWriter then you will have to change back. Use triple quotes for the ScriptClip string so you can give ImageWriter the type and path.

Gavino
23rd November 2008, 15:30
I would write it as follows (no need for FrameEvaluate):

images=ConvertToRGB24().ImageWriter(...).ConvertToYV12()
ConditionalFilter(images, last, "current_frame%25", "==", "0")