-
Notifications
You must be signed in to change notification settings - Fork 2
/
Datamosh Den.ahk
2043 lines (1647 loc) · 63.3 KB
/
Datamosh Den.ahk
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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;Datamosh ToolKit AHk Edition
;Joining the powers of FFmpeg, MEncoder and Tomato into one <3
;Thrown together by yours Truly, Pandela
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
#Include config\GetCodecs.ahk ; Populate the MEncoder and FFmpeg Codec lists!!! <3
;Custom GUI for baking yo files.
BakeGUI() {
WinWaitClose, cmd
Gui, 3:Color, DDCEE9
Gui, 3:Add, Button, x10 y66 w35 h24 gPlsBakeYUV, YUV
Gui, 3:Add, Button, x46 y66 w35 h24 gPlsBakeMP4, MP4
Gui, 3:Add, Button, x82 y66 w35 h24 gPlsBakePNG, PNG
Gui, 3:Add, Button, x118 y66 w35 h24 Default gNoReBake, Nah
Gui, 3:Add, Text, x2 y2 w162 h63, `n Would ulike to get Baked? `n(Makes the Video compatible with FFmpeg, and maybe larger.)
Gui, 3:Show, w162 h100,To Bake`, or Not To Bake?
Gui, 3:-Sysmenu
WinWaitClose, To Bake`, or Not To Bake?
}
AMV2GUI() {
WinWaitClose, cmd
Gui, 3:Color, DDCEE9
Gui, 3:Add, Button, x10 y66 w35 h24 gAMV2Preset640, 640
Gui, 3:Add, Button, x46 y66 w35 h24 gAMV2Preset1280, 1280
Gui, 3:Add, Button, x82 y66 w35 h24 gOption4k, 4K
Gui, 3:Add, Button, x118 y66 w35 h24 Default gOptionNone, Nah
Gui, 3:Add, Text, x2 y-2 w162 h66, `n Would ulike to Remove The Watermark? `n (In case ur cheap like me and don't wanna pay for this codec.) ;yet
Gui, 3:Show, w162 h100,AMV2 Watermark Removal Hack
Gui, 3:-Sysmenu
WinWaitClose, AMV2 Watermark Removal Hack
}
;Input, Forced Options and Extra Filter GUI Stuff
Gui, Color, DDCEE9
pic := A_ScriptDir . "\config\Background.png"
Gui, Add, Pic, x0 y0 w486 h363 vBack, %pic%
;I HAD TO MOVE THE GUI PIC BACKGROUND PLACEMENT HERE TO MAKE IT WORK!!!
Gui Add, GroupBox, x154 y10 w314 h83 ,
Gui Add, Button, x165 y34 w44 h43 gSelectSource, Source
Gui Add, Edit, x285 y45 w63 h21 +Center vResolutionVar, 640x360
Gui Add, Text, x291 y29 w49 h14 +0x200 +BackgroundTrans, Resolution
Gui Add, Edit, x361 y45 w30 h21 +Center vFrameRateVar, 60
Gui Add, Text, x366 y29 w22 h14 +0x200 +BackgroundTrans, FPS
Gui Add, CheckBox, x311 y70 w10 h12 gEnableForceRes vForceRes, CheckBox
Gui Add, CheckBox, x371 y70 w10 h12 gEnableForceRate vForceRate, CheckBox
Gui Add, CheckBox, x237 y43 w10 h12 gBatchInputMessage vIsBatchInput, CheckBox
Gui Add, Text, x216 y28 w55 h14 +BackgroundTrans, Batch Input
Gui Add, CheckBox, x237 y70 w10 h12 gEnableOtherOptions vIsOtherOptionsOn, CheckBox
Gui Add, Text, x219 y56 w65 h14 +BackgroundTrans, Extra Stuff
Gui Add, Button, x406 y31 w47 h21 gMakeChexrGui, Hex Edit
Gui Add, Button, x406 y52 w47 h28 gForceBake, Force Bake
;MEncoder GUI Stuff
Gui Add, GroupBox, x17 y97 w168 h125 ,
Gui Add, ComboBox, x37 y184 w120 vMencoderCodecs Choose6, %CodecList%
Gui Add, Edit, x37 y136 w120 h21 vMEncoderOptions, -nosound -noskip
Gui Add, Text, x52 y120 w90 h15 +0x200 +BackgroundTrans, MEncoder Options
Gui Add, CheckBox, x47 y159 w104 h23 vRescaleMEncoderCodec hWndRescaleMEncoderCodec, Attempt Rescale?
Gui Add, Button, x158 y183 w22 h23 vMEncoderCompression gPreMEncoderCompression, GO
;FFmpeg GUI Stuff
Gui Add, GroupBox, x17 y226 w168 h125 ,
Gui Add, ComboBox, x39 y314 w120 vFFmpegCodecs, %FFEncoderList%
Gui Add, Edit, x38 y266 w120 h21 vFFmpegOptions, -bf 0 -g 999999 -an
Gui Add, Text, x60 y250 w90 h15 +BackgroundTrans, FFmpeg Options
Gui Add, Button, x158 y265 w22 h23 vFFGetOptions gListCodecOptions, ?
Gui Add, Button, x159 y313 w22 h23 vFFmpegCompression gPreFFmpegCompression, GO
Gui Add, Slider, x19 y289 w164 h18 Range0-1000 vVideoQuality gVideoQualitySlider AltSubmit, 10
;Tomato GUI Stuff
Gui Add, GroupBox, x198 y97 w270 h254,
Gui Add, ComboBox, x265 y171 w120 Choose7 vTomatoMode, irep|ikill|iswap|bloom|pulse|shuffle|overlapped|jiggle|reverse|invert|void
Gui Add, Edit, x303 y217 w41 h21 vTomatoFrameCount +Center, 4
Gui Add, Edit, x303 y264 w41 h21 vTomatoFramePosition +Center, 2
Gui Add, Text, x293 y195 w62 h23 +0x200 +BackgroundTrans, Frame Count
Gui Add, Text, x288 y242 w71 h23 +0x200 +BackgroundTrans, Frame Position
Gui Add, Text, x282 y148 w81 h23 +0x200 +BackgroundTrans, Datamosh Mode
Gui Add, Button, x269 y289 w110 h46 vTomatoMOSHIT gCommenceTomatoDatamosh -E0x200 BackgroundTrans -Border, DATAMOSH IT
WinSet, Region, % "0-0" "W" 110-1 " " "H" 46-1 R10-10, DATAMOSH IT
GuiControl, Move, TomatoMOSHIT, w110-2 h46-2 x269-1 y289-1
;Trying to remove the button borders :(
;WinSet, Region, Region, 1-1 W200 H150, DATAMOSH IT
;GuiControl, Move, TomatoMOSHIT, % "x" 269 " y" 289 " w" 110 - 1
Gui Add, Button, x387 y289 w65 h46 vReCompress gReCompressMoshedOutput, Recompress
Gui Add, Button, x214 y289 w48 h46 vTomatoRecycle gRecycleTomatoOutput, Remosh
Gui Add, Button, x438 y111 w23 h23 vTomatoHalpButton gTomatoHalp, ?
Gui Add, CheckBox, x227 y123 w13 h22 vPythonLocationIsOn gEnableForcePythonLocation, CheckBox
Gui Add, Text, x205 y110 w65 h13, Force Python
;Compress with FFmpeg or MEncoder GUI Radio elements
Gui Add, Radio, x168 y106 w15 h16 gEnableME vEnableMEncoderCodec Checked
Gui Add, Radio, x168 y235 w15 h16 gEnableFF vEnableFFmpegCodec
;WebCam GUI Stuff
Gui Add, GroupBox, x17 y10 w127 h83 +0x300,
Gui Add, ComboBox, x22 y28 w117 vWebCamName, %DeviceList%
Gui Add, Button, x21 y55 w50 h31 gGetDevices, List Devices
Gui Add, Button, x90 y55 w50 h31 gSelectWebcam, Use Device
;Disable some stuff by default.
GuiControl, 1:Disable, FFmpegCodecs
GuiControl, 1:Disable, FFmpegOptions
GuiControl, 1:Disable, FFGetOptions
GuiControl, 1:Disable, FFmpegCompression
GuiControl, 1:Disable, VideoQuality
GuiControl, 1:Disable, TomatoMode
GuiControl, 1:Disable, TomatoFrameCount
GuiControl, 1:Disable, TomatoFramePosition
GuiControl, 1:Disable, TomatoMOSHIT
GuiControl, 1:Disable, TomatoRecycle
GuiControl, 1:Disable, ResolutionVar
GuiControl, 1:Disable, FrameRateVar
GuiControl, 1:Disable, Recompress
WebcamSource := ""
isBatchFilename := 0
RecompressVar := "MEncoder" ;Default Compressor.
BatchInputHelpMsg := 1 ;Display help msg once once every startup.
GlobalResolutionVar := 0 ;Needed this in order for the Extra Options to work correctly.
ReverseDecompression := 0
ReverseOnce := 1
isRecompressed := 0
WebcamCompression := "0"
AllowChexr := 0
Gui Show, w485 h363, Datamosh Den - Ver 1.8.6 (Beta)
;Check if newer MEncoder package is in folder, if so extract it.
#Include config\GetFFmpeg.ahk
#Include config\GetDifference.ahk
#Include config\UseChexr.ahk
Return
EnableOtherOptions:
GuiControlGet, IsOtherOptionsOn
if (IsOtherOptionsOn = 1) {
global UseOtherOptions = 1
gosub, OtherOptions
}
if (IsOtherOptionsOn = 0) {
msgbox, Disabled Extra Options :(
global UseOtherOptions = 0
global EncHori := 0
global EncVert := 0
global EncTrans := 0
global EncRev := 0
global EncInv := 0
global EncHue := 0
global DecHori := 0
global DecVert := 0
global DecTrans := 0
global DecRev := 0
global DecInv := 0
global DecHue := 0
global ReverseCompression := 0
global EncodeReversibleFilterVal := ""
global DecodeReversibleFilterVal := ""
}
Return
#Include %A_ScriptDir%\config\AutoXYWH.ahk
OtherOptions:
EncodeReversibleFilterVal := "" ;Reset Filter Vals
DecodeReversibleFilterVal := "" ;Reset Filter Vals
Gui, New ;Needed for AutoXYWH.ahk to work on a second GUI window.
Gui, Color, DDCEE9
Gui +Resize
Gui Add, CheckBox, x12 y28 w120 h23 vEncHori, Horizontal Flip
Gui Add, CheckBox, x136 y28 w120 h23 +0x220 vDecHori, Horizontal Flip
Gui Add, CheckBox, x12 y53 w120 h23 vEncVert, Vertical Flip
Gui Add, CheckBox, x136 y53 w120 h23 +0x220 vDecVert, Vertical Flip
Gui Add, CheckBox, x12 y78 w120 h23 vEncTrans, Transpose
Gui Add, CheckBox, x136 y78 w120 h23 +0x220 vDecTrans, Transpose
Gui Font, s9 Underline, Verdana
Gui Add, Text, x12 y2 w120 h23 +0x200, Encoding Filters:
Gui Font
Gui Font, s9 Underline, Verdana
Gui Add, Text, x136 y2 w120 h23 +0x200 +0x2, Decoding Filters:
Gui Font
Gui Add, CheckBox, x12 y103 w60 h23 vEncRev, Reverse
Gui Add, CheckBox, x196 y103 w60 h23 +0x220 vDecRev, Reverse
Gui Add, CheckBox, x12 y153 w42 h23 vEncHue gEnableHueSlider, Hue
Gui Add, CheckBox, x215 y153 w41 h23 +0x220 vDecHue, Hue
Gui Add, CheckBox, x12 y128 w60 h23 vEncInv, Invert
Gui Add, CheckBox, x196 y128 w60 h23 +0x220 vDecInv, Invert
Gui Add, Edit, hWndhEdtValue2 x153 y241 w109 h60 vCustomDecodeFilterVal
Gui Font, s8, Georgia
Gui Add, Text, x10 y208 w95 h31 +Disabled, Custom Encode`n Filter:
Gui Font
Gui Add, CheckBox, x26 y222 w13 h13 vEnableCustomEncodeWindowVar gEnableCustomEncodeWindow +Disabled, CheckBox
Gui Add, Edit, hWndhEdtValue x5 y241 w109 h60 vCustomEncodeFilterVal
Gui Font, s8, Georgia
Gui Add, Text, x161 y208 w95 h31 +Disabled, Custom Decode`n Filter:
Gui Add, CheckBox, x177 y223 w13 h13 vEnableCustomDecodeWindowVar gEnableCustomDecodeWindow +Disabled, CheckBox
Gui Font
gosub, EnableForceRes
huh = oshitwaddupyowhatareudoingtodayimdoingjustdandythanksforaskinglolihopeyouhaveawonderfuldaykthxbaikmsroflmao
GuiControl, Disable, CustomDecodeFilterVal
GuiControl, Disable, CustomEncodeFilterVal
;Gui Add, Button, x93 y169 w81 h28 gCloseExtraOptions, Submit
Gui Add, Button, x93 y148 w81 h27 gCloseExtraOptions, Submit
GuiControlGet, ForceResVar,,ForceRes
;Close GUI after hitting ENTER Key
OnMessage(0x100, "OnKeyDown")
OnKeyDown(wParam)
{
;had to add these globals here in order for the values to be available to the function. idk another way at the moment.
global EncHori
global EncVert
global EncTrans
global EncRev
global EncInv
global EncHue
global DecHori
global DecVert
global DecTrans
global DecRev
global DecInv
global DecHue
global RecompressVar
global EncodeReversibleFilterVal
global DecodeReversibleFilterVal
global ResolutionVar
global ForceResVar
global ReverseCompression
IfWinActive, Extra ;The second GUI windows name.
{
if (wParam = 13) ;This is the Enter Key Param
{
Gui, Submit, NoHide
msgbox, Using the selected %RecompressVar% Filters!
Gui, Destroy
}
}
}
Gui -sysmenu
Gui Show, w267 h305, Extra Options - Press The Enter Key When Done`n-%huh%
Gui, +MinSize +MinSize267x ;Limit the how small option the window gets :3
Return
CloseExtraOptions:
Gui, Submit, NoHide
msgbox, Using the selected %RecompressVar% Filters!
Gui, Destroy
Return
EnableCustomEncodeWindow:
GuiControlGet, EnableCustomEncodeWindowVar
if (EnableCustomEncodeWindowVar = 0) {
GuiControl, Disable, CustomEncodeFilterVal
}
if (EnableCustomEncodeWindowVar = 1) {
GuiControl, Enable, CustomEncodeFilterVal
}
Return
EnableCustomDecodeWindow:
GuiControlGet, EnableCustomDecodeWindowVar
if (EnableCustomDecodeWindowVar = 0) {
GuiControl, Disable, CustomDecodeFilterVal
}
if (EnableCustomDecodeWindowVar = 1) {
GuiControl, Enable, CustomDecodeFilterVal
}
Return
GuiSize: ;Resize the custom filter edit box natively with the GUI size.
If (A_EventInfo == 0) {
Return
}
GuiControlGet, EnableCustomEncodeWindowVar
if (EnableCustomEncodeWindowVar = 1) {
AutoXYWH("wh*", hEdtValue)
}
GuiControlGet, EnableCustomDecodeWindowVar
if (EnableCustomDecodeWindowVar = 1) {
AutoXYWH("wh*", hEdtValue2)
}
Return
GetFilters:
;Horizontal Filters
if (EncHori = 0) {
;EncodeReversibleFilterVal := ""
}
if (EncHori = 1) && (RecompressVar = "MEncoder") {
EncodeReversibleFilterVal .= "," . "mirror"
}
if (EncHori = 1) && (RecompressVar = "FFmpeg") {
EncodeReversibleFilterVal .= "," . "hflip"
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
if (DecHori = 0) {
;DecodeReversibleFilterVal := ""
}
if (DecHori = 1) && (RecompressVar = "MEncoder") {
DecodeReversibleFilterVal .= "," . "mirror"
}
if (DecHori = 1) && (RecompressVar = "FFmpeg") {
DecodeReversibleFilterVal .= "," . "mirror"
}
;Vertical Filters
if (EncVert = 0) {
;EncodeReversibleFilterVal := ""
}
if (EncVert = 1) && (RecompressVar = "MEncoder") {
EncodeReversibleFilterVal .= "," . "flip"
}
if (EncVert = 1) && (RecompressVar = "FFmpeg") {
EncodeReversibleFilterVal .= "," . "vflip"
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
if (DecVert = 0) {
;DecodeReversibleFilterVal := ""
}
if (DecVert = 1) && (RecompressVar = "MEncoder") {
DecodeReversibleFilterVal .= "," . "flip"
}
if (DecVert = 1) && (RecompressVar = "FFmpeg") {
DecodeReversibleFilterVal .= "," . "flip"
}
;Transpose Filters
if (EncTrans = 0) {
;EncodeReversibleFilterVal := ""
}
if (EncTrans = 1) && (RecompressVar = "MEncoder") {
EncodeReversibleFilterVal .= "," . "rotate=0"
}
if (EncTrans = 1) && (RecompressVar = "FFmpeg") {
EncodeReversibleFilterVal .= "," . "transpose=0"
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
if (DecTrans = 0) {
;DecodeReversibleFilterVal := ""
}
if (DecTrans = 1) && (EncVert = 0) && (EncHori = 0) && (RecompressVar = "MEncoder") else if (RecompressVar = "FFmpeg") {
DecodeReversibleFilterVal .= "," . "rotate=0"
}
if (DecTrans = 1) && (EncVert = 1) && (EncHori = 1) && (RecompressVar = "MEncoder") else if (RecompressVar = "FFmpeg") {
DecodeReversibleFilterVal .= "," . "rotate=1" ;FFmpeg version is transpose=0
}
if (DecTrans = 1) && (EncVert = 0) && (EncHori = 1) && (RecompressVar = "MEncoder") else if (RecompressVar = "FFmpeg") {
DecodeReversibleFilterVal .= "," . "rotate=2" ;FFmpeg version is transpose=0
}
if (DecTrans = 1) && (EncVert = 1) && (EncHori = 0) && (RecompressVar = "MEncoder") else if (RecompressVar = "FFmpeg") {
DecodeReversibleFilterVal .= "," . "rotate=2" ;FFmpeg version is transpose=0
}
;Reverse Filters.
if (EncRev = 0) {
;EncodeReversibleFilterVal := ""
}
if (EncRev = 1) && (RecompressVar = "MEncoder") {
EncodeReversibleFilterVal .= "," . "scale"
}
if (EncRev = 1) && (RecompressVar = "FFmpeg") {
EncodeReversibleFilterVal .= "," . "reverse"
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
if (DecRev = 0) {
;DecodeReversibleFilterVal := ""
}
if (DecRev = 1) && (RecompressVar = "MEncoder") {
DecodeReversibleFilterVal .= "," . "scale"
}
if (DecRev = 1) && (RecompressVar = "FFmpeg") {
DecodeReversibleFilterVal .= "," . "reverse"
}
;Invert Filters
if (EncInv = 0) {
;EncodeReversibleFilterVal := ""
}
if (EncInv = 1) && (RecompressVar = "MEncoder") {
EncodeReversibleFilterVal .= "," . "eq2=0:-1:0,scale"
}
if (EncInv = 1) && (RecompressVar = "FFmpeg") {
EncodeReversibleFilterVal .= "," . "eq=-1"
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
if (DecInv = 0) {
;DecodeReversibleFilterVal := ""
}
if (DecInv = 1) && (RecompressVar = "MEncoder") {
DecodeReversibleFilterVal .= "," . "eq2=0:-1:0,scale"
}
if (DecInv = 1) && (RecompressVar = "FFmpeg") {
DecodeReversibleFilterVal .= "," . "eq2=0:-1:0,scale"
}
;Hue Filters
if (EncHue = 0) {
;EncodeReversibleFilterVal := ""
}
if (EncHue = 1) && (RecompressVar = "MEncoder") {
EncodeReversibleFilterVal .= "," . "hue=" . HueValue . ",scale" ;Scale is needed to correct the colorspace I guess?
}
if (EncHue = 1) && (RecompressVar = "FFmpeg") {
EncodeReversibleFilterVal .= "," . "hue=" . HueValue
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
if (DecHue = 0) {
;DecodeReversibleFilterVal := ""
}
if (DecHue = 1) && !RegExMatch(HueValue,"(-)") && (RecompressVar = "MEncoder") {
DecodeReversibleFilterVal .= "," . "hue=-" . HueValue . ",scale"
}
if (DecHue = 1) && !RegExMatch(HueValue,"(-)") && (RecompressVar = "FFmpeg") {
DecodeReversibleFilterVal .= "," . "hue=-" . HueValue
}
if (DecHue = 1) && RegExMatch(HueValue,"(-)") && (RecompressVar = "FFmpeg") else if (RecompressVar = "MEncoder") {
if InStr(HueValue, "-") {
StringTrimLeft, HueValue2, HueValue, 1 ;Remove the negative symbol.
}
DecodeReversibleFilterVal .= "," . "hue=" . HueValue2
}
StringTrimLeft, EncodeReversibleFilterVal, EncodeReversibleFilterVal, 1 ;Remove extra comma
CheckComma := SubStr(DecodeReversibleFilterVal, 1, 1) ;Crop string down to first char.
if (CheckComma = ",") { ;Check if first char in string is a comma.
StringTrimLeft, DecodeReversibleFilterVal, DecodeReversibleFilterVal, 1 ;Remove extra comma
;DecodeReversibleFilterVal := SubStr(DecodeReversibleFilterVal, 1, -2) ;I tried this but it removed more than 1.
DecodeReversibleFilterVal := " -vf " . DecodeReversibleFilterVal ;add -vf to string.
}
Return
EnableHueSlider:
GuiControlGet, EncHue
if (EncHue = 0) {
Return
}
if (EncHue = 1) {
Gui, hue:Color, DDCEE9
Gui hue:Add, Button, x12 y99 w154 h33 gCloseHueMenu, Apply Hue Changes
Gui hue:Add, Slider, x2 y61 w172 h32 Range-180-180 vHueValue gHueColorSlider AltSubmit, 0
Gui hue:Add, Text, x85 y35 w16 h23 +0x200, 0
Gui hue:Add, Text, x149 y36 w24 h23 +0x200, 180
Gui hue:Add, Text, x5 y35 w24 h23 +0x200, -180
Gui hue:Font, s9, Consolas
Gui hue:Add, Text, x8 y0 w172 h33 +0x200, Ghetto Hue Color Picker
Gui hue:Font
Gui hue:Show, w176 h136, `n
Gui hue:-sysmenu
}
Return
HueColorSlider:
tooltip % HueValue
SetTimer, RemoveToolTip2, 500
return
RemoveToolTip2:
SetTimer, RemoveToolTip2, Off
ToolTip
return
CloseHueMenu:
Gui, hue:Submit, NoHide
gosub, GetFilters
Gui, hue:Destroy
Return
EnableReverseVideo:
gosub, EnableForceRate
gosub, EnableForceRes
gosub, OutputLocation
CheckFile := InputFolder . "\output.avi"
if (EncRev = 1) && (isRecompressed = 0) {
;sourceFile := DefaultSourceFile
}
if (EncRev = 0) && (isRecompressed = 0) {
;sourceFile := DefaultSourceFile ;this should be the bug
Return
}
if (EncRev = 1) && (isRecompressed = 1) {
SourceFile := OutputFolder . "\output-moshed.avi"
}
if (EncRev = 0) && (isRecompressed = 1) {
SourceFile := OutputFolder . "\output-moshed.avi"
Return
}
if (EncRev = 0) && (isRecompressed = 1) && (WebcamCompression = 1) {
SourceFile := OutputFolder . "\webcam-output.avi"
Return
}
if (EncRev = 1) {
if FileExist(CheckFile) && (ReverseOnce = 1) && (isRecompressed = 0) {
;msgbox, wao its off???
sourceFileRev := DefaultSourceFile
if (ReverseWebcam = 1) {
sourceFileRev := InputFolder . "\webcam-output.avi"
}
FFReverseCompress := ComSpec . " /c " . " ffmpeg -i " . chr(0x22) . sourceFileRev . chr(0x22) . " " . ResolutionVar . FrameRate . " -f avi -c:v huffyuv -vf reverse " . InputFolder . "\output2.avi -y"
runwait, %FFReverseCompress%
SourceFile := InputFolder . "\output2.avi"
ReverseCompression := "0"
;ReverseOnce := 0
Return
}
if FileExist(CheckFile) && (ReverseOnce = 1) && (isRecompressed = 1) {
;FileMove, %InputFolder%/output2.avi, %InputFolder%/output.avi
msgbox, Since you have 'Reverse' Enabled during Recompress`nWe have to bake the video before passing to to FFmpeg...
YUVBake := "mplayer " . CustomCodecFix . " -sws 4 " . DecodeReversibleFilterVal . " " . " -vo yuv4mpeg " . OutputFolder . "\output-moshed.avi"
runwait, %YUVBake%
WinWaitClose, cmd
FileMove, stream.yuv, %OutputFolder%\ImBaked.yuv
sleep, 1
sourceFileRev := OutputFolder . "\ImBaked.yuv"
if (ReverseWebcam = 1) && (isRecompressed = 0) {
sourceFileRev := InputFolder . "\webcam-output.avi"
}
if (ReverseWebcam = 1) && (isRecompressed = 1) {
sourceFileRev := OutputFolder . "\ImBaked.yuv"
}
FFReverseCompress := ComSpec . " /c " . " ffmpeg -i " . chr(0x22) . sourceFileRev . chr(0x22) . " " . ResolutionVar . FrameRate . " -f avi -c:v huffyuv -vf reverse " . InputFolder . "\output2.avi -y"
msgbox, %FFReverseCompress%
runwait, %FFReverseCompress%
SourceFile := InputFolder . "\output2.avi"
ReverseCompression := "0"
;ReverseOnce := 0
}
}
Return
UnReverseVideo:
gosub, OutputLocation
gosub, EnableForceRes
if (DecRev = 1) {
msgbox, aw shit you have reverse enabled for decoding, here we go.`nBtw if probably won't work well with the video/audio sync options.
inputFile := OutputFolder . "\ImBaked.yuv "
FFReverseCompress := ComSpec . " /k " . " ffmpeg -i " . chr(0x22) . inputFile . chr(0x22) . " " . ResolutionVar . FrameRate . " -f avi -c:v huffyuv -vf reverse " . InputFolder . "\unreversed-output.avi -y"
msgbox, %FFReverseCompress%
runwait, %FFReverseCompress%
sourceFileReversed := InputFolder . "\unreversed-output.avi"
ShowIt := "cmd.exe /c ffplay -i " . sourceFileReversed . " -loop 0"
runwait, %ShowIt%
ReverseCompression := "0"
UnReverseCompression := 1
return
}
else
Return
BatchInputMessage:
Gui, Submit, NoHide
if (IsBatchInput = 1) && if (BatchInputHelpMsg = 1){
msgbox, ohey batch input is enabled!`nUse the Source button to select a folder...`n`nThen press GO.
}
if (IsBatchInput = 0) && if (BatchInputHelpMsg = 1) {
msgbox, ohey batch input is disabled!`nUse the source button to select a file...`n`nThen press GO.`nThis dialog won't bother you anymore.
BatchInputHelpMsg := 0 ;Turns off the help box until next startup.
}
Return
VideoQualitySlider:
;Gui,Submit,NoHide
int := VideoQuality/10
fra := Mod(int, 10)
fra := SubStr(fra, InStr(fra,".")+1, 1 )
val := Floor(int) "." fra
VQuality := val
tooltip % VQuality
SetTimer, RemoveToolTip1, 500
return
RemoveToolTip1:
SetTimer, RemoveToolTip1, Off
ToolTip
return
GetDevices: ;Thank u again for the Regex, Salz <3
MakeList := ""
DirtyList := ""
msgbox,4096,,
(
Choose your webcam device name from this list.
)
gibdevice := "ffmpeg -f dshow -list_devices true -i null"
List := ComObjCreate("WScript.Shell").Exec(gibdevice).StdErr.ReadAll()
List.Visible := false
text := List
texts := StrSplit(text, "`n", "`r")
for i, thisText in texts {
RegExMatch(thisText, "O)^\[(?:\w+)\s*@\s*(?:[[:xdigit:]]+)\]\s*""(.*?)""$", thisMatch)
MakeList .= "|" . thisMatch.Value(1)
}
DirtyList := StrReplace(MakeList, "||||", "|") ;Remove Duplicate "|" pipe bars.
StringTrimLeft, DeviceList, DirtyList, 4 ;Remove Duplicate "|" pipe bars at beginning.
DeviceList := StrReplace(DeviceList, "|||", "$") ;Split Video & Audio devices.
;Prune Audio Devices.
Needle := "$"
DeviceList := SubStr(DeviceList, 1, InStr(DeviceList, Needle)-1) . "|"
GuiControl,, WebCamName, |%DeviceList%
;GuiControl, Disable, ListWebcams
GuiControl, Choose, WebCamName, 2
;Control, ShowDropDown,, ComboBox2
Return
SelectWebcam:
Gui, Submit, NoHide
GuiControl, 1:Disable, FrameRateVar ;This fucks up the compression, unless the FPS you use matches one supported by the device.
GuiControl, 1:, ForceRate, 0
GuiControl,, IsBatchInput, 0 ;Disable the BatchInput checkbox to avoid filename conflicts.
IsBatchInput := "0" ;Resets the input to be just WebCam, if in case for example you were doing batch datamoshing before this.
WebCam := " -f dshow -i video=" . chr(0x22) . WebCamName . chr(0x22) . " "
WebcamCompression := "1"
ReverseWebcam := 1 ; HERE IS WHERE I LAST EDITED
msgbox, %WebCamName% selected as input device.`n Hit this button every time before "GO"`n if you want to record a new video.`n`n Press Q to stop Webcam.
Return
WebCamCompression:
;Gui, Submit, NoHide
gosub, EnableForceRate
gosub, EnableForceRes
gosub, OutputLocation
if (WebcamCompression = 1) {
FFWebcamCompress := ComSpec . " /c " . " ffmpeg " . InputFrameRate . WebCam . ResolutionVar . FrameRate . " -f avi -c:v huffyuv " . InputFolder . "\webcam-output.avi -y"
runwait, %FFWebcamCompress%
SourceFile := InputFolder . "\webcam-output.avi"
WebcamCompression := "0"
return
}
Return
SelectSource:
Gui, Submit, NoHide
WebcamCompression := "0"
if (IsBatchInput = 1) {
FileCreateDir, %A_ScriptDir%\Batch-Output
FileSelectFolder,leFolder, *%A_ScriptDir%,3,Select The Input Folder.....................
if errorlevel {
msgbox, You Didnt Select Anything lol
return
}
}
else
FileSelectFile, SourceFile,,,Select Source For Datamoshing......................................
DefaultSourceFile := SourceFile
if errorlevel {
msgbox, You Didnt Select Anything lol
return
}
Return
EnableME:
GuiControlGet, EnableMEncoderCodec
if (EnableMEncoderCodec = 1) {
GuiControl, 1:Enable, MencoderCodecs
GuiControl, 1:Enable, MencoderOptions
GuiControl, 1:Enable, RescaleMEncoderCodec
GuiControl, 1:Enable, MEncoderCompression
GuiControl, 1:Disable, FFmpegCodecs
GuiControl, 1:Disable, FFmpegOptions
GuiControl, 1:Disable, FFmpegCompression
GuiControl, 1:Disable, FFGetOptions
GuiControl, 1:Disable, VideoQuality
GuiControl, 1:Disable, TomatoMode
GuiControl, 1:Disable, TomatoFrameCount
GuiControl, 1:Disable, TomatoFramePosition
GuiControl, 1:Disable, TomatoMOSHIT
GuiControl, 1:Disable, TomatoRecycle
GuiControl, 1:, FFmpegOptions, -bf 0 -g 999999 -an
RecompressVar := "MEncoder"
}
return
EnableFF:
GuiControlGet, EnableFFmpegCodec
if (EnableFFmpegCodec = 1) {
GuiControl, 1:Enable, FFmpegCodecs
GuiControl, 1:Enable, FFmpegOptions
GuiControl, 1:Enable, FFmpegCompression
GuiControl, 1:Enable, FFGetOptions
GuiControl, 1:Enable, VideoQuality
GuiControl, 1:Disable, MencoderCodecs
GuiControl, 1:Disable, MEncoderOptions
GuiControl, 1:Disable, RescaleMEncoderCodec
GuiControl, 1:Disable, MEncoderCompression
GuiControl, 1:Disable, TomatoMode
GuiControl, 1:Disable, TomatoFrameCount
GuiControl, 1:Disable, TomatoFramePosition
GuiControl, 1:Disable, TomatoMOSHIT
GuiControl, 1:Disable, TomatoRecycle
GuiControl, 1:, MEncoderOptions, -nosound -noskip
RecompressVar := "FFmpeg"
}
return
EnableForceRes:
Gui, Submit, NoHide
GuiControlGet, ForceRes
if (ForceRes = 1) && (RecompressVar = "FFmpeg") {
GuiControl, 1:Enable, ResolutionVar
ResolutionVar := " -vf scale=" . ResolutionVar
global GlobalResolutionVar := 1
}
if (ForceRes = 1) && (RecompressVar = "MEncoder") {
GuiControl, 1:Enable, ResolutionVar
ResolutionVar := " -vf scale=" . ResolutionVar
ResolutionVar := StrReplace(ResolutionVar, "x", ":")
global GlobalResolutionVar := 1
}
if (ForceRes = 0) {
GuiControl, 1:Disable, ResolutionVar
ResolutionVar := ""
global GlobalResolutionVar := 0
}
if (ForceRate = 1) && (ForceRes = 1) && (RecompressVar = "FFmpeg") {
ResolutionVar := ""
}
if (ForceRate = 1) && (ForceRes = 1) && (RecompressVar = "MEncoder") {
ResolutionVar := StrReplace(ResolutionVar, "x", ":")
}
Return
;WIP
EnableForceRate:
Gui, Submit, NoHide
GuiControlGet, ForceRate
GuiControlGet, ForceRes
if (ForceRate = 1) && (RecompressVar = "FFmpeg") {
GuiControl, 1:Enable, FrameRateVar
FrameRate := " -vf fps=" . FrameRateVar
InputFrameRate := " -r " . FrameRateVar
}
if (ForceRate = 1) && (RecompressVar = "MEncoder") {
GuiControl, 1:Enable, FrameRateVar
FrameRate := " -fps " . FrameRateVar
}
if (ForceRate = 0) {
GuiControl, 1:Disable, FrameRateVar
FrameRate := ""
InputFrameRate := ""
}
if (ForceRate = 0) && (ForceRes = 1) && (IsOtherOptionsOn = 0) && (RecompressVar = "FFmpeg") {
FrameRate := ""
}
if (ForceRate = 1) && (ForceRes = 1) && (IsOtherOptionsOn = 0) && (RecompressVar = "FFmpeg") {
FrameRate := " -vf fps=" . FrameRateVar . "," . "scale=" . ResolutionVa
ResolutionVar := ""
}
if (ForceRate = 1) && (ForceRes = 1) && (IsOtherOptionsOn = 1) && (RecompressVar = "FFmpeg") {
FrameRate := " -vf fps=" . FrameRateVar . "," . "scale=" . ResolutionVar
}
if (ForceRate = 1) && (ForceRes = 1) && (RecompressVar = "MEncoder") {
GuiControl, 1:Enable, FrameRateVar
ResolutionVar := " -vf scale=" . StrReplace(ResolutionVar, "x", ":")
FrameRate := " -fps " . FrameRateVar
}
Return
;WIP
GetFilterOptionsAndFixStrings:
;If force scale is enabled, add a comma and scale filter before all of these.
gosub, EnableForceRes
if (GlobalResolutionVar = 1) && (IsOtherOptionsOn = 1) {
ResolutionVar := StrReplace(ResolutionVar, "x", ":") ;For MEncoder scale filter compatibility,
EncodeReversibleFilterVal := ResolutionVar . "," . EncodeReversibleFilterVal
;DecodeReversibleFilterVal := ResolutionVar . "," . DecodeReversibleFilterVal
}
;If force scale is enabled, But filters are off, don't add a comma.
if (GlobalResolutionVar = 1) && (IsOtherOptionsOn = 0) else if (EnableForceRate = 1) {
ResolutionVar := StrReplace(ResolutionVar, "x", ":") ;For MEncoder scale filter compatibility,
EncodeReversibleFilterVal := ResolutionVar . EncodeReversibleFilterVal
DecodeReversibleFilterVal := ResolutionVar . DecodeReversibleFilterVal
}
;msgbox, %EncodeReversibleFilterVal%
;msgbox, %DecodeReversibleFilterVal%
if (UseOtherOptions = 0) { ;Remove the extra options/Reversible filters, if disabled.
EncodeReversibleFilterVal := ""
DecodeReversibleFilterVal := ""
vfFlag := ""
}
;Reset the Forced Resolution Variable, because its being used in the Reversible filter variable instead.
if (UseOtherOptions = 1) {
ResolutionVar := ""
vfFlag := " -vf "
}
;If force scale is disabled, add "-vf" to the filter variable.
if (GlobalResolutionVar = 0) && if (UseOtherOptions = 1) {
EncodeReversibleFilterVal := vfFlag . EncodeReversibleFilterVal
;DecodeReversibleFilterVal := vfFlag . DecodeReversibleFilterVal
;DecodeReversibleFilterVal := " -vf " . DecodeReversibleFilterVal ;HERE
ResolutionVar := ""
ResolutionVar2 := ""
}
;idk if i need this anymore
if (GlobalResolutionVar = 1) && (UseOtherOptions = 1) {
;ResolutionVar := ""
}
;if filters aren't selected, clear the entire variables.
if (DecodeReversibleFilterVal = " -vf ") {
DecodeReversibleFilterVal := ""
}
;if filters aren't selected, clear the entire variables.
if (EncodeReversibleFilterVal = " -vf ") {
EncodeReversibleFilterVal := ""
}
;idk if i need this anymore
;StringTrimLeft, DecodeReversibleFilterVal, DecodeReversibleFilterVal, 1 ;REMOVED FOR BUG FIX
gosub, EnableForceRate ;This was also an annoying bug I didnt know how else to fix.
if (ForceRate = 1) && (ForceRes = 1) && (IsOtherOptionsOn = 1) && (RecompressVar = "FFmpeg") {
FrameRate := " -vf fps=" . FrameRateVar . "," . "scale=" . ResolutionVar . EncodeReversibleFilterVal
ResolutionVar := ""
EncodeReversibleFilterVal := ""
}
if (ForceRate = 1) && (ForceRes = 1) && (IsOtherOptionsOn = 1) && (RecompressVar = "MEncoder") {
FrameRate := " -fps " . FrameRateVar
}
if (ForceRate = 0) && (ForceRes = 1) && (IsOtherOptionsOn = 0) && (RecompressVar = "FFmpeg") {
ResolutionVar2 := ResolutionVar
ResolutionVar := ""
EncodeReversibleFilterVal := " -vf scale=" . ResolutionVar2
}
if (ForceRes = 1) && (ForceRate = 0) && (IsOtherOptionsOn = 0) && (RecompressVar = "MEncoder") {
ResolutionVar := " -vf scale=" . StrReplace(ResolutionVar, "x", ":")
EncodeReversibleFilterVal := ""
}
if (ForceRes = 0) && (ForceRate = 0) && (IsOtherOptionsOn = 0) && (RecompressVar = "MEncoder") {
ResolutionVar := ""
EncodeReversibleFilterVal := ""
}
if (ForceRate = 1) && (ForceRes = 1) && (IsOtherOptionsOn = 0) && (RecompressVar = "MEncoder") {
EncodeReversibleFilterVal := ""
}
if (ForceRes = 0) && (IsOtherOptionsOn = 1) {
ResolutionVar := "" ;Reset the Forced Resolution Variable, this was a very annoying bug idk how else to fix.
}
if (ForceRes = 1) && (IsOtherOptionsOn = 1) {
;EncodeReversibleFilterVal := ""
ResolutionVar := "" ;Reset the Forced Resolution Variable, because its being used in the Reversible filter variable instead.
}
;Messy bug fixes idk im very sleepy.
if (ForceRate = 1) && (ForceRes = 0) && (IsOtherOptionsOn = 1) && (RecompressVar = "FFmpeg") {
StringTrimLeft, EncodeReversibleFilterVal, EncodeReversibleFilterVal, 5
EncodeReversibleFilterVal2 := EncodeReversibleFilterVal
FrameRate := " -vf fps=" . FrameRateVar . "," . EncodeReversibleFilterVal2
EncodeReversibleFilterVal := ""
NewString := FrameRate
ReverseString := DllCall( "msvcrt.dll\_strrev", Str, NewString, UInt,0, Str) ;Reverses string cus idk how to use SubStr backwards.
CheckComma := SubStr(ReverseString, 1, 1) ;Crop string down to first char.
if (CheckComma = ",") { ;Check if first char in reversed string is a comma.
FrameRate := SubStr(FrameRate, 1, -1) ;Remove comma if last char is such.
}
}
if (ForceRate = 0) && (ForceRes = 1) && (IsOtherOptionsOn = 1) && (RecompressVar = "FFmpeg") {
;Made this bug fix cus FFmpeg doesn't like trailing commas in filter options.
NewString := EncodeReversibleFilterVal
ReverseString := DllCall( "msvcrt.dll\_strrev", Str, NewString, UInt,0, Str) ;Reverses string cus idk how to use SubStr backwards.
CheckComma := SubStr(ReverseString, 1, 1) ;Crop string down to first char.
if (CheckComma = ",") { ;Check if first char in reversed string is a comma.
EncodeReversibleFilterVal := SubStr(EncodeReversibleFilterVal, 1, -1) ;Remove comma if last char is such.
}
}
if (ForceRate = 0) && (ForceRes = 0) && (IsOtherOptionsOn = 0) && (RecompressVar = "FFmpeg") {
ResolutionVar := "" ;Clear unused res var
}
if (ForceRate = 0) && (ForceRes = 0) && (IsOtherOptionsOn = 0) && (RecompressVar = "MEncoder") {
ResolutionVar := "" ;Clear unused res var
}
if (ForceRate = 1) && (ForceRes = 0) && (IsOtherOptionsOn = 0) && (RecompressVar = "MEncoder") {
ResolutionVar := "" ;Clear unused res var
}
Return