(output, file_path,
worker_nodes,
gpu_batchsize,
model_name,
frame_limit=-1,
prefetched_batches=4,
framerate=-1,
alpha_codec="auto",
alpha_pix_fmt=None)
| 297 | |
| 298 | |
| 299 | def transparentvideo(output, file_path, |
| 300 | worker_nodes, |
| 301 | gpu_batchsize, |
| 302 | model_name, |
| 303 | frame_limit=-1, |
| 304 | prefetched_batches=4, |
| 305 | framerate=-1, |
| 306 | alpha_codec="auto", |
| 307 | alpha_pix_fmt=None): |
| 308 | temp_dir = tempfile.TemporaryDirectory() |
| 309 | tmpdirname = Path(temp_dir.name) |
| 310 | temp_file = os.path.abspath(os.path.join(tmpdirname, "matte.mp4")) |
| 311 | matte_key(temp_file, file_path, |
| 312 | worker_nodes, |
| 313 | gpu_batchsize, |
| 314 | model_name, |
| 315 | frame_limit, |
| 316 | prefetched_batches, |
| 317 | framerate) |
| 318 | print("Starting alphamerge") |
| 319 | encoding_args = _alpha_encoding_args(output, alpha_codec, alpha_pix_fmt) |
| 320 | cmd = [ |
| 321 | 'ffmpeg', '-y', '-i', file_path, '-i', temp_file, '-filter_complex', |
| 322 | '[1][0]scale2ref[mask][main];[main][mask]alphamerge[v]', |
| 323 | '-map', '[v]', '-map', '0:a?', '-shortest' |
| 324 | ] |
| 325 | cmd += encoding_args + [output] |
| 326 | |
| 327 | sp.run(cmd) |
| 328 | print("Process finished") |
| 329 | try: |
| 330 | temp_dir.cleanup() |
| 331 | except PermissionError: |
| 332 | pass |
| 333 | return |
| 334 | |
| 335 | |
| 336 | def transparentvideoovervideo(output, overlay, file_path, |
nothing calls this directly
no test coverage detected