the only good website on the internet
quaso.engineering
1include("ImageProcessing.jl")
2using .ImageProcessing
3
4percentage_position = 0.1
5
6function process_videos_recursive(dir::String)
7 for item in readdir(dir)
8 if item == ".DS_Store"
9 continue
10 end
11
12 path = joinpath(dir, item)
13
14 if isdir(path)
15 process_videos_recursive(path)
16 else
17 ext = lowercase(splitext(item)[2])
18
19 if ext in [".mp4", ".avi", ".mov", ".mkv", ".webm", ".m4v"]
20 output_name = splitext(item)[1] * ".png"
21 output_path = joinpath("static/video/thumb", output_name)
22
23 if isfile(output_path)
24 continue
25 end
26
27 try
28 extract_video_frame(path, output_path, percentage_position)
29 catch e
30 @error "Failed to process video" path error = e
31 end
32 end
33 end
34 end
35end
36
37function main(args::Vector{String})
38 mkpath("static/video/thumb")
39
40 for dir in args
41 process_videos_recursive(dir)
42 end
43end
44
45if abspath(PROGRAM_FILE) == @__FILE__
46 main(ARGS)
47end