[BUG] cannot concatenate video files with manim-slides utils
Closed this issue · 5 comments
Terms
- Checked the existing issues and discussions to see if my issue had not already been reported;
- Checked the [frequently asked questions]](https://manim-slides.eertmans.be/latest/faq.html);
- Read the installation instructions;
- Created a virtual environment in which I can reproduce my bug;
Describe the issue
I can run the manim command and generate the video without errors, but manim-slides fails at generating the necessary files (like the .json needed for running the presentation).
I have tried older versions of manim-slides (until far back 5.1) and also with manim-lib. The error is the same across all tests
Command
manim-slides render example.py BasicExample
Issue Type
Installation issue
Python version
Python 3.12.0
Python environment
❯ manim-slides checkhealth
Manim Slides version: 5.1.9
Python executable: D:\OneDrive\Documents\PhD\Seminario\venv\Scripts\python.exe
Manim bindings:
manim (version: 0.18.1)
manimgl not found
No Qt API found, some Manim Slides commands will not be available
What is your platform?
Windows
Other platform
No response
Manim Slides Python code
from manim import * # or: from manimlib import *
from manim_slides import Slide
class BasicExample(Slide):
def construct(self):
circle = Circle(radius=3, color=BLUE)
dot = Dot()
self.play(GrowFromCenter(circle))
self.next_slide() # Waits user to press continue to go to the next slide
self.next_slide(loop=True) # Start loop
self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
self.next_slide() # This will start a new non-looping slide
self.play(dot.animate.move_to(ORIGIN))
Relevant log output
❯ manim-slides render example.py BasicExample
Manim Community v0.18.1
[12/02/24 18:10:15] INFO Animation 0 : Using cached data (hash : 3977891868_1210654341_223132457) cairo_renderer.py:88
INFO Animation 1 : Using cached data (hash : 2852726489_3931823519_1829105458) cairo_renderer.py:88
INFO Animation 2 : Using cached data (hash : 2852726489_3368153825_3481576351) cairo_renderer.py:88
INFO Combining to Movie file. scene_file_writer.py:617
INFO scene_file_writer.py:737
File ready at 'D:\OneDrive\Documents\PhD\Seminario\media\videos\example\1080p60\BasicExample.mp4'
INFO Rendered BasicExample scene.py:247
Played 3 animations
Concatenating animation files to 'slides\files\BasicExample' and generating reversed animations: 0%| | 0/3 [00:00<?, ?it/s][12/02/24 18:10:15] WARNING Processing video file utils.py:18
D:\OneDrive\Documents\PhD\Seminario\media\videos\example\1080p60\partial_movie_files\BasicExample\3977891868_121065
4341_223132457.mp4
WARNING Concatenating video files into utils.py:38
slides\files\BasicExample\83994b92f34023744dac3501adea8b80fbf32a8ea0841b11b086e80afd053578.mp4
WARNING Temporary file: C:\Users\lucas\AppData\Local\Temp\tmpva_ssmya.txt utils.py:39
WARNING Input video stream: <av.VideoStream #0 h264, yuv420p 1920x1080 at 0x1dd8f9fb2e0> utils.py:41
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ D:\OneDrive\Documents\PhD\Seminario\venv\Lib\site-packages\manim\cli\render\commands.py:120 in │
│ render │
│ │
│ 117 │ │ │ try: │
│ 118 │ │ │ │ with tempconfig({}): │
│ 119 │ │ │ │ │ scene = SceneClass() │
│ ❱ 120 │ │ │ │ │ scene.render() │
│ 121 │ │ │ except Exception: │
│ 122 │ │ │ │ error_console.print_exception() │
│ 123 │ │ │ │ sys.exit(1) │
│ │
│ D:\OneDrive\Documents\PhD\Seminario\venv\Lib\site-packages\manim_slides\slide\manim.py:136 in │
│ render │
│ │
│ 133 │ │ │
│ 134 │ │ config["max_files_cached"] = max_files_cached │
│ 135 │ │ │
│ ❱ 136 │ │ self._save_slides( │
│ 137 │ │ │ use_cache=not (config["disable_caching"] or self.disable_caching), │
│ 138 │ │ │ flush_cache=(config["flush_cache"] or self.flush_cache), │
│ 139 │ │ │ skip_reversing=self.skip_reversing, │
│ │
│ D:\OneDrive\Documents\PhD\Seminario\venv\Lib\site-packages\manim_slides\slide\base.py:532 in │
│ _save_slides │
│ │
│ 529 │ │ │ │
│ 530 │ │ │ # We only concat animations if it was not present │
│ 531 │ │ │ if not use_cache or not dst_file.exists(): │
│ ❱ 532 │ │ │ │ concatenate_video_files(slide_files, dst_file) │
│ 533 │ │ │ │
│ 534 │ │ │ # We only reverse video if it was not present │
│ 535 │ │ │ if not use_cache or not rev_file.exists(): │
│ │
│ D:\OneDrive\Documents\PhD\Seminario\venv\Lib\site-packages\manim_slides\utils.py:42 in │
│ concatenate_video_files │
│ │
│ 39 │ │ logger.warning(f"Temporary file: {tmp_file}") │
│ 40 │ │ input_video_stream = input_container.streams.video[0] │
│ 41 │ │ logger.warning(f"Input video stream: {input_video_stream}") │
│ ❱ 42 │ │ output_video_stream = output_container.add_stream( │
│ 43 │ │ │ template=input_video_stream, │
│ 44 │ │ ) │
│ 45 │
│ │
│ in av.container.output.OutputContainer.add_stream:47 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: add_stream() takes at least 1 positional argument (0 given)
Screenshots
No response
Additional information
❯ pip freeze
annotated-types==0.7.0
av==14.0.0
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7
click-default-group==1.2.4
cloup==3.0.5
colorama==0.4.6
decorator==5.1.1
glcontext==3.0.0
idna==3.10
isosurfaces==0.1.2
Jinja2==3.1.4
lxml==5.3.0
manim==0.18.1
manim-slides==5.1.9
ManimPango==0.6.0
mapbox_earcut==1.0.2
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdurl==0.1.2
moderngl==5.12.0
moderngl-window==3.0.2
networkx==3.4.2
numpy==2.1.3
packaging==24.2
pillow==11.0.0
pycairo==1.27.0
pydantic==2.10.2
pydantic-extra-types==2.10.0
pydantic_core==2.27.1
pydub==0.25.1
pyglet==2.0.18
PyGLM==2.7.3
Pygments==2.18.0
python-pptx==1.0.2
QtPy==2.4.2
requests==2.32.3
rich==13.9.4
rtoml==0.11.0
scipy==1.14.1
screeninfo==0.8.1
skia-pathops==0.8.0.post2
srt==3.5.3
svgelements==1.9.6
tqdm==4.67.1
typing_extensions==4.12.2
urllib3==2.2.3
watchdog==6.0.0
XlsxWriter==3.2.0
Folder tree:
|-- [Dir] pycache
|-- [Dir] media
|-- [Dir] slides
|-- [File] example.py
|-- [Dir] images
|-- [Dir] videos
|-- [Dir] example
|-- [Dir] example
|-- [Dir] 1080p60
|-- [Dir] partial_movie_files
|-- [File] BasicExample.mp4
|-- [Dir] BasicExample
|-- [File] 2852726489_2902030821_3481576351.mp4
|-- [File] 2852726489_3368153825_3481576351.mp4
|-- [File] 2852726489_3931823519_1829105458.mp4
|-- [File] 3977891868_1210654341_223132457.mp4
|-- [File] partial_movie_file_list.txt
|-- [File] uncached_00000.mp4
|-- [Dir] files
|-- [Dir] BasicExample
|-- [File] example.cpython-312.pyc
Recommended fix or suggestions
No response
Hi @luccpaiva, thank you for reporting this bug! It looks like PyAV just released v14, which contains undocumented breaking changes.
I will see when I can fix those. In the meantime, can you try installing av<14 ?
Tomorrow, I will release a patch version tomorrow that blocks PyAV 14.
Dear @jeertmans, it does run with an older version of PyAV (i.e. 13.1.0).
However, I now have a different issue, black screen. I will check for related issues and reach back to you.
okay this: #401 (comment) worked (PySide instead of PyQt).
Thank you for the quick reply, I have a presentation next week and I'd really like to use manim-slides, I guess now it's possible!
Nice, happy it solved your issue :D !