Page 1 of 1

[Script] Create video from timelapse images

Posted: Fri May 13, 2022 3:59 am
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 33195 times

Re: [Script] Create video from timelapse images

Posted: Fri May 13, 2022 10:15 pm
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.


Re: [Script] Create video from timelapse images

Posted: Sun May 15, 2022 1:59 pm
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.