[修复] 运动片段分割 ffmpeg 调用缺可执行文件 - args 首元素补 ffmpeg 路径(此前被当成可执行文件导致全部分割失败)

This commit is contained in:
ericwyuan
2026-08-22 12:41:06 +08:00
parent a1523b46c8
commit 8d6cfad6c0

View File

@@ -246,9 +246,9 @@ class VideoProcessor:
vmeta = None vmeta = None
vrow = self.db.get_video_by_filename(filename) vrow = self.db.get_video_by_filename(filename)
is_motion_clip = bool(vrow and vrow.get('motion_event_id')) is_motion_clip = bool(vrow and vrow['motion_event_id'])
camera_name = (vrow or {}).get('camera_name') or '' camera_name = vrow['camera_name'] if vrow else ''
event_start = (vrow or {}).get('event_start_time') or '' event_start = vrow['event_start_time'] if vrow else ''
if not event_start and self.parse_start: if not event_start and self.parse_start:
event_start = _parse_event_start_from_filename(filename) event_start = _parse_event_start_from_filename(filename)
if event_start: if event_start:
@@ -380,7 +380,7 @@ class VideoProcessor:
音频按配置保留pcm_alaw -> aac 转码)或丢弃(-an""" 音频按配置保留pcm_alaw -> aac 转码)或丢弃(-an"""
import shutil import shutil
ffmpeg = shutil.which('ffmpeg') or 'ffmpeg' ffmpeg = shutil.which('ffmpeg') or 'ffmpeg'
args = ['-y', '-hide_banner', '-loglevel', 'error', args = [ffmpeg, '-y', '-hide_banner', '-loglevel', 'error',
'-ss', f'{offset:.3f}', '-i', src_path, '-t', f'{dur:.3f}', '-ss', f'{offset:.3f}', '-i', src_path, '-t', f'{dur:.3f}',
'-c:v', 'copy'] '-c:v', 'copy']
if self.motion_keep_audio: if self.motion_keep_audio: