-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideobeaux.py
707 lines (655 loc) · 22.8 KB
/
videobeaux.py
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
import typer
from typing_extensions import Annotated
# NEW
import os
import calendar
from pathlib import Path
from programs import (
bad_contrast,
bad_predator,
ball_point_pen,
blur_pix,
broken_scroll,
convert,
digital_boss,
double_cup,
download_yt,
extract_frames,
extract_sound,
fever,
frame_delay_pro1,
frame_delay_pro2,
ghostee,
light_snow,
looper_pro,
lsd_feedback,
mirror_delay,
nostalgic_stutter,
num_edits,
overexposed_stutter,
overlay_img_pro,
pickle_juice,
rb_blur,
resize,
reverse,
scrolling_pro,
silence_xtraction,
slight_smear,
speed,
stack_2x,
steel_wash,
stutter_pro,
transcraibe,
zapruder)
from utils import load_config
from datetime import datetime
from pyfiglet import Figlet
a = Figlet(font='ogre')
print(a.renderText("videobeaux"))
print("Your friendly multilateral video toolkit built for artists by artists.")
print("It's your best friend.")
print('-' * 50)
config = load_config.load_config()
proj_mgmt_config = config['proj_mgmt']
v_ext = proj_mgmt_config['default_video_file_ext']
a_ext = proj_mgmt_config['default_audio_file_ext']
now = datetime.now()
ct = now.strftime("%Y-%m-%d_%H-%M-%S")
app = typer.Typer()
#################
# bad_contrast
#################
@app.command('bad-contrast', help='Apply a bad constrast effect.')
def bad_contrast_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['bad_contrast']
params = {key: params.get(key) or defaults[key] for key in defaults}
bad_contrast.bad_contrast(**params)
#################
# ball_point_pen
#################
@app.command('ball_point_pen', help='Apply a ball point pen effect.')
def ball_point_pen_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['ball_point_pen']
params = {key: params.get(key) or defaults[key] for key in defaults}
ball_point_pen.ball_point_pen(**params)
############
# blur-pix
############
@app.command('blur-pix', help='Apply blur pix effect to video file.')
def blur_pix_video(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['blur_pix']
params = {key: params.get(key) or defaults[key] for key in defaults}
blur_pix.blur_pix(**params)
############
# bad_predator
############
@app.command('bad_predator', help='Apply bad Predator heat vision effect to video file.')
def bad_predator_vb(
input_file1: str = typer.Argument(None, help="Input video file 1"),
input_file2: str = typer.Argument(None, help="Input video file 2"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file1": input_file1,
"input_file2": input_file2,
"output_file": output_file
}
defaults = config['bad_predator']
params = {key: params.get(key) or defaults[key] for key in defaults}
bad_predator.bad_predator(**params)
#############
# broken_scroll
#############
@app.command('broken-scroll', help='Apply broken_scroll effect to video file.')
def broken_scroll_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['broken_scroll']
params = {key: params.get(key) or defaults[key] for key in defaults}
broken_scroll.broken_scroll(**params)
###########
# convert
###########
@app.command('convert', help='Convert a video to a different format.')
def convert_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file"),
format: str = typer.Argument(None, help="Format of the output video")
):
params = {
"input_file": input_file,
"output_file": output_file,
"format": format
}
defaults = config['convert']
params = {key: params.get(key) or defaults[key] for key in defaults}
convert.convert(**params)
###########
# digital_boss
###########
@app.command('digital_boss', help='Apply fever effect to video.')
def digital_boss_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['digital_boss']
params = {key: params.get(key) or defaults[key] for key in defaults}
digital_boss.digital_boss(**params)
###########
# fever
###########
@app.command('fever', help='Apply fever effect to video.')
def fever_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['fever']
params = {key: params.get(key) or defaults[key] for key in defaults}
fever.fever(**params)
###########
# double_cup
###########
@app.command('double-cup', help='Apply the effect of purple drank.')
def double_cup_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['double_cup']
params = {key: params.get(key) or defaults[key] for key in defaults}
double_cup.double_cup(**params)
##########
# download_yt : yt-dlp
##########
@app.command('download-yt', help='Downloads the provided link with yt-dlp')
def yt_dlp_vb(
yt_url: str = typer.Argument(None, help="URL of the YT video"),
output_file: str = typer.Argument(None, help="Width of the output video"),
format: str = typer.Argument(v_ext, help="Width of the output video"),
):
params = {
"yt_url": yt_url,
"output_file": output_file,
"format": format
}
defaults = config['download_yt']
params = {key: params.get(key) or defaults[key] for key in defaults}
download_yt.download_yt(**params)
##################
# extract-frames
##################
@app.command('extract-frames', help='Extract frames from a video at the specified frame rate.')
def extract_frames_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output folder for frames"),
frame_rate: int = typer.Argument(None, help="Frame rate for extracting frames")
):
params = {
"input_file": input_file,
"output_file": output_file,
"frame_rate": frame_rate
}
defaults = config['extract_frames']
params = {key: params.get(key) or defaults[key] for key in defaults}
extract_frames.extract_frames(**params)
#################
# extract-sound
#################
@app.command('extract-sound', help='Extract audio from video file.')
def extract_sound_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output audio file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['extract_sound']
params = {key: params.get(key) or defaults[key] for key in defaults}
print(params)
extract_sound.extract_sound(**params)
####################
# frame-delay-pro1
####################
@app.command('frame-delay-pro1', help='Apply the pro1 frame delay to video file.')
def frame_delay_pro1_vb(
input_file: str = typer.Argument(None, help="Input video file "),
num_of_frames: int = typer.Argument(None, help="Input weight for frame delay"),
frame_weights: str = typer.Argument(None, help="Input weight for frame delay"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"num_of_frames": num_of_frames,
"frame_weights": frame_weights,
"output_file": output_file
}
defaults = config['frame_delay_pro1']
params = {key: params.get(key) or defaults[key] for key in defaults}
frame_delay_pro1.frame_delay_pro1(**params)
####################
# frame-delay-pro2
####################
@app.command('frame-delay-pro2', help='Apply the pro2 frame delay to video file.')
def frame_delay_pro2_vb(
input_file: str = typer.Argument(None, help="Input video file "),
decay: int = typer.Argument(None, help=""),
planes: str = typer.Argument(None, help="Input weight for frame delay"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"decay": decay,
"planes": planes,
"output_file": output_file
}
defaults = config['frame_delay_pro2']
params = {key: params.get(key) or defaults[key] for key in defaults}
frame_delay_pro2.frame_delay_pro2(**params)
###########
# ghostee
###########
@app.command('ghostee', help='Ghosting effect.')
def ghostee_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['ghostee']
params = {key: params.get(key) or defaults[key] for key in defaults}
ghostee.ghostee(**params)
###########
# light_snow
###########
@app.command('light_snow', help='Slightly smearing RGB color space.')
def light_snow_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['light_snow']
params = {key: params.get(key) or defaults[key] for key in defaults}
light_snow.light_snow(**params)
#################
# looper-pro
#################
@app.command('looper-pro', help='Apply video looper effect base on frame size & start frame.')
def scrolling_pro_video(
input_file: str = typer.Argument(None, help="Input video file"),
loop_count: str = typer.Argument(None, help="Number of video loops"),
size_in_frames: str = typer.Argument(None, help="Size of loop in frames"),
start_frame: str = typer.Argument(None, help="Starting frame of loop"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"loop_count": loop_count,
"size_in_frames": size_in_frames,
"start_frame": start_frame,
"output_file": output_file
}
defaults = config['looper_pro']
params = {key: params.get(key) or defaults[key] for key in defaults}
looper_pro.looper_pro(**params)
################
# lsd-feedback
################
@app.command('lsd-feedback', help='Apply LSD feedback effect to video file.')
def lsd_feedback_vb(
input_file: str = typer.Argument(None, help="Input video file "),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['lsd_feedback']
params = {key: params.get(key) or defaults[key] for key in defaults}
lsd_feedback.lsd_feedback(**params)
################
# mirror-delay
################
@app.command('mirror-delay', help='Apply mirrored delay effect to video file.')
def mirror_delay_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['mirror_delay']
params = {key: params.get(key) or defaults[key] for key in defaults}
print(params)
mirror_delay.mirror_delay(**params)
#####################
# nostalgic-stutter
#####################
@app.command('nostalgic-stutter', help='Apply nostaglic stutter effect to video file.')
def nostalgic_stutter_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['nostalgic_stutter']
params = {key: params.get(key) or defaults[key] for key in defaults}
nostalgic_stutter.nostalgic_stutter(**params)
################
# num-edits
################
@app.command('num-edits', help='Apply LSD feedback effect to video file.')
def num_edits_vb(
input_file: str = typer.Argument(None, help="Input video file "),
count: str = typer.Argument(None, help="Input video file "),
output_file: str = typer.Argument(None, help="Input video file ")
):
params = {
"input_file": input_file,
"count": count,
"output_file": output_file
}
defaults = config['num_edits']
params = {key: params.get(key) or defaults[key] for key in defaults}
num_edits.num_edits(**params)
######################
# overexposed-stutter
######################
@app.command('overexposed-stutter', help='Apply overexposed stutter effect to video file.')
def overexposed_stutter_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['overexposed_stutter']
params = {key: params.get(key) or defaults[key] for key in defaults}
overexposed_stutter.overexposed_stutter(**params)
######################
# overlay_img_pro
######################
@app.command('overlay-img-pro', help='Overlay an image with location & dimension control.')
def overlay_img_pro_vb(
input_file: str = typer.Argument(None, help="Input video file "),
overlay_image: int = typer.Argument(None, help="Image file"),
x_position: str = typer.Argument(None, help="X position of the image file"),
y_position: str = typer.Argument(None, help="Y position of the image file"),
overlay_width: str = typer.Argument(None, help="Overlay image width"),
overlay_height: str = typer.Argument(None, help="Overlay image height"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"overlay_image": overlay_image,
"x_position": x_position,
"y_position": y_position,
"overlay_width": overlay_width,
"overlay_height": overlay_height,
"output_file": output_file
}
defaults = config['overlay_img_pro']
params = {key: params.get(key) or defaults[key] for key in defaults}
overlay_img_pro.overlay_img_pro(**params)
##########
# pickle_juice
##########
@app.command('pickle_juice', help='Apply filter like the video was dipped in pickle juice.')
def pickle_juice_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file"),
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['pickle_juice']
params = {key: params.get(key) or defaults[key] for key in defaults}
pickle_juice.pickle_juice(**params)
##########
# rb_blur
##########
@app.command('rb-blur', help='Resize a video to the given width and height.')
def rb_blur_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file"),
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['rb_blur']
params = {key: params.get(key) or defaults[key] for key in defaults}
rb_blur.rb_blur(**params)
##########
# resize
##########
@app.command('resize', help='Resize a video to the given width and height.')
def resize_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file"),
width: int = typer.Argument(None, help="Width of the output video"),
height: int = typer.Argument(None, help="Height of the output video")
):
params = {
"input_file": input_file,
"output_file": output_file,
"width": width,
"height": height
}
defaults = config['resize']
params = {key: params.get(key) or defaults[key] for key in defaults}
resize.resize(**params)
###########
# reverse
###########
@app.command('reverse', help='Reverse video file.')
def reverse_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['reverse']
params = {key: params.get(key) or defaults[key] for key in defaults}
reverse.reverse(**params)
#################
# scrolling-pro
#################
@app.command('scrolling-pro', help='Apply scrolling pro effect to video file.')
def scrolling_pro_video(
input_file: str = typer.Argument(None, help="Input video file"),
horizontal: str = typer.Argument(None, help="Horizontal scroll parameter"),
vertical: str = typer.Argument(None, help="Vertical scroll parameter"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"horizontal": horizontal,
"vertical": vertical,
"output_file": output_file
}
defaults = config['scrolling_pro']
params = {key: params.get(key) or defaults[key] for key in defaults}
scrolling_pro.scrolling_pro(**params)
#####################
# silence-xtraction
#####################
@app.command('silence-xtraction', help="Stitches togehter video chunks that have no discernable words." +
"This does NOT use audio analysis, but instead identifes the presence of a 'word' using the .srt transcription file")
def silence_xtraction_vb(
min_d: int = typer.Argument(None, help="Minimum duration of a chunk of silence."),
max_d: int = typer.Argument(None, help="Maximum duration of a chunk of silence."),
adj: int = typer.Argument(None, help="Adjustment value"),
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"min_d": min_d,
"max_d": max_d,
"adj": adj,
"input_file": input_file,
"output_file": output_file,
}
defaults = config['silence_x']
params = {key: params.get(key) or defaults[key] for key in defaults}
silence_xtraction.silence_xtraction(**params)
###########
# slight_smear
###########
@app.command('slight_smear', help='Slightly smearing RGB color space.')
def slight_smear_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['slight_smear']
params = {key: params.get(key) or defaults[key] for key in defaults}
slight_smear.slight_smear(**params)
#############
# speed
#############
@app.command('speed', help='Apply speed effect to video file.')
def speed_vb(
input_file: str = typer.Argument(None, help="Input video file"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['speed']
params = {key: params.get(key) or defaults[key] for key in defaults}
speed.speed(**params)
############
# stack-2x
############
@app.command('stack-2x', help='Stack 2 videos on top of each other keeping the original orientation.')
def stack_2x_vb(
input_file1: str = typer.Argument(None, help="Input video file 1"),
input_file2: str = typer.Argument(None, help="Input video file 2"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file1": input_file1,
"input_file2": input_file2,
"output_file": output_file
}
defaults = config['stack_2x']
params = {key: params.get(key) or defaults[key] for key in defaults}
stack_2x.stack_2x(**params)
############
# steel_wash
############
@app.command('steel_wash', help='Apply steel blue filter to video.')
def steel_wash_vb(
input_file: str = typer.Argument(None, help="Input video file 1"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['steel_wash']
params = {key: params.get(key) or defaults[key] for key in defaults}
steel_wash.steel_wash(**params)
###############
# stutter-pro
###############
@app.command('stutter-pro', help='Apply stutter pro effect to video file.')
def stutter_pro_vb(
input_file: str = typer.Argument(None, help="Input video file"),
stutter: str = typer.Argument(None, help="Frame stutter parameter"),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"stutter": stutter,
"output_file": output_file
}
defaults = config['stutter_pro']
params = {key: params.get(key) or defaults[key] for key in defaults}
stutter_pro.stutter_pro(**params)
###############
# transcraibe
###############
@app.command('transcraibe', help='Transcribes the video with ai (vosk) - transcrAIbe')
def transcraibe_vb(
input_file: str = typer.Argument(None, help='Video file you would like to transcribe.'),
stt_model: str = typer.Argument(None, help="URL of the YT video")
):
params = {
"input_file": input_file,
"stt_model": stt_model
}
defaults = config['transcraibe']
params = {key: params.get(key) or defaults[key] for key in defaults}
transcraibe.vosk_stt(**params)
###############
# zapruder
###############
@app.command('zapruder', help='Apply zapruder effect to video file.')
def zapruder_vb(
input_file: str = typer.Argument(None, help='Input video file'),
output_file: str = typer.Argument(None, help="Output video file")
):
params = {
"input_file": input_file,
"output_file": output_file
}
defaults = config['zapruder']
params = {key: params.get(key) or defaults[key] for key in defaults}
zapruder.zapruder(**params)
if __name__ == "__main__":
app()