fixed crash when reading a file with no audio track
This commit is contained in:
parent
2f1c4efb97
commit
9d72d2156c
1 changed files with 13 additions and 8 deletions
|
@ -149,11 +149,10 @@ if __name__ == '__main__':
|
|||
print(video_streams)
|
||||
main.exit(1)
|
||||
|
||||
if amount_as != 1:
|
||||
if amount_as > 1:
|
||||
_print('detected §y%d§/ audio streams, picking the "best" one (see man 1 ffmpeg, section STREAM SELECTION)' %(amount_as), prefix.warn)
|
||||
|
||||
video = video_streams[0]
|
||||
audio = audio_streams[0]
|
||||
|
||||
info.video_codec = video['codec_name']
|
||||
info.video_size_x = video['width']
|
||||
|
@ -161,11 +160,13 @@ if __name__ == '__main__':
|
|||
info.video_fps = over.core.textui.Unit(parse_fps(video['r_frame_rate']), 'Hz')
|
||||
info.video_bitrate = over.core.textui.Unit(video['bit_rate'], 'b/s') if 'bit_rate' in video else '§r??§/'
|
||||
|
||||
info.audio_codec = audio['codec_name']
|
||||
info.audio_channels = audio['channels']
|
||||
info.audio_samplerate = over.core.textui.Unit(audio['sample_rate'], 'Hz')
|
||||
info.audio_language = audio['tags']['language'] if 'tags' in audio and 'language' in audio['tags'] else 'und'
|
||||
info.audio_bitrate = over.core.textui.Unit(audio['bit_rate'], 'b/s') if 'bit_rate' in audio else '§r??§/'
|
||||
if audio_streams:
|
||||
audio = audio_streams[0]
|
||||
info.audio_codec = audio['codec_name']
|
||||
info.audio_channels = audio['channels']
|
||||
info.audio_samplerate = over.core.textui.Unit(audio['sample_rate'], 'Hz')
|
||||
info.audio_language = audio['tags']['language'] if 'tags' in audio and 'language' in audio['tags'] else 'und'
|
||||
info.audio_bitrate = over.core.textui.Unit(audio['bit_rate'], 'b/s') if 'bit_rate' in audio else '§r??§/'
|
||||
|
||||
except:
|
||||
_print('exception while reading identify_dict, dump follows', prefix.fail)
|
||||
|
@ -174,7 +175,11 @@ if __name__ == '__main__':
|
|||
|
||||
# TODO wordify :-)
|
||||
_print('§mvideo§/: size=§b%d§/x§b%d§/ px, framerate=%s, codec=%s, bitrate=%s' %(info.video_size_x, info.video_size_y, info.video_fps, info.video_codec, info.video_bitrate))
|
||||
_print('§caudio§/: channels=§b%d§/, samplerate=%s, codec=%s, bitrate=%s, language=%s' %(info.audio_channels, info.audio_samplerate, info.audio_codec, info.audio_bitrate, info.audio_language))
|
||||
|
||||
if audio_streams:
|
||||
_print('§caudio§/: channels=§b%d§/, samplerate=%s, codec=%s, bitrate=%s, language=%s' %(info.audio_channels, info.audio_samplerate, info.audio_codec, info.audio_bitrate, info.audio_language))
|
||||
else:
|
||||
_print('§caudio§/: §yNone§/', prefix.warn)
|
||||
|
||||
# --------------------------------------------------
|
||||
# normalization pre-pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue