Skip to content

Commit b6d767e

Browse files
committed
Fix video to mp3 problem
1 parent 0f95dd6 commit b6d767e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

auto_editor/cmds/test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,19 @@ def test_example(self) -> None:
202202
assert audio.language == "eng"
203203
assert audio.layout.name == "stereo"
204204

205+
def test_video_to_mp3(self) -> None:
206+
out = self.main(["example.mp4"], [], output="example_ALTERED.mp3")
207+
with bv.open(out) as container:
208+
assert container.duration is not None
209+
assert container.duration > 17300000 and container.duration < 2 << 24
210+
211+
assert len(container.streams) == 1
212+
audio = container.streams[0]
213+
assert isinstance(audio, bv.AudioStream)
214+
assert audio.codec.name in ("mp3", "mp3float")
215+
assert audio.sample_rate == 48000
216+
assert audio.layout.name == "stereo"
217+
205218
def test_to_mono(self) -> None:
206219
out = self.main(["example.mp4"], ["-layout", "mono"], output="example_mono.mp4")
207220
with bv.open(out) as container:

auto_editor/edit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def make_media(tl: v3, output_path: str) -> None:
286286
output = bv.open(output_path, "w", container_options=options)
287287

288288
# Setup video
289-
if ctr.default_vid != "none" and tl.v:
289+
if ctr.default_vid not in ("none", "png") and tl.v:
290290
vframes = render_av(output, tl, args, log)
291291
output_stream: bv.VideoStream | None
292292
output_stream = next(vframes) # type: ignore

0 commit comments

Comments
 (0)