ffprobe 报错后不采用其内容

This commit is contained in:
Jerry Yan 2025-01-22 14:47:31 +08:00
parent 29bb80f3b9
commit 549ee8320a
2 changed files with 3 additions and 1 deletions

View File

@ -73,7 +73,7 @@ def get_template_info(template_id):
'scenic_name': remote_template_info.get('scenicName', '景区'), 'scenic_name': remote_template_info.get('scenicName', '景区'),
'name': remote_template_info.get('name', '模版'), 'name': remote_template_info.get('name', '模版'),
'video_size': '1920x1080', 'video_size': '1920x1080',
'frame_rate': 30, 'frame_rate': 25,
'overall_duration': 30, 'overall_duration': 30,
'video_parts': [ 'video_parts': [

View File

@ -82,6 +82,8 @@ def probe_video_info(video_file):
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
**subprocess_args(True) **subprocess_args(True)
) )
if result.returncode != 0:
return 0, 0, 0
all_result = result.stdout.decode('utf-8').strip() all_result = result.stdout.decode('utf-8').strip()
wh, duration = all_result.split('\n') wh, duration = all_result.split('\n')
width, height = wh.strip().split('x') width, height = wh.strip().split('x')