2023. 2. 2.

AI를 이용해서 만든 간단한 ahk 움짤 제작기



input_file =
output_folder =
output_file =
start_time = 00:00:00.000
duration = 4
fps = 24
width = -1
height = 240

Gui, Add, Text, x10 y10 w100 h20, Input File:
Gui, Add, Edit, x120 y10 w400 h20 vinput_file, %input_file%
Gui, Add, Button, x520 y10 w100 h20 gButtonBrowse1, Browse...
Gui, Add, Text, x10 y40 w100 h20, Output Folder:
Gui, Add, Edit, x120 y40 w400 h20 voutput_folder, %output_folder%
Gui, Add, Button, x520 y40 w100 h20 gButtonBrowse2, Browse...
Gui, Add, Text, x10 y70 w100 h20, Output File:
Gui, Add, Edit, x120 y70 w400 h20 voutput_file, %output_file%
Gui, Add, Text, x10 y100 w100 h20, Start Time:
Gui, Add, Edit, x120 y100 w100 h20 vstart_time, %start_time%
Gui, Add, Text, x10 y130 w100 h20, Duration:
Gui, Add, Edit, x120 y130 w100 h20 vduration, %duration%
Gui, Add, Text, x10 y160 w100 h20, FPS:
Gui, Add, Edit, x120 y160 w100 h20 vfps, %fps%
Gui, Add, Text, x10 y190 w100 h20, Width:
Gui, Add, Edit, x120 y190 w100 h20 vwidth, %width%
Gui, Add, Text, x10 y220 w100 h20, Height:
Gui, Add, Edit, x120 y220 w100 h20 vheight, %height%
Gui, Add, Button, x120 y250 w100 h20 gButtonConvert, Convert
Gui, Show
return

ButtonBrowse1:
    FileSelectFile, input_file, , , Select Input File, *.mp4
    GuiControl,, input_file, %input_file%
    return

ButtonBrowse2:
    FileSelectFolder, output_folder, , Select Output Folder
    GuiControl,, output_folder, %output_folder%
    return

ButtonConvert:
    Gui, Submit, NoHide
    output_path = %output_folder%\%output_file%
    command = -ss %start_time% -t %duration% -i "%input_file%" -vf fps=%fps%,scale=%width%:%height%:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse "%output_path%"
    Run, cmd /c ffmpeg %command%
    MsgBox, Command ran successfully.
return


ChatGPT를 활용해 기본적인 틀을 잡고 디테일한 부분들은 수작업으로 수정한 코드.

확실히 큰 틀 잡아주는 건 잘 되는데 세세한 부분들에서 문법 오류를 일으켜서 수정을 해줘야했다. ffmpeg에는 없는 -to 옵션을 넣는다던가 -t 옵션이 -i 보다 앞에 가야되는데 뒤에 배치해뒀다던가. 커맨드 라인에서 변수표시%를 넣어야 하는데 빼먹었다던가. 그 외에도 gui에 변수 입력이 안되어 있는 등 몇몇 문제가 발생했었는데 그런 걸 감안해도 너무 너무 편하게 만들 수 있었다.

댓글 쓰기

Whatsapp Button works on Mobile Device only

Start typing and press Enter to search