MCPcopy
hub / github.com/nadermx/backgroundremover / _alpha_encoding_args

Function _alpha_encoding_args

backgroundremover/utilities.py:25–52  ·  view source on GitHub ↗
(output, alpha_codec, alpha_pix_fmt)

Source from the content-addressed store, hash-verified

23
24
25def _alpha_encoding_args(output, alpha_codec, alpha_pix_fmt):
26 ext = Path(output).suffix.lower()
27 if alpha_codec in (None, "auto"):
28 if ext == ".webm":
29 alpha_codec = "libvpx-vp9"
30 else:
31 alpha_codec = "prores_ks"
32
33 if alpha_codec == "prores_ks":
34 args = ["-c:v", "prores_ks", "-profile:v", "4"]
35 pix_fmt = alpha_pix_fmt or "yuva444p10le"
36 args += ["-pix_fmt", pix_fmt]
37 return args
38
39 if alpha_codec == "libvpx-vp9":
40 args = ["-c:v", "libvpx-vp9", "-crf", "30", "-b:v", "0"]
41 pix_fmt = alpha_pix_fmt or "yuva420p"
42 args += ["-pix_fmt", pix_fmt]
43 return args
44
45 if alpha_codec == "qtrle":
46 pix_fmt = alpha_pix_fmt or "argb"
47 return ["-c:v", "qtrle", "-pix_fmt", pix_fmt]
48
49 args = ["-c:v", alpha_codec]
50 if alpha_pix_fmt:
51 args += ["-pix_fmt", alpha_pix_fmt]
52 return args
53
54
55def worker(worker_nodes,

Callers 3

transparentvideoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected