Skip to content

AddTextLetterByLetter() with blank MarkupText renders broken partial movie #3378

@HairlessVillager

Description

@HairlessVillager

Description of bug / unexpected behavior

When use AddTextLetterByLetter() to render an animation for a blank MarkupText(e.g. MarkupText('<span bgcolor="#777777"></span>')), manim will render a broken video, which cannot be opened by Media Player in Windows or decoded by ffmpeg. In --preview, a FileNotFoundError will be thrown by manim. This bug will occur when another scene's movie has been rendered before.

Expected behavior

Just be like AddTextLetterByLetter(Text("")).

How to reproduce the issue

  1. Delete media/videos/problem_recurrence if exists.
  2. Run manim problem_recurrence.py TextCreateScene.
  3. Run manim problem_recurrence.py MarkupTextAddTextLetterByLetterScene.
  4. Try open media/videos/problem_recurrence/1080p60/partial_movie_files/MarkupTextAddTextLetterByLetterScene/1413466013_3861299098_223132457.mp4(hash maybe change) with Media Player, failed with some info: pPTjqZF.png
  5. Try encode it by ffmpeg -i 1413466013_3861299098_223132457.mp4 -r 1 %03d.png, failed with info Output file #0 does not contain any stream.
Code for reproducing the problem
""" problem_recurrence.py
"""
from manim import *


class TextCreateScene(Scene):

    def construct(self):
        text = Text("some harmless text")
        self.play(Create(text))


class MarkupTextAddTextLetterByLetterScene(Scene):

    def construct(self):
        blank_markup_text = MarkupText('<span bgcolor="#777777"></span>')
        self.play(AddTextLetterByLetter(blank_markup_text))

Additional media files

No additional media file becasue it's broken.

Images/GIFs

Logs

Terminal output
(visualcode) E:\code\python\visualcode>manim problem_recurrence.py TextCreateScene -v DEBUG
Manim Community v0.17.3

[09/24/23 18:34:20] DEBUG    Hashing ...                                                           hashing.py:350
                    DEBUG    Hashing done in 0.108516 s.                                           hashing.py:362
                    DEBUG    Hash generated :  1413466013_3703300622_223132457                     hashing.py:365
                    DEBUG    List of the first few animation hashes of the scene:            cairo_renderer.py:87
                             ['1413466013_3703300622_223132457']
