Anpassung --cut flag
This commit is contained in:
@@ -95,7 +95,25 @@ def write_vtt(path: Path, lines: tuple[str, ...]) -> Path:
|
||||
return path
|
||||
|
||||
|
||||
def create_source_fixture(workdir: Path, filename: str, tracks: list[SourceTrackSpec], duration_seconds: int = 1) -> Path:
|
||||
def create_source_fixture(
|
||||
workdir: Path,
|
||||
filename: str,
|
||||
tracks: list[SourceTrackSpec],
|
||||
duration_seconds: int = 1,
|
||||
*,
|
||||
video_encoder: str = "libx264",
|
||||
video_encoder_options: tuple[str, ...] = (
|
||||
"-preset",
|
||||
"ultrafast",
|
||||
"-crf",
|
||||
"35",
|
||||
"-pix_fmt",
|
||||
"yuv420p",
|
||||
),
|
||||
audio_encoder: str = "aac",
|
||||
audio_encoder_options: tuple[str, ...] = ("-b:a", "48k"),
|
||||
subtitle_encoder: str = "webvtt",
|
||||
) -> Path:
|
||||
output_path = workdir / filename
|
||||
|
||||
has_video = any(track.track_type == TrackType.VIDEO for track in tracks)
|
||||
@@ -189,21 +207,16 @@ def create_source_fixture(workdir: Path, filename: str, tracks: list[SourceTrack
|
||||
command += map_tokens
|
||||
command += metadata_tokens
|
||||
command += disposition_tokens
|
||||
if has_video:
|
||||
command += ["-c:v", video_encoder] + list(video_encoder_options)
|
||||
|
||||
if has_audio:
|
||||
command += ["-c:a", audio_encoder] + list(audio_encoder_options)
|
||||
|
||||
if subtitle_input_indices:
|
||||
command += ["-c:s", subtitle_encoder]
|
||||
|
||||
command += [
|
||||
"-c:v",
|
||||
"libx264",
|
||||
"-preset",
|
||||
"ultrafast",
|
||||
"-crf",
|
||||
"35",
|
||||
"-pix_fmt",
|
||||
"yuv420p",
|
||||
"-c:a",
|
||||
"aac",
|
||||
"-b:a",
|
||||
"48k",
|
||||
"-c:s",
|
||||
"webvtt",
|
||||
"-t",
|
||||
str(duration_seconds),
|
||||
"-shortest",
|
||||
|
||||
Reference in New Issue
Block a user