Skip to content

Commit

Permalink
Use PyAV rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Nov 19, 2024
1 parent 1e75da8 commit fcfc26f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions auto_editor/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ def make_media(tl: v3, output_path: str) -> None:
for i, sub_path in enumerate(sub_paths):
subtitle_input = av.open(sub_path)
subtitle_inputs.append(subtitle_input)
subtitle_stream = output.add_stream(
template=subtitle_input.streams.subtitles[0]
subtitle_stream = output.add_stream_from_template(
subtitle_input.streams.subtitles[0]
)
if i < len(src.subtitles) and src.subtitles[i].lang is not None:
subtitle_stream.metadata["language"] = src.subtitles[i].lang # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion auto_editor/render/subtitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def _ensure(input_: Input, format: str, stream: int) -> str:
output = av.open(output_bytes, "w", format=format)

in_stream = input_.streams.subtitles[stream]
out_stream = output.add_stream(template=in_stream)
out_stream = output.add_stream_from_template(in_stream)

for packet in input_.demux(in_stream):
if packet.dts is None:
Expand Down
3 changes: 2 additions & 1 deletion auto_editor/render/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import av
import numpy as np
from av.codec.context import ThreadType

from auto_editor.output import parse_bitrate
from auto_editor.timeline import TlImage, TlRect, TlVideo
Expand Down Expand Up @@ -110,7 +111,7 @@ def render_av(
for src, cn in cns.items():
if len(cn.streams.video) > 0:
stream = cn.streams.video[0]
stream.thread_type = "AUTO"
stream.thread_type = ThreadType.AUTO

if args.no_seek or stream.average_rate is None or stream.time_base is None:
sc_val = 4294967295 # 2 ** 32 - 1
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [{ name = "WyattBlue", email = "wyattblue@auto-editor.com" }]
requires-python = ">=3.10,<3.14"
dependencies = [
"numpy>=1.23.0,<3.0",
"pyav==13.1.*",
"pyav==14.*",
]
keywords = [
"video", "audio", "media", "editor", "editing",
Expand Down

0 comments on commit fcfc26f

Please sign in to comment.