digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Video Encoding and Conversion (http://www.digitalfaq.com/archives/encode/)
-   -   Adding black "frames" to the beginning and the end of video? (http://www.digitalfaq.com/archives/encode/6851-adding-black-frames.html)

incredible 11-24-2003 07:38 AM

Adding black "frames" to the beginning and the end of video?
 
Yesterday i did a capture "L.A. Story" and what I recognised in the past was that my Stand Alone Player "overjumps" like 5-10 frames at the beginning of a mpeg stream when starting playback. And also stops ca. 5-10 frames before the stream on the CD-R really ends.
If an encoding is done on a capture where the movie starts exactly at frame 0 I always was suffering under these 5-10 Frames "overjump" at the beginning according to my StandAlone, also the "cut"-off of 5-10 frames at the end.

So yesterday I wrote a function you can just place in every script you want which adds x black Frames at the beginning and the same x black Frames to the end ... also automatically there will be a fade in from the black frames to the real stream beginning and also from the stream end to the black x Frames.

Use the Command as following:

addblack(int [No.frames] )

So addblack(50) will add 50 black frames to the beginning and the end of the stream including the mentioned fade-in and fade-out.

addblack() just uses 50 frames as default.

I testet it yesterday on several different inputs. Different according to Colorspace, Audiorate, Size and so on.

This function is source adapitve! This means it automatically detects the colorspace, width, heigth, fps, size ... etc. which are needed to generate the blankclips so it will be compatible to the source to which it will be added.
So no matter where you place it, but I would recommend to place it after the Addborders() or GripBorders() command in your script.


So safe this function as "Addblack.avsi" to your Avisynth 2.5x PlugIns Folder and use the command as explained above.

BUT! As I said ... I tested it yesterday and it worked well on differend colorspace sources, so if there will be a problem just scream.

Code:

function addblack (clip c, int "lof") {
lof= default(lof, 50)
wi=width(c)
hi=height(c)
fr=framerate(c)
ty= (IsRGB24(c)==true) ? "RGB24" : (IsRGB32(c)==true) ? "RGB32" : (IsYUY2(c)==true) ? "YUY2" : "YV12"
ch= (AudioChannels(c)==2) ? true : false
ar = Audiorate(c)
c=fadein(c,25).Fadeout(25)
d=BlankClip( Pixel_Type=ty,audio_rate=ar, stereo=ch, length=lof, width=wi, height=hi, fps=fr, color=$000000)
Return d+c+d
}

If you dont want the Fade-in and fade-out to be applied, just delete the line "c=fadein(c,25).Fadeout(25)"


All times are GMT -5. The time now is 03:30 PM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.