[Script] Create video from timelapse images

Got questions or tips about the Conversion process? This is the place to discuss them.


Forum rules

Read the FAQs and search the forum before posting a new topic.

This forum is for discussing tips and understanding the process involved with Converting faces from your trained model.

If you are having issues with the Convert process not working as you would expect, then you should post in the Convert Support forum.

Please mark any answers that fixed your problems so others can find the solutions.

Post Reply
User avatar
Surrogator
Posts: 13
Joined: Sun Jul 14, 2019 11:39 pm
Has thanked: 2 times
Been thanked: 2 times

[Script] Create video from timelapse images

Post by Surrogator »

The following Windows batch script will create a 60 fps video from your timelapse images.

Create a new file called timelapse.bat and paste the following contents:

Code: Select all

@ECHO off

IF EXIST timelapse_concat.txt DEL /F timelapse_concat.txt

ECHO Gathering images...

FOR %%G IN (*.jpg) DO (
    @ECHO file %%G >> timelapse_concat.txt
)

ECHO Creating video...

ffmpeg -v quiet -stats -f concat -i timelapse_concat.txt -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -r 60 timelapse.mp4

DEL timelapse_concat.txt

It requires that you call this script from a terminal within your Faceswap Conda environment. On a typical Windows installation of Faceswap you can do this by following these steps:

  • Open the windows menu and look for the Anaconda application folder.

  • Launch Anaconda Prompt (MiniConda3)

  • Activate your Faceswap environment. By default this is named faceswap, so you would type conda activate faceswap

  • You can now use this terminal window to create your timelapse video. See example below.

On the command line, navigate to the directory that contains your timelapse images and call the batch script, keeping in mind where the batch script is located relative to your current working directory:

timelapse_bat.png
timelapse_bat.png (16.47 KiB) Viewed 462 times
Last edited by Surrogator on Sun May 15, 2022 2:04 pm, edited 1 time in total.

Tags:

User avatar
torzdf
Posts: 1986
Joined: Fri Jul 12, 2019 12:53 am
Answers: 139
Has thanked: 90 times
Been thanked: 434 times

Re: [Script] Create video from timelapse images

Post by torzdf »

I may move this to training discussion, as these are generated for training previews... but I can see an argument for both locations :/

Also, probably worth adding (may need to check, but pretty sure this is correct), that if you're within the faceswap environment (i.e. conda activate faceswap) then ffmpeg will be available in PATH. no need for extra installs/path manipulation.

My word is final


User avatar
Surrogator
Posts: 13
Joined: Sun Jul 14, 2019 11:39 pm
Has thanked: 2 times
Been thanked: 2 times

Re: [Script] Create video from timelapse images

Post by Surrogator »

torzdf wrote: Fri May 13, 2022 10:15 pm

if you're within the faceswap environment (i.e. conda activate faceswap) then ffmpeg will be available in PATH.

This checks out! I'm updating the original post.


Post Reply