[09/24/23 18:34:22] INFO     Animation 0 : Partial movie file written in                 scene_file_writer.py:527
                             'E:\code\python\visualcode\media\videos\problem_recurrence\
                             1080p60\partial_movie_files\TextCreateScene\1413466013_3703
                             300622_223132457.mp4'
                    INFO     Combining to Movie file.                                    scene_file_writer.py:617
                    DEBUG    Partial movie files to combine (1 files):                   scene_file_writer.py:561
                             ['E:\\code\\python\\visualcode\\media\\videos\\problem_recu
                             rrence\\1080p60\\partial_movie_files\\TextCreateScene\\1413
                             466013_3703300622_223132457.mp4']
                    INFO                                                                 scene_file_writer.py:736
                             File ready at
                             'E:\code\python\visualcode\media\videos\problem_recurrence\
                             1080p60\TextCreateScene.mp4'

                    INFO     Rendered TextCreateScene                                                scene.py:241
                             Played 1 animations

(visualcode) E:\code\python\visualcode>manim problem_recurrence.py MarkupTextAddTextLetterByLetterScene -v DEBUG
Manim Community v0.17.3

[09/24/23 18:34:38] DEBUG    Hashing ...                                                           hashing.py:350
                    DEBUG    Hashing done in 0.007872 s.                                           hashing.py:362
                    DEBUG    Hash generated :  1413466013_3861299098_223132457                     hashing.py:365
                    DEBUG    List of the first few animation hashes of the scene:            cairo_renderer.py:87
                             ['1413466013_3861299098_223132457']
                    INFO     Animation 0 : Partial movie file written in                 scene_file_writer.py:527
                             'E:\code\python\visualcode\media\videos\problem_recurrence\
                             1080p60\partial_movie_files\MarkupTextAddTextLetterByLetter
                             Scene\1413466013_3861299098_223132457.mp4'
                    INFO     Combining to Movie file.                                    scene_file_writer.py:617
                    DEBUG    Partial movie files to combine (1 files):                   scene_file_writer.py:561
                             ['E:\\code\\python\\visualcode\\media\\videos\\problem_recu
                             rrence\\1080p60\\partial_movie_files\\MarkupTextAddTextLett
                             erByLetterScene\\1413466013_3861299098_223132457.mp4']
Output file #0 does not contain any stream
                    INFO                                                                 scene_file_writer.py:736
                             File ready at
                             'E:\code\python\visualcode\media\videos\problem_recurrence\
                             1080p60\MarkupTextAddTextLetterByLetterScene.mp4'

                    INFO     Rendered MarkupTextAddTextLetterByLetterScene                           scene.py:241
                             Played 1 animations

System specifications

System Details
  • OS: Windows 10 22H2 19045.3448
  • RAM: 16.0 GB
  • Python version: Python 3.8.18
  • Installed modules (provide output from pip list):
Package              Version
-------------------- ---------
asttokens            2.4.0
attrs                23.1.0
backcall             0.2.0
Brotli               1.1.0
build                0.10.0
CacheControl         0.13.1
certifi              2023.7.22
cffi                 1.15.1
charset-normalizer   3.2.0
cleo                 2.0.1
click                8.1.7
click-default-group  1.2.4
cloup                0.13.1
colorama             0.4.6
colour               0.1.5
contourpy            1.1.1
crashtest            0.4.1
cryptography         41.0.4
cycler               0.11.0
dataclasses          0.8
decorator            5.1.1
distlib              0.3.7
dulwich              0.21.6
executing            1.2.0
filelock             3.12.4
fonttools            4.42.1
future               0.18.3
glcontext            2.3.7
idna                 3.4
importlib-metadata   6.8.0
importlib-resources  6.0.1
installer            0.7.0
ipython              8.12.2
isosurfaces          0.1.0
jaraco.classes       3.3.0
jedi                 0.19.0
jsonschema           4.17.3
keyring              24.2.0
kiwisolver           1.4.5
manim                0.17.3
ManimPango           0.4.3
mapbox-earcut        1.0.0
markdown-it-py       3.0.0
matplotlib           3.7.3
matplotlib-inline    0.1.6
mdurl                0.1.0
moderngl             5.8.2
moderngl-window      2.4.1
more-itertools       10.1.0
mpmath               1.3.0
msgpack              1.0.5
multipledispatch     0.6.0
networkx             2.8.8
numpy                1.24.4
packaging            23.1
parso                0.8.3
pexpect              4.8.0
pickleshare          0.7.5
Pillow               9.5.0
pip                  23.2.1
pkginfo              1.9.6
pkgutil_resolve_name 1.3.10
platformdirs         3.10.0
poetry               1.6.1
poetry-core          1.7.0
poetry-plugin-export 1.5.0
pooch                1.7.0
prompt-toolkit       3.0.39
ptyprocess           0.7.0
pure-eval            0.2.2
pycairo              1.24.0
pycparser            2.21
pydub                0.25.1
pyglet               1.5.27
Pygments             2.15.1
PyOpenGL             3.1.7
pyOpenSSL            23.2.0
pyparsing            3.1.1
pyperclip            1.8.2
pyproject_hooks      1.0.0
pyrr                 0.10.3
pyrsistent           0.19.3
PySocks              1.7.1
python-dateutil      2.8.2
pywin32-ctypes       0.2.2
PyYAML               6.0.1
rapidfuzz            2.15.1
requests             2.31.0
requests-toolbelt    1.0.0
rich                 13.5.3
scipy                1.10.1
screeninfo           0.8.1
setuptools           68.0.0
shellingham          1.5.3
six                  1.16.0
skia-pathops         0.7.4
srt                  3.5.2
stack-data           0.6.2
svgelements          1.9.6
sympy                1.12
tomli                2.0.1
tomlkit              0.12.1
tqdm                 4.66.1
traitlets            5.10.0
trove-classifiers    2023.9.19
typing_extensions    4.8.0
urllib3              2.0.5
validators           0.22.0
virtualenv           20.24.4
watchdog             2.2.1
wcwidth              0.2.6
wheel                0.38.4
win-inet-pton        1.1.0
zipp                 3.17.0
LaTeX details
FFMPEG

Output of ffmpeg -version:

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.1 (GCC) 20200726
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100
libpostproc    55.  7.100 / 55.  7.100

Additional comments

visualcode is a conda environment.

Output of `conda list` ``` (visualcode) E:\code\python\visualcode>conda list # packages in environment at D:\Anaconda\anaconda3\envs\visualcode: # # Name Version Build Channel asttokens 2.4.0 pypi_0 pypi attrs 23.1.0 pyh71513ae_1 conda-forge backcall 0.2.0 pypi_0 pypi brotli-python 1.1.0 py38hd3f51b4_0 conda-forge bzip2 1.0.8 h8ffe710_4 conda-forge ca-certificates 2023.08.22 haa95532_0 cachecontrol 0.13.1 pyhd8ed1ab_0 conda-forge cachecontrol-with-filecache 0.13.1 pyhd8ed1ab_0 conda-forge cairo 1.16.0 h412253b_1017 conda-forge certifi 2023.7.22 py38haa95532_0 cffi 1.15.1 py38h57701bc_3 conda-forge charset-normalizer 3.2.0 pyhd8ed1ab_0 conda-forge cleo 2.0.1 pyhd8ed1ab_0 conda-forge click 8.1.7 win_pyh7428d3b_0 conda-forge click-default-group 1.2.4 pyhd8ed1ab_0 conda-forge cloup 0.13.1 pyhd8ed1ab_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge colour 0.1.5 pypi_0 pypi contourpy 1.1.1 pypi_0 pypi crashtest 0.4.1 pyhd8ed1ab_0 conda-forge cryptography 41.0.4 py38h95f5157_0 conda-forge cycler 0.11.0 pypi_0 pypi dataclasses 0.8 pyhc8e2a94_3 conda-forge decorator 5.1.1 pyhd8ed1ab_0 conda-forge distlib 0.3.7 pyhd8ed1ab_0 conda-forge dulwich 0.21.6 py38h91455d4_0 conda-forge executing 1.2.0 pypi_0 pypi expat 2.5.0 h63175ca_1 conda-forge ffmpeg 4.3.1 ha925a31_0 conda-forge filelock 3.12.4 pyhd8ed1ab_0 conda-forge font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge font-ttf-inconsolata 3.000 h77eed37_0 conda-forge font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge font-ttf-ubuntu 0.83 hab24e00_0 conda-forge fontconfig 2.14.2 hbde0cde_0 conda-forge fonts-conda-ecosystem 1 0 conda-forge fonts-conda-forge 1 0 conda-forge fonttools 4.42.1 pypi_0 pypi freetype 2.12.1 hdaf720e_2 conda-forge fribidi 1.0.10 h8d14728_0 conda-forge future 0.18.3 pyhd8ed1ab_0 conda-forge gettext 0.21.1 h5728263_0 conda-forge glcontext 2.4.0 pypi_0 pypi glib 2.78.0 h12be248_0 conda-forge glib-tools 2.78.0 h12be248_0 conda-forge graphite2 1.3.13 1000 conda-forge harfbuzz 8.2.1 h7ab893a_0 conda-forge icu 73.2 h63175ca_0 conda-forge idna 3.4 pyhd8ed1ab_0 conda-forge importlib-metadata 6.8.0 pyha770c72_0 conda-forge importlib-resources 6.1.0 pypi_0 pypi importlib_metadata 6.8.0 hd8ed1ab_0 conda-forge importlib_resources 6.0.1 pyhd8ed1ab_0 conda-forge intel-openmp 2023.2.0 h57928b3_49502 conda-forge ipython 8.12.2 pypi_0 pypi isosurfaces 0.1.0 pyhd8ed1ab_0 conda-forge jaraco.classes 3.3.0 pyhd8ed1ab_0 conda-forge jedi 0.19.0 pypi_0 pypi jsonschema 4.17.3 pyhd8ed1ab_0 conda-forge keyring 24.2.0 py38haa244fe_0 conda-forge kiwisolver 1.4.5 pypi_0 pypi lcms2 2.15 h3e3b177_1 conda-forge lerc 4.0.0 h63175ca_0 conda-forge libblas 3.9.0 18_win64_mkl conda-forge libcblas 3.9.0 18_win64_mkl conda-forge libdeflate 1.18 hcfcfb64_0 conda-forge libexpat 2.5.0 h63175ca_1 conda-forge libffi 3.4.4 hd77b12b_0 libglib 2.78.0 he8f3873_0 conda-forge libhwloc 2.9.2 default_haede6df_1009 conda-forge libiconv 1.17 h8ffe710_0 conda-forge libjpeg-turbo 2.1.5.1 hcfcfb64_1 conda-forge liblapack 3.9.0 18_win64_mkl conda-forge libpng 1.6.39 h19919ed_0 conda-forge libtiff 4.5.1 h6c8260b_1 conda-forge libwebp-base 1.3.2 hcfcfb64_0 conda-forge libxcb 1.15 hcd874cb_0 conda-forge libxml2 2.11.5 hc3477c8_1 conda-forge libzlib 1.2.13 hcfcfb64_5 conda-forge m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge manim 0.17.3 pyhd8ed1ab_0 conda-forge manimpango 0.4.3 py38hd9736c4_0 conda-forge mapbox-earcut 1.0.1 pypi_0 pypi mapbox_earcut 1.0.0 py38hb1fd069_5 conda-forge markdown-it-py 3.0.0 pyhd8ed1ab_0 conda-forge matplotlib 3.7.3 pypi_0 pypi matplotlib-inline 0.1.6 pypi_0 pypi mdurl 0.1.2 pypi_0 pypi mkl 2022.1.0 h6a75c08_874 conda-forge moderngl 5.8.2 py38h5846ac1_0 conda-forge moderngl-window 2.4.4 pypi_0 pypi more-itertools 10.1.0 pyhd8ed1ab_0 conda-forge mpmath 1.3.0 pypi_0 pypi msgpack-python 1.0.5 py38hb1fd069_0 conda-forge msys2-conda-epoch 20160418 1 conda-forge multipledispatch 1.0.0 pypi_0 pypi networkx 2.8.8 pyhd8ed1ab_0 conda-forge numpy 1.24.4 py38h1d91fd2_0 conda-forge openjpeg 2.5.0 ha2aaf27_2 conda-forge openssl 3.1.3 hcfcfb64_0 conda-forge packaging 23.1 pyhd8ed1ab_0 conda-forge pango 1.50.14 h07c897b_2 conda-forge parso 0.8.3 pypi_0 pypi pcre2 10.40 h17e33f8_0 conda-forge pexpect 4.8.0 pyh1a96a4e_2 conda-forge pickleshare 0.7.5 pypi_0 pypi pillow 9.5.0 py38ha7eb54a_1 conda-forge pip 23.2.1 py38haa95532_0 pixman 0.40.0 h8ffe710_0 conda-forge pkginfo 1.9.6 pyhd8ed1ab_0 conda-forge pkgutil-resolve-name 1.3.10 pyhd8ed1ab_1 conda-forge platformdirs 3.10.0 pyhd8ed1ab_0 conda-forge poetry 1.6.1 win_pyh7428d3b_0 conda-forge poetry-core 1.7.0 pyhd8ed1ab_0 conda-forge poetry-plugin-export 1.5.0 pyhd8ed1ab_0 conda-forge pooch 1.7.0 pyha770c72_3 conda-forge prompt-toolkit 3.0.39 pypi_0 pypi pthread-stubs 0.4 hcd874cb_1001 conda-forge pthreads-win32 2.9.1 hfa6e2cd_3 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge pure-eval 0.2.2 pypi_0 pypi pycairo 1.24.0 py38h5818bea_0 conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pydub 0.25.1 pyhd8ed1ab_0 conda-forge pyglet 2.0.9 pypi_0 pypi pygments 2.15.1 py38haa95532_1 pyopengl 3.1.7 pypi_0 pypi pyopenssl 23.2.0 pyhd8ed1ab_1 conda-forge pyparsing 3.1.1 pypi_0 pypi pyperclip 1.8.2 pypi_0 pypi pyproject_hooks 1.0.0 pyhd8ed1ab_0 conda-forge pyrr 0.10.3 py_0 conda-forge pyrsistent 0.19.3 py38h91455d4_0 conda-forge pysocks 1.7.1 pyh0701188_6 conda-forge python 3.8.18 h1aa4202_0 python-build 0.10.0 pyhd8ed1ab_1 conda-forge python-dateutil 2.8.2 pypi_0 pypi python-installer 0.7.0 pyhd8ed1ab_0 conda-forge python_abi 3.8 2_cp38 conda-forge pywin32-ctypes 0.2.2 py38haa244fe_0 conda-forge pyyaml 6.0.1 py38h91455d4_0 conda-forge rapidfuzz 2.15.1 py38hd3f51b4_0 conda-forge requests 2.31.0 pyhd8ed1ab_0 conda-forge requests-toolbelt 1.0.0 pyhd8ed1ab_0 conda-forge rich 13.5.3 pyhd8ed1ab_0 conda-forge scipy 1.10.1 pypi_0 pypi screeninfo 0.8.1 py38haa244fe_1 conda-forge setuptools 68.0.0 py38haa95532_0 shellingham 1.5.3 pyhd8ed1ab_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge skia-pathops 0.8.0.post1 pypi_0 pypi sqlite 3.41.2 h2bbff1b_0 srt 3.5.2 py38haa244fe_5 conda-forge stack-data 0.6.2 pypi_0 pypi svgelements 1.9.6 pyhd8ed1ab_0 conda-forge sympy 1.12 pypi_0 pypi tbb 2021.10.0 h91493d7_0 conda-forge tk 8.6.12 h8ffe710_0 conda-forge tomli 2.0.1 pyhd8ed1ab_0 conda-forge tomlkit 0.12.1 pyha770c72_0 conda-forge tqdm 4.66.1 pyhd8ed1ab_0 conda-forge traitlets 5.10.0 pypi_0 pypi trove-classifiers 2023.9.19 pyhd8ed1ab_0 conda-forge typing-extensions 4.8.0 hd8ed1ab_0 conda-forge typing_extensions 4.8.0 pyha770c72_0 conda-forge ucrt 10.0.22621.0 h57928b3_0 conda-forge urllib3 2.0.5 pyhd8ed1ab_0 conda-forge validators 0.22.0 pypi_0 pypi vc 14.2 h21ff451_1 vc14_runtime 14.36.32532 hdcecf7f_17 conda-forge virtualenv 20.24.4 pyhd8ed1ab_0 conda-forge vs2015_runtime 14.36.32532 h05e6639_17 conda-forge watchdog 2.2.1 py38haa244fe_0 conda-forge wcwidth 0.2.6 pypi_0 pypi wheel 0.38.4 py38haa95532_0 win_inet_pton 1.1.0 pyhd8ed1ab_6 conda-forge xorg-libxau 1.0.11 hcd874cb_0 conda-forge xorg-libxdmcp 1.1.3 hcd874cb_0 conda-forge xz 5.2.6 h8d14728_0 conda-forge yaml 0.2.5 h8ffe710_2 conda-forge zipp 3.17.0 pyhd8ed1ab_0 conda-forge zlib 1.2.13 hcfcfb64_5 conda-forge zstd 1.5.5 h12be248_0 conda-forge ```

Metadata

Metadata

Labels

issue:bugSomething isn't working... For use in issues

Type

No type

Projects

Status

🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions