AutoHotkey FFmpeg GUI for WebMs
WebM guide for retards in case you need it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | ; This is a FFmpeg GUI for making WebMs
; If you don't already have FFmpeg, go to https://ffmpeg.zeranoe.com/builds/ and download the STATIC version
; This script was made with AutoHotkey
; If you don't already have AutoHotkey, go to https://autohotkey.com/download/ and download it
; I recommend getting the portable version, but do whatever you want
; Save this script and put it in ffmpeg's bin folder (where ffmpeg.exe and ffplay.exe are)
; You can create a shortcut to the script and put it in the desktop if that is more comfortable for you
; It only works on Windows. I assume Linux users don't need GUIs
; Quick mini-tutorial: http://puu.sh/qAf2I/4a45131f4a.webm
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
;============================================================;
;============================================================;
startx := 10 ; default is 10
starty := 3 ; default is 6
col_1 := startx
col_2 := col_1+105
row_1 := starty
row_2 := row_1+27
row_3 := row_2+27
row_4 := row_3+27
row_5 := row_4+27
row_6 := row_5+27
row_7 := row_6+27
row_8 := row_7+27
row_9 := row_8+27
row_10 := row_9+27
row_11 := row_10+27
row_12 := row_11+27
row_13 := row_12+27
row_14 := row_13+27
row_15 := row_14+27
row_16 := row_15+27
row_17 := row_16+27
row_18 := row_17+27
row_19 := row_18+27
; Rows are for the edit boxes and buttons, which are 6 pixels taller than the text, 3 for top and 3 for bottom
; Edit boxes and buttons are both 20 pixels tall
; Buttons are placed 1 unit further than specified. If you tell it 10, it will be placed at 11
;============================================================;
;============================================================;
IniRead, def_Bitrate, FFmpeg_GUI_settings.ini, QUALITY, def_Bitrate, %A_Space%
IniRead, def_qmax, FFmpeg_GUI_settings.ini, QUALITY, def_qmax, %A_Space%
IniRead, def_Framerate, FFmpeg_GUI_settings.ini, QUALITY, def_Framerate, same as input
IniRead, def_Threads, FFmpeg_GUI_settings.ini, ENCODING, def_Threads, 3
IniRead, def_CT, FFmpeg_GUI_settings.ini, FILTERS, def_CT, 0
IniRead, def_CB, FFmpeg_GUI_settings.ini, FILTERS, def_CB, 0
IniRead, def_CL, FFmpeg_GUI_settings.ini, FILTERS, def_CL, 0
IniRead, def_CR, FFmpeg_GUI_settings.ini, FILTERS, def_CR, 0
IniRead, def_Size_X, FFmpeg_GUI_settings.ini, FILTERS, def_Size_X, %A_Space%
IniRead, def_Size_Y, FFmpeg_GUI_settings.ini, FILTERS, def_Size_Y, %A_Space%
IniRead, def_Audio_quality, FFmpeg_GUI_settings.ini, QUALITY, def_Audio_quality, 0
IniRead, def_Audio_channels, FFmpeg_GUI_settings.ini, QUALITY, def_Audio_channels, same as input
IniRead, def_Audio_samples, FFmpeg_GUI_settings.ini, QUALITY, def_Audio_samples, same as input
goto drag_drop
;============================================================;
;============================================================;
drag_drop:
Gui, add, text,w280 +Center, Drag and drop your file on this window
Gui, show, w300 h300
return
GuiDropFiles:
input_file_path = %A_GuiEvent%
SplitPath, input_file_path,, input_file_directory,,input_file_name
Gui, Destroy
goto OptionsWindow
Return
;============================================================;
;============================================================;
OptionsWindow:
Gui, font, underline
Gui, add, text, cBlue gOpenInput, Input file: %input_file_path%
Gui, font
Gui, add, text,, Metadata Title
Gui, add, text,, Trim Start
Gui, add, text,, Trim Duration
Gui, add, text,, Bitrate (Kb/s)
Gui, add, text,, Max quantizer
Gui, add, text,, Framerate
Gui, add, text,, Threads
Gui, add, text,, Crop top
Gui, add, text,, Crop bottom
Gui, add, text,, Crop left
Gui, add, text,, Crop right
Gui, add, text,, Size horiz
Gui, add, text,, Size vert
Gui, add, text,, Extra filters
Gui, add, text,, Audio quality
Gui, add, text,, Audio channels
Gui, add, text,, Audio sample rate
Gui, add, edit, x100 y%row_2% w390 h20 vMeta_Title, %input_file_name%
Gui, add, edit, x100 y%row_3% w100 vTrim_Start
Gui, add, edit, x100 y%row_4% w100 vTrim_Duration
Gui, add, edit, x100 y%row_5% w100 vBitrate, %def_Bitrate%
Gui, add, edit, x100 y%row_6% w100 vqmax, %def_qmax%
Gui, add, edit, x100 y%row_7% w100 vFramerate, %def_Framerate%
Gui, add, edit, x100 y%row_8% w100 vThreads, %def_Threads%
Gui, add, text, x%col_1% y215 w480 0x10 ; horizontal line
Gui, add, text, x%col_1% y216 w480 0x10 ; horizontal line
Gui, add, edit, x100 y%row_9% w100 vCT, %def_CT%
Gui, add, edit, x100 y%row_10% w100 vCB, %def_CB%
Gui, add, edit, x100 y%row_11% w100 vCL, %def_CL%
Gui, add, edit, x100 y%row_12% w100 vCR, %def_CR%
Gui, add, edit, x100 y%row_13% w100 vSize_X, %def_Size_X%
Gui, add, edit, x100 y%row_14% w100 vSize_Y, %def_Size_Y%
Gui, add, edit, x100 y%row_15% w390 vExtra_Filters
Gui, add, text, x%col_1% y404 w480 0x10 ; horizontal line
Gui, add, text, x%col_1% y405 w480 0x10 ; horizontal line
Gui, add, edit, x100 y%row_16% w100 vAudio_quality, %def_Audio_quality%
Gui, add, edit, x100 y%row_17% w100 vAudio_channels, %def_Audio_channels%
Gui, add, edit, x100 y%row_18% w100 vAudio_samples, %def_Audio_samples%
Gui, add, text, x%col_1% y485 w480 0x10 ; horizontal line
Gui, add, text, x%col_1% y486 w480 0x10 ; horizontal line
Gui, add, button, x210 y%row_5% h21 gdef_Bitrate, Make default
Gui, add, button, x210 y%row_6% h21 gdef_qmax, Make default
Gui, add, button, x210 y%row_7% h21 gdef_Framerate, Make default
Gui, add, button, x210 y%row_8% h21 gdef_Threads, Make default
Gui, add, button, x210 y%row_9% h21 gdef_CT, Make default
Gui, add, button, x210 y%row_10% h21 gdef_CB, Make default
Gui, add, button, x210 y%row_11% h21 gdef_CL, Make default
Gui, add, button, x210 y%row_12% h21 gdef_CR, Make default
Gui, add, button, x210 y%row_13% h21 gdef_Size_X, Make default
Gui, add, button, x210 y%row_14% h21 gdef_Size_Y, Make default
Gui, add, button, x210 y%row_16% h21 gAudio_quality, Make default
Gui, add, button, x210 y%row_17% h21 gAudio_channels, Make default
Gui, add, button, x210 y%row_18% h21 gAudio_samples, Make default
Gui, add, checkbox, x10 y%row_19% vApply_Filters, Check this if you want to apply filters (cropping, resizing, etc.)
Gui, add, checkbox, x10 vEnable_audio, Check this if you want to enable audio
Gui, add, button, x10 w240 h50 gffmpeg, Execute the ffmpeg command
Gui, add, button, x250 y527 w240 h25 gPreviewWebm, Preview the WebM
Gui, add, button, x250 y552 w240 h25 gOpenWebm, Open the WebM
Gui, add, text, x10, The WebM will have the same name as the input and will be placed in the same directory.
Gui, add, text,+Wrap w480, If the command prompt fails to open, the FFmpeg command will be on your clipboard, so open the command prompt, paste the command and then press enter.
Gui, add, button, x10 w480 ginfo, INFO
Gui, add, link,, <a href="http://pastebin.com/NXzfdja7">Source code / update</a>
Gui, show, w500, ffmpeg for retards
return
;============================================================;
;============================================================;
OpenInput:
run, %input_file_path%
return
;============================================================;
;============================================================;
PreviewWebm:
Gui, submit, nohide
if (Trim_Start != "" && Trim_Duration != ""){
ffmpeg_preview = ffplay -ss %Trim_Start% -i "%input_file_path%"
ffmpeg_preview = %ffmpeg_preview% -t %Trim_Duration%
} else {
ffmpeg_preview = ffplay -i "%input_file_path%"
}
if (Apply_Filters){
ffmpeg_filters = crop=iw-%CL%-%CR%:ih-%CT%-%CB%:%CL%:%CT%
if (Size_X && !Size_Y){
ffmpeg_filters = %ffmpeg_filters%,scale=%Size_X%:-1
}
if (Size_Y){
ffmpeg_filters = %ffmpeg_filters%,scale=-1:%Size_Y%
}
if (Extra_Filters){
ffmpeg_filters = %ffmpeg_filters%,%Extra_Filters%
}
ffmpeg_preview = %ffmpeg_preview% -vf "%ffmpeg_filters%"
}
if !(Enable_audio){
ffmpeg_preview := ffmpeg_preview . " -an"
}
clipboard := ffmpeg_preview
run, %comspec% /k %ffmpeg_preview%
return
;============================================================;
;============================================================;
ffmpeg:
Gui, submit, nohide
if (Trim_Start != "" && Trim_Duration != ""){
ffmpeg_command = ffmpeg -ss %Trim_Start% -i "%input_file_path%"
ffmpeg_command = %ffmpeg_command% -t %Trim_Duration%
} else {
ffmpeg_command = ffmpeg -i "%input_file_path%"
}
ffmpeg_command := ffmpeg_command . " -c:v libvpx -threads " . Threads . " -quality good -cpu-used 0 -lag-in-frames 16 -auto-alt-ref 1 -qcomp 1"
if (Bitrate != ""){
ffmpeg_command := ffmpeg_command . " -b:v " . Bitrate . "K"
}
if (qmax != ""){
ffmpeg_command := ffmpeg_command . " -qmax " . qmax
}
;==============================;
if (Apply_Filters){
if (CT = "")
{
CT=0
}
if (CB = "")
{
CB=0
}
if (CL = "")
{
CL=0
}
if (CR = "")
{
CR=0
}
ffmpeg_filters = crop=iw-%CL%-%CR%:ih-%CT%-%CB%:%CL%:%CT%
if (Size_X && !Size_Y){
ffmpeg_filters = %ffmpeg_filters%,scale=%Size_X%:-1
}
if (Size_Y){
ffmpeg_filters = %ffmpeg_filters%,scale=-1:%Size_Y%
}
if (Extra_Filters){
ffmpeg_filters = %ffmpeg_filters%,%Extra_Filters%
}
ffmpeg_command = %ffmpeg_command% -vf "%ffmpeg_filters%"
}
if (Enable_audio){
if (Audio_quality = ""){
Audio_quality=0
}
ffmpeg_command := ffmpeg_command . " -c:a libvorbis -qscale:a " . Audio_quality
if (Audio_channels != "same as input" && Audio_channels != ""){
ffmpeg_command := ffmpeg_command . " -ac " . Audio_channels
}
if (Audio_samples != "same as input" && Audio_samples != ""){
ffmpeg_command := ffmpeg_command . " -ar " . Audio_samples
}
} else {
ffmpeg_command := ffmpeg_command . " -an"
}
;;==============================;;
if (Framerate != "same as input"){
ffmpeg_command := ffmpeg_command . " -r " . Framerate
}
ffmpeg_command = %ffmpeg_command% -metadata title="%Meta_Title%"
ffmpeg_command := ffmpeg_command . " -sn -y -f webm"
clipboard = %ffmpeg_command% -pass 1 NUL && %ffmpeg_command% -pass 2 "%input_file_directory%\%input_file_name%.webm" && del ffmpeg2pass-0.log
run, %comspec% /k %ffmpeg_command% -pass 1 NUL && %ffmpeg_command% -pass 2 "%input_file_directory%\%input_file_name%.webm" && del ffmpeg2pass-0.log
return
;============================================================;
;============================================================;
OpenWebm:
ifExist, %input_file_directory%\%input_file_name%.webm
run, %input_file_directory%\%input_file_name%.webm
return
;============================================================;
;============================================================;
info:
info =
(
First of all, if you don't want to use a certain function, leave it blank.
If there is any problem with this script or if you have any suggestions, send me a message at my pastebin http://pastebin.com/u/thisisthepastebinuse
Quick mini-tutorial: http://puu.sh/qAf2I/4a45131f4a.webm
=============================================================================
Metadata Title
4chanX allows users to see the title metadata of a video file. This means that you can put the source of your chinese cartoons there so that other anons don't spam the thread with SAUCE, though they'll do it anyway.
Trim Start and Trim Duration
If your input video file is too long, you might want to trim it to make it shorter. Trim Start is the point at which FFmpeg will start encoding the WebM, and Trim Duration is the duration of the WebM. The starting point could be 2:12.257, for example, and the duration could be 12 or 1:28. As you can see, you can either use either seconds or the full HH:MM:SS.MIL notation when defining the starting point or the duration of the trim.
Bitrate
This is the target bitrate of the WebM. How do you know what bitrate your video should have? Use the following formula:
FileSize*8/Time
FileSize is in KB and time is in seconds. If I want a 3000 kB WebM which is 15 seconds long, its target bitrate would be 3000*8/15 = 1600 KB.
Max quantizer
This can be a number from 0 to 63. The lower this number, the better the image quality you will get.
Framerate
The framerate of your WebM. Don't touch this if you don't want to change the framerate of the original video.
Threads
The number of threads you want to use when encoding, can't be 0 (auto) with VP8. It is recommended to use the number of real cores - 1. I assume most people have a 4 core CPU, so the default value is 3.
=============================================================================
Crop top/bottom/left/right
As its name indicates, this will crop your video file. Useful for getting rid of the letterbox some videos have.
Size horix/vert
The size of your WebM. Be careful, you only want to define one of the sizes, not both of them. If you write the hrizontal size of your video, the vertical size will be automatically calculated in order to keep the aspect ratio of your video. If you write the vertical size of your WebM, the horizontal one will be automatically calculated according to the aspect ratio of the input file.
Extra filters
Let's say you want to rotate your video file counterclockwise. You would have to write "transpose=cclock" in the input box, without the quotes, obviously. If you want to transpose and then do something else, you have to separate the filters by a comma, like this: "transpose=cclock,another=filter", without the quotes.
In order to apply the cropping, resizing and other filters, you need to check the checkbox under "Extra filters".
=============================================================================
Audio quality
Values from 0 to 10. 10 is the best quality and 0 is the worst. You'll pretty much never need a quality higher than 2.
Audio channels
2 is stereo, 1 is mono. Anything more than 2 is overkill for 4chan.
Audio sample rate
Don't touch this if you don't know what a sampling rate is.
In order to apply the audio settings and get a WebM with sound, you need to check the appropiate checkbox.
=============================================================================
4chan WebM limits
/wsg/ and /gif/: 4096 KB, 300 seconds (5 min), 2048x2048 pixels, sound allowed
other boards: 3072 KB, 120 seconds (2 min), 2048x2048 pixels, no sound allowed
Documentation
http://wiki.webmproject.org/ffmpeg
https://trac.ffmpeg.org/wiki/Encode/VP8
https://www.ffmpeg.org/ffmpeg.html
https://www.ffmpeg.org/ffmpeg-codecs.html#libvpx
https://www.webmproject.org/docs/encoder-parameters/
https://wiki.installgentoo.com/index.php/WebM
A guide made by Anon for /wsg/:
http://i.imgur.com/5o2yTYc.png
http://4chandata.org/wsg/WebM-Academy-a810990
)
GUI, 2:add, Edit, w480 h700 -E0x200 +Readonly, %info%
GUI, 2:show, w500, INFO
return
;============================================================;
;============================================================;
; This section writes the values from the boxes to the ini file when the user presses the "Make default" button
def_Bitrate:
Gui, submit, nohide
IniWrite, %Bitrate%, FFmpeg_GUI_settings.ini, QUALITY, def_Bitrate
return
def_qmax:
Gui, submit, nohide
IniWrite, %qmax%, FFmpeg_GUI_settings.ini, QUALITY, def_qmax
return
def_Framerate:
Gui, submit, nohide
IniWrite, %Framerate%, FFmpeg_GUI_settings.ini, QUALITY, def_Framerate
return
def_Threads:
Gui, submit, nohide
IniWrite, %Threads%, FFmpeg_GUI_settings.ini, ENCODING, def_Threads
return
def_CT:
Gui, submit, nohide
IniWrite, %CT%, FFmpeg_GUI_settings.ini, FILTERS, def_CT
return
def_CB:
Gui, submit, nohide
IniWrite, %CB%, FFmpeg_GUI_settings.ini, FILTERS, def_CB
return
def_CL:
Gui, submit, nohide
IniWrite, %CL%, FFmpeg_GUI_settings.ini, FILTERS, def_CL
return
def_CR:
Gui, submit, nohide
IniWrite, %CR%, FFmpeg_GUI_settings.ini, FILTERS, def_CR
return
def_Size_X:
Gui, submit, nohide
IniWrite, %Size_X%, FFmpeg_GUI_settings.ini, FILTERS, def_Size_X
return
def_Size_Y:
Gui, submit, nohide
IniWrite, %Size_Y%, FFmpeg_GUI_settings.ini, FILTERS, def_Size_Y
return
Audio_quality:
Gui, submit, nohide
IniWrite, %Audio_quality%, FFmpeg_GUI_settings.ini, QUALITY, def_Audio_quality
return
Audio_channels:
Gui, submit, nohide
IniWrite, %Audio_channels%, FFmpeg_GUI_settings.ini, QUALITY, def_Audio_channels
return
Audio_samples:
Gui, submit, nohide
IniWrite, %Audio_samples%, FFmpeg_GUI_settings.ini, QUALITY, def_Audio_samples
return
|