Skip to content

Commit 295d44b

Browse files
committed
Make prores -> prores work
1 parent 0dd0deb commit 295d44b

File tree

3 files changed

+15
-33
lines changed

3 files changed

+15
-33
lines changed

auto_editor/cmds/test.py

+10
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,15 @@ def edit_negative_tests():
549549
def yuv442p():
550550
return run.main(["resources/test_yuv422p.mp4"], [])
551551

552+
def prores():
553+
run.main(["resources/testsrc.mp4", "-c:v", "prores", "-o", "out.mkv"], [])
554+
assert fileinfo("out.mkv").videos[0].pix_fmt == "yuv422p10le"
555+
556+
run.main(["out.mkv", "-c:v", "prores", "-o", "out2.mkv"], [])
557+
assert fileinfo("out2.mkv").videos[0].pix_fmt == "yuv422p10le"
558+
559+
return "out.mkv", "out2.mkv"
560+
552561
# Issue 280
553562
def SAR():
554563
out = run.main(["resources/SAR-2by3.mp4"], [])
@@ -735,6 +744,7 @@ def palet_scripts():
735744
premiere,
736745
SAR,
737746
yuv442p,
747+
prores,
738748
edit_negative_tests,
739749
edit_positive_tests,
740750
audio_norm_f,

auto_editor/render/video.py

+4-32
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,7 @@ class VideoFrame:
2626
src: FileInfo
2727

2828

29-
# From: github.com/PyAV-Org/PyAV/blob/main/av/video/frame.pyx
30-
allowed_pix_fmt = {
31-
"yuv420p",
32-
"yuvj420p",
33-
"yuv444p",
34-
"yuvj444p",
35-
"rgb48be",
36-
"rgb48le",
37-
"rgb64be",
38-
"rgb64le",
39-
"rgb24",
40-
"bgr24",
41-
"argb",
42-
"rgba",
43-
"abgr",
44-
"bgra",
45-
"gray",
46-
"gray8",
47-
"gray16be",
48-
"gray16le",
49-
"rgb8",
50-
"bgr8",
51-
"pal8",
52-
}
53-
29+
allowed_pix_fmt = av.video.frame.supported_np_pix_fmts
5430

5531
def make_solid(width: int, height: int, pix_fmt: str, bg: str) -> av.VideoFrame:
5632
hex_color = bg.lstrip("#").upper()
@@ -132,15 +108,14 @@ def render_av(
132108

133109
codec = av.Codec(args.video_codec, "w")
134110

135-
if args.video_codec == "gif":
111+
if codec.id == 97: # gif
136112
if codec.video_formats is not None and target_pix_fmt in (
137113
f.name for f in codec.video_formats
138114
):
139115
target_pix_fmt = target_pix_fmt
140116
else:
141117
target_pix_fmt = "rgb8"
142-
143-
elif args.video_codec == "prores":
118+
elif codec.id == 147: # prores
144119
target_pix_fmt = "yuv422p10le"
145120
else:
146121
target_pix_fmt = (
@@ -336,10 +311,7 @@ def render_av(
336311
frame = scale_graph.vpull()
337312

338313
if frame.format.name != target_pix_fmt:
339-
if target_pix_fmt == "yuv422p10le": # workaround for prores
340-
frame = frame.reformat(format="yuv444p16le")
341-
else:
342-
frame = frame.reformat(format=target_pix_fmt)
314+
frame = frame.reformat(format=target_pix_fmt)
343315
bar.tick(index)
344316
elif index % 3 == 0:
345317
bar.tick(index)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors = [{ name = "WyattBlue", email = "wyattblue@auto-editor.com" }]
1010
requires-python = ">=3.10,<3.14"
1111
dependencies = [
1212
"numpy>=1.24,<3.0",
13-
"pyav==14.*",
13+
"pyav==14.2.0rc1",
1414
]
1515
keywords = [
1616
"video", "audio", "media", "editor", "editing",

0 commit comments

Comments
 (0)