mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
Merge pull request #5031 from vladmandic/fix/video-codec-options
fix(video): correct codec option strings to the key=value form
This commit is contained in:
@@ -38,7 +38,7 @@ class ReqVideo(BaseModel):
|
||||
mp4_interpolate: int = Field(default=0, ge=0, le=10, title="Interpolation", description="RIFE interpolation passes between frames")
|
||||
mp4_codec: str = Field(default="libx264", title="Codec", description="Video codec; none skips video encoding")
|
||||
mp4_ext: str = Field(default="mp4", title="Container", description="Container extension; the muxer is inferred from it")
|
||||
mp4_opt: str = Field(default="crf:16", title="Codec options", description="Encoder options as comma-separated key:value pairs")
|
||||
mp4_opt: str = Field(default="crf=16", title="Codec options", description="Encoder options as key=value pairs separated by : or ,")
|
||||
mp4_video: bool = Field(default=True, title="Save video", description="Write the video container to disk")
|
||||
mp4_frames: bool = Field(default=False, title="Save frames", description="Write individual frame images to disk")
|
||||
mp4_sf: bool = Field(default=False, title="Save safetensors", description="Write raw frames as a safetensors file")
|
||||
|
||||
@@ -34,7 +34,7 @@ class ReqFramepack(BaseModel):
|
||||
mp4_video: bool | None = Field(default=True, title="Save Video", description="Save video")
|
||||
mp4_frames: bool | None = Field(default=False, title="Save Frames", description="Save frames for the video")
|
||||
mp4_thumb: bool | None = Field(default=True, title="Save Thumbnail", description="Save thumbnail for the video")
|
||||
mp4_opt: str | None = Field(default="crf:16", title="Options", description="Options for the video codec")
|
||||
mp4_opt: str | None = Field(default="crf=16", title="Options", description="Options for the video codec")
|
||||
mp4_ext: str | None = Field(default="mp4", title="Format", description="Format for the video")
|
||||
mp4_interpolate: int | None = Field(default=0, title="Interpolation", description="Interpolation for the video")
|
||||
attention: str | None = Field(default="Default", title="Attention", description="Attention type for the model")
|
||||
|
||||
@@ -248,7 +248,7 @@ class UpscalerSeedVR(Upscaler):
|
||||
log.error(f'Upscaler: name="SeedVR2" video="{video_path}" {e}')
|
||||
return None, None, None
|
||||
|
||||
def create_video(self, tensor: torch.Tensor, audio, codec: str = 'libx264', codec_opt: str = 'crf:16', interpolate: int = 0):
|
||||
def create_video(self, tensor: torch.Tensor, audio, codec: str = 'libx264', codec_opt: str = 'crf=16', interpolate: int = 0):
|
||||
t0 = time.time()
|
||||
from modules.video_models.video_save import save_video
|
||||
pixels = tensor.permute(3, 0, 1, 2).unsqueeze(0) # from (t, h, w, c) to (n, c, t, h, w)
|
||||
@@ -281,7 +281,7 @@ class UpscalerSeedVR(Upscaler):
|
||||
offload: bool = True,
|
||||
interpolate: int = 1,
|
||||
codec: str = 'libx264',
|
||||
codec_opt: str = 'crf:16',
|
||||
codec_opt: str = 'crf=16',
|
||||
vae_memory: float = 0.5,
|
||||
vae_tile_encode: bool = True,
|
||||
vae_tile_decode: bool = True,
|
||||
|
||||
@@ -26,14 +26,14 @@ codecs_config = {
|
||||
'desc': 'Legacy open video format for WebM.',
|
||||
'ext': 'webm',
|
||||
'allowed_exts': ['webm', 'mkv'],
|
||||
'options': 'crf=10:b:v=0',
|
||||
'options': 'crf=10:b=0',
|
||||
},
|
||||
'libvpx-vp9': {
|
||||
'name': 'VP9 Video',
|
||||
'desc': 'Royalty-free web video format.',
|
||||
'ext': 'webm',
|
||||
'allowed_exts': ['webm', 'mkv'],
|
||||
'options': 'crf=23:b:v=0',
|
||||
'options': 'crf=23:b=0',
|
||||
},
|
||||
'libsvtav1': {
|
||||
'name': 'AV1 (SVT-AV1)',
|
||||
@@ -47,14 +47,14 @@ codecs_config = {
|
||||
'desc': 'Legacy format for old media players.',
|
||||
'ext': 'mp4',
|
||||
'allowed_exts': ['mp4', 'avi', 'mkv'],
|
||||
'options': 'qscale:v=3',
|
||||
'options': 'qmin=3:qmax=3',
|
||||
},
|
||||
'mjpeg': {
|
||||
'name': 'Motion JPEG',
|
||||
'desc': 'Sequence of JPEG frames; minimal CPU load.',
|
||||
'ext': 'avi',
|
||||
'allowed_exts': ['avi', 'mov', 'mkv'],
|
||||
'options': 'qscale:v=3',
|
||||
'options': 'qmin=3:qmax=3',
|
||||
},
|
||||
|
||||
# --- Hardware Accelerated: NVIDIA NVENC ---
|
||||
|
||||
@@ -110,7 +110,7 @@ def run(selected: models_def.Model, *,
|
||||
mp4_interpolate: int = 0,
|
||||
mp4_codec: str = 'libx264',
|
||||
mp4_ext: str = 'mp4',
|
||||
mp4_opt: str = 'crf:16',
|
||||
mp4_opt: str = 'crf=16',
|
||||
mp4_video: bool = True,
|
||||
mp4_frames: bool = False,
|
||||
mp4_sf: bool = False,
|
||||
|
||||
Reference in New Issue
Block a user