@@ -11,7 +11,8 @@ def to_int(a, rel_to):
11
11
If string contains "%" it converts it to a float and multiplies by rel_to
12
12
EG: 50% -> 0.5*rel_to
13
13
'''
14
- if type (a ) == int :
14
+
15
+ if isinstance (a ):
15
16
return a
16
17
else :
17
18
if '%' in a :
@@ -25,13 +26,41 @@ def to_int(a, rel_to):
25
26
parser = argparse .ArgumentParser ()
26
27
27
28
parser .add_argument ('-i' , '--input' , type = str , help = 'the file to crop' )
28
- parser .add_argument ('-c' , '--crop' , type = str , help = 'the amount to crop in the format "TOP,BOTTOM,LEFT,RIGHT"' )
29
- parser .add_argument ('-t' , '--top' , type = str , help = 'the amount to crop off the top of the video' )
30
- parser .add_argument ('-b' , '--bottom' , type = str , help = 'the amount to crop off the bottom of the video' )
31
- parser .add_argument ('-l' , '--left' , type = str , help = 'the amount to crop off the left of the video' )
32
- parser .add_argument ('-r' , '--right' , type = str , help = 'the amount to crop off the right of the video' )
33
- parser .add_argument ('-o' , '--output' , type = str , help = 'the file to output to (cannot be the same as input file)' )
34
- parser .add_argument ('-y' , '--yes' , action = 'store_true' , help = 'skip the prompt to confirm overwriting a file' )
29
+ parser .add_argument (
30
+ '-c' ,
31
+ '--crop' ,
32
+ type = str ,
33
+ help = 'the amount to crop in the format "TOP,BOTTOM,LEFT,RIGHT"' )
34
+ parser .add_argument (
35
+ '-t' ,
36
+ '--top' ,
37
+ type = str ,
38
+ help = 'the amount to crop off the top of the video' )
39
+ parser .add_argument (
40
+ '-b' ,
41
+ '--bottom' ,
42
+ type = str ,
43
+ help = 'the amount to crop off the bottom of the video' )
44
+ parser .add_argument (
45
+ '-l' ,
46
+ '--left' ,
47
+ type = str ,
48
+ help = 'the amount to crop off the left of the video' )
49
+ parser .add_argument (
50
+ '-r' ,
51
+ '--right' ,
52
+ type = str ,
53
+ help = 'the amount to crop off the right of the video' )
54
+ parser .add_argument (
55
+ '-o' ,
56
+ '--output' ,
57
+ type = str ,
58
+ help = 'the file to output to (cannot be the same as input file)' )
59
+ parser .add_argument (
60
+ '-y' ,
61
+ '--yes' ,
62
+ action = 'store_true' ,
63
+ help = 'skip the prompt to confirm overwriting a file' )
35
64
36
65
args = parser .parse_args ()
37
66
@@ -107,7 +136,11 @@ def to_int(a, rel_to):
107
136
sys .exit (1 )
108
137
109
138
# call ffmpeg with the required args
110
- cmd = 'ffmpeg -hide_banner -loglevel error -i "{}" -c:a copy -filter:v "crop={}:{}:{}:{}" {}{}'
139
+ cmd = (
140
+ 'ffmpeg -hide_banner -loglevel error -i "{}" -c:a copy '
141
+ '-filter:v "crop={}:{}:{}:{}" {}{}'
142
+ )
143
+
111
144
cmd = cmd .format (
112
145
args .input ,
113
146
width ,
0 commit comments