Created
December 1, 2022 05:07
-
-
Save andrewhodel/a57f8fab9a032d30c5a836ccc56f260d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" | |
) | |
func main() { | |
if (len(os.Args) < 3) { | |
log.Fatal("set first argument as directory, second argument as ffmpeg") | |
} | |
var path = os.Args[1] | |
var ffmpeg = os.Args[2] | |
if (path == "./") { | |
log.Fatal("cwd must not be source directory") | |
} | |
fmt.Println("The speed needs to be fast, .05 is 20 times faster than normal and it is too slow to be impressive.") | |
fmt.Println("Timelapses always look best with large zoomed out views, or slowly changing things.") | |
files, err := ioutil.ReadDir(os.Args[1]) | |
if err != nil { | |
log.Fatal(err) | |
} | |
var grid_s = ffmpeg | |
var shrink = "" | |
for _, file := range files { | |
var n = file.Name() | |
fmt.Println(ffmpeg + " -y -nostdin -i \"" + path + "/" + n + "\" -filter:v \"setpts=0.02*PTS\" -an \"./" + n + "\"") | |
shrink += ffmpeg + " -y -nostdin -i \"./" + n + "\"" + " -s 1280x720 \"./small-" + n + "\"" + "\n" | |
grid_s += " -i \"./small-" + n + "\"" | |
} | |
grid_s += " -filter_complex \"[0:v][1:v][2:v]hstack=inputs=3[top];[3:v][4:v][5:v]hstack=inputs=3[mid];[6:v][7:v][8:v]hstack=inputs=3[bottom];[top][mid][bottom]vstack=inputs=3[v]\" -map \"[v]\" grid.mp4" | |
fmt.Println(shrink) | |
fmt.Println(grid_s) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment