Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scenedetect/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def list_scenes_command(ctx, output, filename, no_output_file, quiet):
'Override codec arguments/options passed to FFmpeg when splitting and re-encoding'
' scenes. Use double quotes (") around specified arguments. Must specify at least'
' audio/video codec to use (e.g. -a "-c:v [...] and -c:a [...]"). [default:'
' "-c:v libx264 -preset veryfast -crf 22 -c:a copy"]')
' "-c:v libx264 -preset veryfast -crf 22 -c:a aac"]')
@click.option(
'--quiet', '-q',
is_flag=True, flag_value=True, help=
Expand Down Expand Up @@ -637,7 +637,7 @@ def split_video_command(ctx, output, filename, high_quality, override_args, quie
rate_factor = 22 if not high_quality else 17
if preset is None:
preset = 'veryfast' if not high_quality else 'slow'
override_args = ('-c:v libx264 -preset {PRESET} -crf {RATE_FACTOR} -c:a copy'.format(
override_args = ('-c:v libx264 -preset {PRESET} -crf {RATE_FACTOR} -c:a aac'.format(
PRESET=preset, RATE_FACTOR=rate_factor))
if not copy:
logging.info('FFmpeg codec args set: %s', override_args)
Expand Down
9 changes: 9 additions & 0 deletions scenedetect/frame_timecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,15 @@ def get_timecode(self, precision=3, use_rounding=True):
# Return hours, minutes, and seconds as a formatted timecode string.
return '%02d:%02d:%s' % (hrs, mins, secs)

def previous_frame(self):
# type: () -> FrameTimecode
"""
Returns a new FrameTimecode for the frame before this one.
:return: New FrameTimeCode object, one frame earlier
"""
new_timecode = FrameTimecode(self)
new_timecode.frame_num -= 1
return new_timecode

def _seconds_to_frames(self, seconds):
# type: (float) -> int
Expand Down
11 changes: 5 additions & 6 deletions scenedetect/video_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def split_video_mkvmerge(input_video_paths, scene_list, output_file_prefix,


def split_video_ffmpeg(input_video_paths, scene_list, output_file_template, video_name,
arg_override='-c:v libx264 -preset fast -crf 21 -c:a copy',
arg_override='-c:v libx264 -preset fast -crf 21 -c:a aac',
hide_progress=False, suppress_output=False):
# type: (List[str], List[Tuple[FrameTimecode, FrameTimecode]], Optional[str],
# Optional[str], Optional[bool]) -> None
Expand Down Expand Up @@ -229,13 +229,12 @@ def split_video_ffmpeg(input_video_paths, scene_list, output_file_template, vide
'-ss',
str(start_time.get_seconds()),
'-i',
input_video_paths[0]]
input_video_paths[0],
'-t',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter if -t is specified before or after the codec?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, as it still needs to transcode through the video to this point, it can't do file-based seeking to get the end point like it does the start

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I misunderstood, hence talking of file-based seeking.

I don't think it matters if it's before or after arg_override, would you prefer it go after?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preference, was just wondering if it was intentional or not. As-is is fine! :)

str(duration.get_seconds())
]
call_list += arg_override
call_list += [
'-strict',
'-2',
'-t',
str(duration.get_seconds()),
'-sn',
filename_template.safe_substitute(
VIDEO_NAME=video_name,
Expand Down