mardi 3 mars 2020

if statement with ffprobe stream analyzer in pyqt

I am trying to use if statement to display some video streams parameter(bitrate) in case it exists or displays a message( cannot measure bitrate) if there is no bit rate. and prevent my GUI from crashing.

where is the wrong in my code, or how can I make it better?

ffprobeOutput = json.loads(data)

        video_stream = next((stream for stream in ffprobeOutput['streams'] if stream['codec_type'] == 
                        'video'), None)


        if  int(video_stream['bit_rate']) == True:
            bit_rate1=int(video_stream['bit_rate'])
            self.V_lcd7.display(bit_rate1)

        else:
            self.V_lcd7.display(000)
            print('can not measure bitrate')

Aucun commentaire:

Enregistrer un commentaire