logo Sign In

Post #129649

Author
Citizen
Parent topic
.: Citizen's NTSC DVD / PAL DVD / XviD project :. (Released)
Link to post in topic
https://originaltrilogy.com/post/id/129649/action/topic#129649
Date created
11-Aug-2005, 1:39 AM
Nevermind! I found some code that almost did the job and then hacked it up to work for my meagre needs:

-------------------------------------------------------------------------------------------------

# OverPic
#
# Allows you to overlay an image at specific coordinates over a specific frame range,
# suitable for DOGS (Digital Onscreen Graphics, ie horrible tv channel logos) but was
# specifically written to overlay a small amount of subtitles in bmp form into the
# black border of widescreen video.
#
# NOTE:
# Image masking not currently supported, may add this in the future.
#
# PARAMETERS:
# start, end : The frame range to apply the image to.
# thepic : The image filename to overlay.
# picx, picy : Where to overlay the image onto the video.
#
# USAGE:
# OverPic(253, 311, "subtitle.bmp", 100, 511)
#
function OverPic(clip c, int start, int end, string thepic, int picx, int picy)
{
Assert(start >= 0 && start < c.FrameCount(),"PicSub: start frame out of bounds: " + String(start))
Assert(end >= start && end < c.FrameCount(),"PicSub: end frame out of bounds: " + String(end))
logo=imagesource(thepic)
c1 = c.trim(0,start-1)
c2 = overlay(c.trim(start,end),logo,picx,picy)
c3 = c.trim(end+1,c.framecount())
return c1 + c2 + c3
}

-------------------------------------------------------------------------------------------------

This is an example of how I'm using it in a script, the code placed after the function:


-------------------------------------------------------------------------------------------------

video=avisource("4PAL2.avi").addborders(0,65,0,65)

video=PicSub(video,1235,1255,"sub1.bmp",0,511)
video=PicSub(video,1301,1334,"sub2.bmp",0,511)

return video

-------------------------------------------------------------------------------------------------


Now to make the subtitle images and find out what frames to place them in, then I can encode the PAL DVD of ANH!