VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Recently I had a need for a special avisynth script to cut and merge movies, cloning the start and end frames, add subtitles to these cloned areas and fade them in and out. In addition to this, I needed to zoom in certain areas of various segments in addition to the cloning,subbing,fading. Took a while but finally got it working and thought maybe someone else could use it by modifying what you need:

    ULTIMATE AVISYNTH SCRIPT
    Converts Video with Zoom In (start magnification 100%), Pan In (none), Scan In (none), Zoom out (magnification 200%), Pan out (none), Scan out (none), Clone first frame for 5 seconds, Fade in (from frame 100 thru 200) these cloned 5 seconds, Cloned last frame for 5 seconds, fade out (from frame 400-500) these 5 seconds, add subtitles, Outline subs, use sub background (2 lines of different length will have the same length background), background 50% transparency, set video size, FPS, CRF, bit rate,font size, font type, font position (9 choices)

    CMD file
    Code:
    ffmpeg -i "C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\Zoom.avs" -vf scale=w=854:h=480:force_original_aspect_ratio=1,pad=854:480:(ow-iw)/2:(oh-ih)/2,tpad=start_mode=clone:start_duration=5,tpad=stop_mode=clone:stop_duration=10,fade=t=in:st=0:d=5:c="Black",fade=t=out:st=482.478:d=5:c="Black","subtitles='C\:\\Users\\Bud\\Desktop\\TrimNMerge\\TrimNMerge\\bin\\Debug\\work\\Subtitles.srt':force_style=FontName='Arial,PrimaryColour=&H00FFFFFF,BackColour=&H80000000,BorderStyle=4,Outline=1,Shadow=0,MarginV=20,Fontsize=30,Alignment=10'",unsharp=9:9:1.15 -af "adelay=5000|5000,apad=whole_dur=477.478" -vcodec libx264 -crf 20 -b:v 400K -bufsize:v 400K -r 29.97 -acodec aac -ab 128k -ar 48k -max_muxing_queue_size 9999 "C:\Users\Bud\Desktop\Subbed_Resized_5_10_CGOP.mp4"

    ZOOM.AVS
    Code:
    Import("C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\uuzoom.avs")
    C = directshowsource("C:\Users\Bud\Desktop\CGOP.mp4")
    C = C.ConvertToRGB32(matrix = "PC.709", chromaresample = "spline36")
    E = C.trim(0,500)
    F = C.trim(500,0)
    v1 = Animate(E,100,200,"UUZoom",1.0,0,0,2.0,0,0)
    v2 = Animate(F,200,300,"UUZoom",2.0,0,0,1.0,0,0)
    Return v1 ++ v2
    You may notice some of the various differences in fade color and background color. The UUZoom is a scipt created by raffriff42 I believe on the doom 9 site https://forum.doom9.org/archive/index.php/t-168266.html. v2 animate f start frame is actually 400 since the 200 is added to the v1 end zoom frame (200+200=400)

    Hope it is of use to someone since it is always a bear to get the double "//", double quotes, single quotes, Right capitalization, etc correct so the final works.

    This script was created and verified by and can be compared to the corresponding fields presented in a graphic form.:
    Image
    [Attachment 52155 - Click to enlarge]
    Quote Quote  
  2. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    DirectShowSource? ConvertToRGB32? No, thank you. No.
    Quote Quote  
  3. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    My goal with this post was not to provide a 'Cut and Paste' solution but rather a 'sequence' of events that cover most of what you or others might want to provide a smooth transition between segments of that basketball game or trip to Florida with out the sudden change with no explanation of what is what. It also pads the audio so sync is maintained as well as allowing to add subtitles on the cloned, fade In/Out areas.

    FFMpeg and Avisynth, as you well know, are sequence sensitive in the order of functions. Different sequence cause different output or outright failure. I thought this post might provide a template for changing as needed. Things like Color, times, subtitles, background color, subtitle color, and even the name of my video will most certainly need to be alter or omitted.

    I'm sure that, since anyone who knows that RGB and Directshowsource are not ideal, also would be able to change for their needs or PM me and I would most certainly attempt to help. After all that is why in my initial post I mention:

    ...could use it by modifying what you need
    Import("C:\Path\to\your\\uuzoom.avs")
    C = FFmpegsource2("C:\Users\Bud\Desktop\CGOP.mp4", atrack=-1)
    C = C.ConvertToRGB32(matrix = "PC.709", chromaresample = "spline36")
    E = C.trim(0,500)
    F = C.trim(500,0)
    v1 = Animate(E,100,200,"UUZoom",1.0,0,0,2.0,0,0)
    v2 = Animate(F,200,300,"UUZoom",2.0,0,0,1.0,0,0)
    Return v1 ++ v2

    Unfortunately uuzoom and vdubzoom require RGB but any script that enlarges to achieve a zoom like effect, also re-codes so I don't think RGB would be the worst of the concerns..
    Quote Quote  



Similar Threads