mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Applied suggestions from @iLLiCiTiT
Simplifies the ffmpeg command construction by moving the seek position argument to the beginning of the command list if a seek position is specified, leading to a clearer and more maintainable structure. This also ensures that the output path is always the last argument passed to ffmpeg.
This commit is contained in:
parent
57b808e924
commit
f0be8cd877
1 changed files with 10 additions and 11 deletions
|
|
@ -503,20 +503,19 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
seek_position = duration * self.duration_split
|
||||
|
||||
# Build command args
|
||||
cmd_args = [
|
||||
"-y",
|
||||
cmd_args = []
|
||||
if seek_position > 0.0:
|
||||
cmd_args.extend(["--ss", str(seek_position)])
|
||||
|
||||
# Add generic ffmpeg commands
|
||||
cmd_args.extend([
|
||||
"-i", video_file_path,
|
||||
"-analyzeduration", max_int,
|
||||
"-probesize", max_int,
|
||||
]
|
||||
|
||||
# Only add -ss if we're seeking to a specific position
|
||||
if seek_position > 0:
|
||||
cmd_args.insert(1, "-ss")
|
||||
cmd_args.insert(2, str(seek_position))
|
||||
|
||||
# Ensure we extract exactly one frame
|
||||
cmd_args.extend(["-frames:v", "1"])
|
||||
"-y",
|
||||
"-frames:v", "1",
|
||||
output_thumb_file_path
|
||||
])
|
||||
|
||||
# add output file path
|
||||
cmd_args.append(output_thumb_file_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue