qwertyegg
364 天前
下面这段 ahk 代码,"把 ffmpeg 加到 path 里面"和"mp4 文件不要带空格“两个要求满足的时候应该就可以批量转了
#Requires AutoHotkey v2.0
#SingleInstance Force
; Get list of files matching a prefix under a folder.
; Set prefix an empty string "" if we want all, otherwise add prefix to limit selection
prefix := ""
;=============== init script ===============
targetPattern := concat3("D:\captures\", prefix, "*.mp4")
video_files := []
loop files targetPattern
video_files.Push(A_LoopFileName)
lastIndex := video_files.Length
;;;;;;;;;;; F2 to cycle through rotation jobs
#MaxThreadsPerHotkey 1
F2::{
static counter := 1
while (counter <= lastIndex){
ffmpeg_rotate(video_files[counter])
counter := counter + 1
}
; MsgBox "That was the last, exit."
ExitApp
}
ffmpeg_rotate(video_file){
SetWorkingDir "D:\captures"
Run concat4("ffmpeg -display_rotation:v:0 90 -i ", video_file, " -c copy rotated_", video_file)
}
concat3(x, y, z) {
Return x y z
}
concat4(w, x, y, z) {
Return w x y z
}