diff --git a/auto_editor/cmds/test.py b/auto_editor/cmds/test.py index 2156a6994..2cfd82211 100644 --- a/auto_editor/cmds/test.py +++ b/auto_editor/cmds/test.py @@ -549,6 +549,15 @@ def edit_negative_tests(): def yuv442p(): return run.main(["resources/test_yuv422p.mp4"], []) + def prores(): + run.main(["resources/testsrc.mp4", "-c:v", "prores", "-o", "out.mkv"], []) + assert fileinfo("out.mkv").videos[0].pix_fmt == "yuv422p10le" + + run.main(["out.mkv", "-c:v", "prores", "-o", "out2.mkv"], []) + assert fileinfo("out2.mkv").videos[0].pix_fmt == "yuv422p10le" + + return "out.mkv", "out2.mkv" + # Issue 280 def SAR(): out = run.main(["resources/SAR-2by3.mp4"], []) @@ -735,6 +744,7 @@ def palet_scripts(): premiere, SAR, yuv442p, + prores, edit_negative_tests, edit_positive_tests, audio_norm_f, diff --git a/auto_editor/render/video.py b/auto_editor/render/video.py index 23fc458a3..3141dc23a 100644 --- a/auto_editor/render/video.py +++ b/auto_editor/render/video.py @@ -26,31 +26,7 @@ class VideoFrame: src: FileInfo -# From: github.com/PyAV-Org/PyAV/blob/main/av/video/frame.pyx -allowed_pix_fmt = { - "yuv420p", - "yuvj420p", - "yuv444p", - "yuvj444p", - "rgb48be", - "rgb48le", - "rgb64be", - "rgb64le", - "rgb24", - "bgr24", - "argb", - "rgba", - "abgr", - "bgra", - "gray", - "gray8", - "gray16be", - "gray16le", - "rgb8", - "bgr8", - "pal8", -} - +allowed_pix_fmt = av.video.frame.supported_np_pix_fmts def make_solid(width: int, height: int, pix_fmt: str, bg: str) -> av.VideoFrame: hex_color = bg.lstrip("#").upper() @@ -132,15 +108,14 @@ def render_av( codec = av.Codec(args.video_codec, "w") - if args.video_codec == "gif": + if codec.id == 97: # gif if codec.video_formats is not None and target_pix_fmt in ( f.name for f in codec.video_formats ): target_pix_fmt = target_pix_fmt else: target_pix_fmt = "rgb8" - - elif args.video_codec == "prores": + elif codec.id == 147: # prores target_pix_fmt = "yuv422p10le" else: target_pix_fmt = ( @@ -336,10 +311,7 @@ def render_av( frame = scale_graph.vpull() if frame.format.name != target_pix_fmt: - if target_pix_fmt == "yuv422p10le": # workaround for prores - frame = frame.reformat(format="yuv444p16le") - else: - frame = frame.reformat(format=target_pix_fmt) + frame = frame.reformat(format=target_pix_fmt) bar.tick(index) elif index % 3 == 0: bar.tick(index) diff --git a/pyproject.toml b/pyproject.toml index ccbc2d16b..2d20ee61d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ authors = [{ name = "WyattBlue", email = "wyattblue@auto-editor.com" }] requires-python = ">=3.10,<3.14" dependencies = [ "numpy>=1.24,<3.0", - "pyav==14.*", + "pyav==14.2.0rc1", ] keywords = [ "video", "audio", "media", "editor", "editing",