Closed Copy-Hao closed 7 months ago
I don't know where you have found self.camera.reset_pixel_shape(1600, 900)
but the working solution to change the pixel resolution together with the scaling of the scene's coordinate system looks like this:
from manim import *
config.frame_width=16
config.frame_height=9
config.pixel_width=1600
config.pixel_height=900
class ProofWithoutWords(Scene):
def beginning(self):
self.camera.background_color = "#ece6e2"
banner = ManimBanner(dark_theme=False)
self.play(banner.create())
self.play(banner.expand())
self.wait()
self.play(Unwrite(banner))
def section1(self):
text1 = Text(
'Google',
t2c={'[:1]': '#3174f0', '[1:2]': '#e53125',
'[2:3]': '#fbb003', '[3:4]': '#3174f0',
'[4:5]': '#269a43', '[5:]': '#e53125'}, font_size=58).scale(3)
self.add(text1)
pass
def construct(self):
#self.camera.reset_pixel_shape(1600, 900)
# video incorrect display
self.beginning()
# image correct display
# self.section1()
I don't know where you have found
self.camera.reset_pixel_shape(1600, 900)
but the working solution to change the pixel resolution together with the scaling of the scene's coordinate system looks like this:from manim import * config.frame_width=16 config.frame_height=9 config.pixel_width=1600 config.pixel_height=900 class ProofWithoutWords(Scene): def beginning(self): self.camera.background_color = "#ece6e2" banner = ManimBanner(dark_theme=False) self.play(banner.create()) self.play(banner.expand()) self.wait() self.play(Unwrite(banner)) def section1(self): text1 = Text( 'Google', t2c={'[:1]': '#3174f0', '[1:2]': '#e53125', '[2:3]': '#fbb003', '[3:4]': '#3174f0', '[4:5]': '#269a43', '[5:]': '#e53125'}, font_size=58).scale(3) self.add(text1) pass def construct(self): #self.camera.reset_pixel_shape(1600, 900) # video incorrect display self.beginning() # image correct display # self.section1()
Thank you, I found this method in the official documentation Camera class, did not see the documentation configuration section, this is my fault.
Description of bug / unexpected behavior
self.camera.reset_pixel_shape(1600, 900)
change the aspect ratio, the export video is incorrect display but the image is correct displaypixel_height
andpixel_width
in themanim.cfg
config file, it doesn't work.pixel_height = 900 pixel_width = 1600
from manim import *
class ProofWithoutWords(Scene):
manim -pqk -v DEBUG --renderer=cairo .\ProofWithoutWords.py ProofWithoutWords
PS C:\Users\PeterHe\Desktop\无字证明> manim -pqk -v DEBUG --renderer=cairo .\ProofWithoutWords.py ProofWithoutWords Manim Community v0.18.0
[03/23/24 06:19:31] DEBUG Hashing ... hashing.py:350 DEBUG Hashing done in 0.013303 s. hashing.py:362 DEBUG Hash generated : 2272467289_2112894360_2358810818 hashing.py:365 DEBUG List of the first few animation hashes of the scene: ['2272467289_2112894360_2358810818'] cairo_renderer.py:87 [rawvideo @ 0000018d76312ac0] Invalid buffer size, packet size 27648000 < expected frame_size 33177600 [vist#0:0/rawvideo @ 0000018d76312900] Error submitting packet to decoder: Invalid argument
(process:49248): GLib-GIO-WARNING **: 06:19:33.328: Unexpectedly, UWP app
Microsoft.ScreenSketch_11.2312.33.0_x64__8wekyb3d8bbwe' (AUMId
Microsoft.ScreenSketch_8wekyb3d8bbwe!App') supports 29 extensions but has no verbs(process:49248): GLib-GIO-WARNING **: 06:19:33.417: Unexpectedly, UWP app
Clipchamp.Clipchamp_2.9.3.0_neutral__yxz26nhyzhsrt' (AUMId
Clipchamp.Clipchamp_yxz26nhyzhsrt!App') supports 41 extensions but has no verbs [03/23/24 06:19:34] INFO Animation 0 : Partial movie file written in scene_file_writer.py:527 'C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\partial_movie_files\ProofWithoutWords\2272467289_2112894360_2358810818.mp4' DEBUG Hashing ... hashing.py:350 DEBUG Hashing done in 0.038535 s. hashing.py:362 DEBUG Hash generated : 2322150387_682370412_2990937173 hashing.py:365 DEBUG List of the first few animation hashes of the scene: ['2272467289_2112894360_2358810818', '2322150387_682370412_2990937173'] cairo_renderer.py:87 [rawvideo @ 00000182b03e2ac0] Invalid buffer size, packet size 20736000 < expected frame_size 33177600 [vist#0:0/rawvideo @ 00000182b03e2900] Error submitting packet to decoder: Invalid argument [03/23/24 06:19:35] INFO Animation 1 : Partial movie file written in scene_file_writer.py:527 'C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\partial_movie_files\ProofWithoutWords\2322150387_682370412_2990937173.mp4' DEBUG Animation with empty mobject animation.py:174 DEBUG Hashing ... hashing.py:350 DEBUG Hashing done in 0.024027 s. hashing.py:362 DEBUG Hash generated : 2322150387_1733944848_1216896655 hashing.py:365 DEBUG List of the first few animation hashes of the scene: ['2272467289_2112894360_2358810818', '2322150387_682370412_2990937173', '2322150387_1733944848_1216896655'] cairo_renderer.py:87 [rawvideo @ 0000015803aa2ac0] Invalid buffer size, packet size 13824000 < expected frame_size 33177600 [vist#0:0/rawvideo @ 0000015803aa2900] Error submitting packet to decoder: Invalid argument [03/23/24 06:19:36] INFO Animation 2 : Partial movie file written in scene_file_writer.py:527 'C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\partial_movie_files\ProofWithoutWords\2322150387_1733944848_1216896655.mp4' DEBUG Hashing ... hashing.py:350 DEBUG Hashing done in 0.046414 s. hashing.py:362 DEBUG Hash generated : 2322150387_1146158440_3407092600 hashing.py:365 DEBUG List of the first few animation hashes of the scene: ['2272467289_2112894360_2358810818', '2322150387_682370412_2990937173', '2322150387_1733944848_1216896655', cairo_renderer.py:87 '2322150387_1146158440_3407092600'] [rawvideo @ 000002693f642ac0] Invalid buffer size, packet size 13824000 < expected frame_size 33177600[vist#0:0/rawvideo @ 000002693f642900] Error submitting packet to decoder: Invalid argument [03/23/24 06:19:37] INFO Animation 3 : Partial movie file written in scene_file_writer.py:527 'C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\partial_movie_files\ProofWithoutWords\2322150387_1146158440_3407092600.mp4' INFO Combining to Movie file. scene_file_writer.py:617 DEBUG Partial movie files to combine (4 files): scene_file_writer.py:561 ['C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\partial_movie_files\ProofWithoutWords\2272467289_2112894360_2358810818.mp4', 'C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\partial_movie_files\ProofWithoutWords\2322150387_682370412_2990937173.mp4', 'C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\partial_movie_files\ProofWithoutWords\2322150387_1733944848_1216896655.mp4', 'C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\partial_movie_files\ProofWithoutWords\2322150387_1146158440_3407092600.mp4'] INFO scene_file_writer.py:735 File ready at 'C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\ProofWithoutWords.mp4'
[03/23/24 06:19:38] INFO Previewed File at: 'C:\Users\PeterHe\Desktop\无字证明\media\videos\ProofWithoutWords\2160p60\ProofWithoutWords.mp4' file_ops.py:227
Package Version
aiohttp 3.8.4 aiosignal 1.3.1 async-generator 1.10 async-timeout 4.0.2 attrs 23.1.0 Automat 22.10.0 certifi 2023.11. cffi 1.15.1 charset-normalizer 3.1.0 click 8.1.7 click-default-group 1.2.4 cloup 2.1.2 colorama 0.4.6 constantly 15.1.0 cryptography 41.0.1 cssselect 1.2.0 decorator 5.1.1 EasyProcess 1.1 entrypoint2 1.1 exceptiongroup 1.1.1 filelock 3.12.0 frozenlist 1.4.0 glcontext 2.5.0 h11 0.14.0 hyperlink 21.0.0 idna 3.4 incremental 22.10.0 isosurfaces 0.1.0 itemadapter 0.8.0 itemloaders 1.1.0 jmespath 1.0.1 lxml 4.9.2 manim 0.18.0 ManimPango 0.5.0 mapbox-earcut 1.0.1 markdown-it-py 3.0.0 mdurl 0.1.2 moderngl 5.10.0 moderngl-window 2.4.4 MouseInfo 0.1.3 mss 9.0.1 multidict 6.0.4 multipledispatch 1.0.0 mysql-connector-python 8.0.33 nba_api 1.4.1 networkx 3.2.1 numpy 1.26.3 openai 0.27.8 outcome 1.2.0 packaging 23.1 parsel 1.8.1 Pillow 9.5.0 pip 24.0 Protego 0.2.1 protobuf 3.20.3 pyasn1 0.5.0 pyasn1-modules 0.3.0 PyAutoGUI 0.9.54 pycairo 1.26.0 pycparser 2.21 PyDispatcher 2.0.7 pydub 0.25.1 pygame 2.5.2 PyGetWindow 0.0.9 pyglet 2.0.14 Pygments 2.17.2 PyMsgBox 1.0.9 PyOpenGL 3.1.7 pyOpenSSL 23.2.0 pyperclip 1.8.2 PyRect 0.2.0 pyrr 0.10.3 pyscreenshot 3.1 PyScreeze 0.1.29 PySocks 1.7.1 python-docx 1.1.0 pytweening 1.0.7 pywin32 306 queuelib 1.6.2 requests 2.31.0 requests-file 1.5.1 rich 13.7.1 scipy 1.12.0 Scrapy 2.9.0 screeninfo 0.8.1 selenium 4.9.1 service-identity 21.1.0 setuptools 65.5.0 six 1.16.0 skia-pathops 0.7.4 sniffio 1.3.0 sortedcontainers 2.4.0 srt 3.5.3 svgelements 1.9.6 tldextract 3.4.4 tqdm 4.65.0 trio 0.22.0 trio-websocket 0.10.2 Twisted 22.10.0 twisted-iocpsupport 1.0.3 typing_extensions 4.10.0 urllib3 2.0.2 w3lib 2.1.1 watchdog 3.0.0 WMI 1.5.1 wsproto 1.2.0 yarl 1.9.2 you-get 0.4.1650 zope.interface 6.0
ffmpeg version 6.1.1-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers built with gcc 12.2.0 (Rev10, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --ena ble-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx -- enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --ena ble-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-li bopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband libavutil 58. 29.100 / 58. 29.100 libavcodec 60. 31.102 / 60. 31.102 libavformat 60. 16.100 / 60. 16.100 libavdevice 60. 3.100 / 60. 3.100 libavfilter 9. 12.100 / 9. 12.100 libswscale 7. 5.100 / 7. 5.100 libswresample 4. 12.100 / 4. 12.100 libpostproc 57. 3.100 / 57. 3.100