@@ -34,27 +34,29 @@ def __init__(self, format: str, sample_rate: int, channels: int = 1):
3434 self .output_buffer = BytesIO ()
3535 container_options = {}
3636 # Try disabling Xing VBR header for MP3 to fix iOS timeline reading issues
37- if self .format == ' mp3' :
37+ if self .format == " mp3" :
3838 # Disable Xing VBR header
39- container_options = {' write_xing' : '0' }
39+ container_options = {" write_xing" : "0" }
4040 logger .debug ("Disabling Xing VBR header for MP3 encoding." )
4141
4242 self .container = av .open (
4343 self .output_buffer ,
4444 mode = "w" ,
4545 format = self .format if self .format != "aac" else "adts" ,
46- options = container_options # Pass options here
46+ options = container_options , # Pass options here
4747 )
4848 self .stream = self .container .add_stream (
4949 codec_map [self .format ],
5050 rate = self .sample_rate ,
5151 layout = "mono" if self .channels == 1 else "stereo" ,
5252 )
5353 # Set bit_rate only for codecs where it's applicable and useful
54- if self .format in [' mp3' , ' aac' , ' opus' ]:
54+ if self .format in [" mp3" , " aac" , " opus" ]:
5555 self .stream .bit_rate = 128000
5656 else :
57- raise ValueError (f"Unsupported format: { self .format } " ) # Use self.format here
57+ raise ValueError (
58+ f"Unsupported format: { self .format } "
59+ ) # Use self.format here
5860
5961 def close (self ):
6062 if hasattr (self , "container" ):
0 commit comments