44 IO ,
55 Literal ,
66 get_args ,
7- LiteralString ,
87 Any ,
98 TypedDict ,
109 Unpack ,
2928
3029
3130from fractions import Fraction
32- import re , logging
31+ import re
32+ import logging
3333
3434logger = logging .getLogger ("ffmpegio" )
3535
@@ -138,7 +138,7 @@ def array_to_video_input(
138138
139139 return (
140140 pipe_id or "-" ,
141- {** utils .array_to_video_options (data )[0 ], f "r" : rate , ** opts },
141+ {** utils .array_to_video_options (data )[0 ], "r" : rate , ** opts },
142142 )
143143
144144
@@ -161,7 +161,7 @@ def array_to_audio_input(
161161
162162 return (
163163 pipe_id or "-" ,
164- {** utils .array_to_audio_options (data )[0 ], f "ar" : rate , ** opts },
164+ {** utils .array_to_audio_options (data )[0 ], "ar" : rate , ** opts },
165165 )
166166
167167
@@ -366,7 +366,6 @@ def finalize_video_read_opts(
366366
367367 # directly from the input url (if not forced via input options)
368368 if has_simple_filter :
369-
370369 # create a source chain with matching spec and attach it to the af graph
371370 vf = temp_video_src (* inopt_vals ) + outopts .get (
372371 "filter:v" , outopts .get ("vf" , None )
@@ -385,7 +384,6 @@ def finalize_video_read_opts(
385384
386385 # pixel format must be specified
387386 if pix_fmt is None :
388-
389387 if pix_fmt_in == "unknown" :
390388 raise FFmpegioError (
391389 "input pixel format unknown. Please specify output pix_fmt (to be autoset)"
@@ -546,7 +544,6 @@ def finalize_audio_read_opts(
546544
547545 # if a simple filter is present, use the stream specs of its output
548546 if "af" in outopts or "filter:a" in outopts :
549-
550547 # create a source chain with matching specs and attach it to the af graph
551548 af = temp_audio_src (* inopt_vals )
552549 af = af + outopts .get ("filter:a" , outopts .get ("af" , None ))
@@ -766,7 +763,7 @@ def finalize_avi_read_opts(args):
766763
767764 # add audio codec
768765 for k in utils .find_stream_options (options , "sample_fmt" ):
769- options [f "c:a" + k [10 :]] = utils .get_audio_codec (options [k ])[0 ]
766+ options ["c:a" + k [10 :]] = utils .get_audio_codec (options [k ])[0 ]
770767
771768 return ya8 > 0
772769
@@ -794,7 +791,7 @@ def config_input_fg(expr, args, kwargs):
794791 # multi-filter input filtergraph, cannot take arguments
795792 if len (args ):
796793 raise FFmpegioError (
797- f "filtergraph input expresion cannot take ordered options."
794+ "filtergraph input expresion cannot take ordered options."
798795 )
799796 return expr , dopt , kwargs
800797
@@ -935,7 +932,6 @@ def add_filtergraph(
935932 args ["outputs" ][ofile ] = (args ["outputs" ][ofile ][0 ], {"map" : map })
936933 else :
937934 if append_map and "map" in outopts :
938-
939935 existing_map = outopts ["map" ]
940936
941937 # remove merged streams from output map & append the output stream of the filter
@@ -1329,7 +1325,6 @@ def process_raw_outputs(
13291325 user_maps = {}
13301326 stream_maps = {}
13311327 for k , v in streams .items () if get_opts else ((s , None ) for s in streams ):
1332-
13331328 if isinstance (k , tuple ):
13341329 k = ":" .join (str (s ) for s in k )
13351330
@@ -1382,7 +1377,6 @@ def process_raw_inputs(
13821377
13831378 input_info : list [InputSourceDict ] = []
13841379 for i , (mtype , arg ) in enumerate (zip (stream_types , stream_args )):
1385-
13861380 try :
13871381 a1 , a2 = arg
13881382 if isinstance (a1 , (int , float , Fraction )):
@@ -1403,7 +1397,7 @@ def process_raw_inputs(
14031397 elif "r" in opts :
14041398 mtype = "v"
14051399 else :
1406- raise FFmpegioError (f "unknown input stream media type" )
1400+ raise FFmpegioError ("unknown input stream media type" )
14071401 data , opts = a1 , a2
14081402 except FFmpegioError :
14091403 raise
@@ -1440,7 +1434,7 @@ def process_raw_inputs(
14401434 pix_fmt , s = utils .guess_video_format (* raw_info )
14411435 more_opts = {
14421436 "f" : "rawvideo" ,
1443- f "c:v" : "rawvideo" ,
1437+ "c:v" : "rawvideo" ,
14441438 "pix_fmt" : pix_fmt ,
14451439 "s" : s ,
14461440 }
@@ -1558,7 +1552,6 @@ def process_url_outputs(
15581552 missing_map = True
15591553
15601554 if missing_map and not skip_automapping :
1561-
15621555 # some output file is missing `map` option
15631556 # add all input streams or all complex filter outputs
15641557 map_opts = [* auto_map (args , input_info , None )]
@@ -1893,7 +1886,7 @@ def init_media_write_outputs(
18931886 a_ids = [
18941887 i for i , info in enumerate (input_info ) if info ["media_type" ] == "audio"
18951888 ]
1896- except KeyError as e :
1889+ except KeyError :
18971890 raise NotImplementedError (
18981891 "audio merging mode is not currently implemented. Please use the `complex_filtergraph=ffmpegio.filtergraph.presets.merge_audio(...)` to assign a custom filtergraph."
18991892 )
@@ -2012,7 +2005,7 @@ def init_media_filter(
20122005 if extra_inputs is not None :
20132006 try :
20142007 input_info .extend (process_url_inputs (args , extra_inputs , {}, no_pipe = True ))
2015- except FFmpegioNoPipeAllowed as e :
2008+ except FFmpegioNoPipeAllowed :
20162009 raise FFmpegioError ("extra_inputs cannot be piped in." )
20172010
20182011 # make sure all inputs are complete
@@ -2123,7 +2116,7 @@ def init_media_transcoder(
21232116 if extra_inputs is not None :
21242117 try :
21252118 input_info .extend (process_url_inputs (args , extra_inputs , {}, no_pipe = True ))
2126- except FFmpegioNoPipeAllowed as e :
2119+ except FFmpegioNoPipeAllowed :
21272120 raise FFmpegioError ("extra_inputs cannot be piped in." )
21282121
21292122 if not len (input_info ):
@@ -2190,7 +2183,6 @@ def init_named_pipes(
21902183 has_pipeout = False
21912184 for i , (output , info ) in enumerate (zip (args ["outputs" ], output_info )):
21922185 if output [0 ] is None :
2193-
21942186 has_pipeout = True
21952187
21962188 # if fileobj or buffer output, use pipe
0 commit comments