Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st May 2021, 03:42   #1  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 365
Import ImageWriter images back in but differently

I've successfully used ImageWriter to extract individual images from a video that is largely a simple slide show. Here's a sample of my script:
Code:
frame=426
ImageWriter("slides\myProject.",frame,frame,"jpg")
frame=522
ImageWriter("slides\myProject.",frame,frame,"jpg")
It creates (in this fragment) 2 .jpg files. (in reality my script has made many dozens of individual "slides" for future use.) Now in a different script, I want to overlay the image of frame 426 over frames 20 to 30 in another video whose video clip is myClip, leaving all the other frames intact. And likewise with many other INVIDUAL images (.jpg). In fact, when I'm done, most of the original frames of the video will have been replaced by some slide from the slide collection.

I can't figure out how to do this. ImageSource appears to use as it's sole video source, the standalone images. I already have a video with audio, but want to replace a range of the video frames only (not touching the audio) with a single "slide" from one of my .jpgs. Then do this all over again for a different slide and target frame range. (Sorry if this is not as succinct as it might have been.)

Last edited by TCmullet; 1st May 2021 at 04:59.
TCmullet is offline   Reply With Quote
Old 1st May 2021, 04:30   #2  |  Link
patul
Registered User
 
Join Date: Sep 2005
Posts: 130
A n00b way to do it

PHP Code:
A       FFVideoSource("D:\App\youtube-dl\S2_E09_clip.mkv").TFM().TDecimate().ConvertToRGB32(matrix "Rec601")
B       ImageSource("D:\App\AVS\AVSMeter290\flintstones.png"start=0end=10fps=A.FrameRatepixel_type="RGB32")

Afin    A.Trim(020)
Afovr   A.Trim(2030)
Afout   A.Trim(30A.FrameCount-1)
Ovr       Overlay(AfovrBmask=B.ShowAlpha(), opacity=0.5)

AudioDub(Afin ++ Ovr ++ AfoutFFAudioSource("D:\App\youtube-dl\S2_E09_clip.mkv")) 
patul is offline   Reply With Quote
Old 4th May 2021, 03:51   #3  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 365
I guess there's no way to do it directly, even though snatching the slides was simple. So I've written a function to do it. It works (and was a good exercise, I guess).

Code:
function Insert1ImageRange(clip c, string fname, int fstart, int fend)
{	# Insert 1 image into a video clip replacing
        # the target range of frames
    holdaud=c
    before = c.trim(0, fstart-1).killaudio()
    after = c.trim(fend+1, 0).killaudio()
    inserted = \
imageSource(fname,start=fstart,end=fend,fps=framerate(c)).Spline36Resize(width(c),height(c))
    vid = before ++ inserted.ConvertToYV12() ++ after
    return audiodub(vid, holdaud)
}
TCmullet is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.