#NEWLINE# def optimize( self , buffer , input_file , output_file ) : #NEWLINE# #INDENT# ( format , command_params ) = self . set_format ( ) #NEWLINE# command = [ self . context . config . FFMPEG_PATH , '-y' , '-f' , 'gif' , '-i' , input_file , '-an' , '-movflags' , 'faststart' , '-f' , format , '-pix_fmt' , 'yuv420p' ] #NEWLINE# command += command_params #NEWLINE# command += [ '-qmin' , '10' , '-qmax' , '42' , '-crf' , '23' , '-maxrate' , '500k' , '-vf' , 'scale=trunc(iw/2)*2:trunc(ih/2)*2' , output_file , '-loglevel' , 'error' ] #NEWLINE# with open ( os . devnull ) as null : #NEWLINE# #INDENT# subprocess . call ( command , stdin = null ) #NEWLINE# #UNINDENT# self . context . request . format = format