Skip to content

Commit 40f7d54

Browse files
committed
[video_splitter] Fix output template not working with absolute paths
Was broken on Windows due to replacing the : character with ; for the entire template post-substitution. Changed to pre-substitute instead. Fixes #303
1 parent 8e9013c commit 40f7d54

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

scenedetect/video_splitter.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,18 +246,15 @@ def split_video_ffmpeg(
246246
processing_start_time = time.time()
247247
for i, (start_time, end_time) in enumerate(scene_list):
248248
duration = (end_time - start_time)
249-
# Format output filename with template variables
249+
# Format output filename with template variable
250250
output_file_template_iter = Template(output_file_template).safe_substitute(
251251
VIDEO_NAME=video_name,
252252
SCENE_NUMBER=scene_num_format % (i + 1),
253-
START_TIME=str(start_time.get_timecode()),
254-
END_TIME=str(end_time.get_timecode()),
253+
START_TIME=str(start_time.get_timecode().replace(":", ";")),
254+
END_TIME=str(end_time.get_timecode().replace(":", ";")),
255255
START_FRAME=str(start_time.get_frames()),
256256
END_FRAME=str(end_time.get_frames()))
257257

258-
# Remove : character or else ffmpeg will error out
259-
output_file_template_iter = output_file_template_iter.replace(":", ";")
260-
261258
# Gracefully handle case where FFMPEG_PATH might be unset.
262259
call_list = [FFMPEG_PATH if FFMPEG_PATH is not None else 'ffmpeg']
263260
if not show_output:

0 commit comments

Comments
 (0)