Stability ideas

The plcx file needs to be opened read only, when the rendering dialog is opened.

The window with the exporting dialog has an “abort” button. This button needs to have the “focus” activated, so that you are able to hit the button with enter.

Bildschirmfoto_2023-08-08_09-49-56

Then the rendering has to be cut in smaller pieces, to not hold all of the memory of the system. maybe only 10 or 20 pictures at once and assembly of them later. I have almost 4 Gigabytes of RAM and i have issues with a movie that has has only 450 pictures in it.

I agree that Pencil2D should handle modifications while there is an active export better. And the simplest solution to that would be to disable all modifications while exporting.

In my testing, the Cancel/Abort button receives focus when the export starts. This is true for 0.6.6 and the latest nightly build, but the behavior could differ based on your operating system. What version of Pencil2D and what OS are you using that does not set focus to the button when the export starts?

As for exporting memory usage, that differs significantly depending no whether you are exporting an animated GIF or a movie.

The GIF export renders all the frames to memory before generating the GIF for technical reasons. To do it any other way would require double the rendering time, so it was decided this was an acceptable trade-off given that GIFs should only be used for small animations anyway.

The movie export already uses a sliding window to limit the amount of rendered frames in memory at any given time. This window targets a maximum usage of 1GB of memory. This does not include the memory required to render the video which could be several hundred MB and which we have absolutely no control over. The 1GB target is not currently configurable. Cutting up the video would not offer any advantage over this approach, and would reduce encoding efficiency and speed.

Unfortunately 4GB is not a lot of RAM for a system these days, particularly when much of that will be used up by your operating system and other open programs. Perhaps at some point there will be more export options to allow for lower memory exports, but I cannot say when or if that will happen.

2 Likes

I had a nightly build in use and did not notice, that the focus was activated, because the computer was at about 66% of the file and almost completly unresposive. All Memory was in use, no swapping available (deactivated) and the usage of the cpus was at about 40% both. There was no alternative to a switch off. Linux Peppermintos

I had tried to render a movie *.mp4 Totally agree with you, that a gif could be handled differently to a bigger movie.

I think the OS does not use more than 700 MB of RAM, so there should be 3 Gigs of RAM for computing left. I hope there will be a kind of batch processing of movies in the future. At least in the command line. My first PC was a 386 sx 33 Mhz with 64 MB of RAM and windows 3.11

Maybe i could just export all pictures in one subfolder, and then use FFmpeg to assemble them externally. I just dont want to freeze my computer over and over again. Maybe this would be the best solution for movies over 300 frames.

Time is not important for me. Even when rendering needs 1 second per frame would be okay for me. I have to try how to use FFmpeg on the command line to assemble a movie from single pictures and a sound file.

Well since you’ve already built Pencil2D from source previously, what you can do is modify the source to reduce the size of the sliding window. Go to core_lib/src/movieexporter.cpp and change this line:

int frameWindow = static_cast<int>(1e9 / (camSize.width() * camSize.height() * 4.0));

to

int frameWindow = 1;

And then rebuild the program. This will use the minimal amount of memory possible for exporting movies. You may try increasing the number slightly if the export freezes (theoretically it shouldn’t), or if you want to get better performance at the cost of more memory.

1 Like

okay, i have build it anew. It looks very good so far.

Development Build Jul 23 2023

Operating System: PeppermintOS CPU Architecture: x86_64 Qt Version: 5.15.8

EDIT: I have exported a bigger file and just for fun, i hit enter to interrupt the process. Hit enter once, twice… still no change. Then i hit space. This at least had a visible effect on the button, but the process was not interrupted. Then i tried Esc and finally the rendering ended, but the computer was still a bit unrespronsive, because the memory was still clogged by the process. Then i hit Alt + F4 to leave the program. This worked and the memory was released.

Exporting a movie with 530 frames to 800x600 pixels with 3.8GB of RAM is still possible. Changing the output to 1280x720 pixels is working, too!!! I am sooo happy!

Exporting a movie with 800 frames to 540x480 pixels is possible too.

But there are issues: [W][10233.939313] pw.conf | [ conf.c: 939 try_load_conf()] can’t load config client.conf: No such file or directory [E][10233.939873] pw.conf | [ conf.c: 963 pw_conf_load_conf_for_context()] can’t load default config client.conf: No such file or directory stefan@stefan-krux:~/code/build-pencil2d-Desktop-Debug/bin$

Wow! it just works. I thinkt it is time for a new stable release. Pencil 0.7 ?

[ffmpeg] "Output #0, mp4, to '/home/stefan/Animation/out9.mp4':"
[ffmpeg] "  Metadata:"
[ffmpeg] "    encoder         : Lavf60.3.100"
[ffmpeg] "  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 1980x1080, q=2-31, 12 fps, 12288 tbn"
[ffmpeg] "    Metadata:"
[ffmpeg] "      encoder         : Lavc60.3.100 libx264"
[ffmpeg] "    Side data:"
[ffmpeg] "      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A"
[ffmpeg] "  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s"
[ffmpeg] "    Metadata:"
[ffmpeg] "      encoder         : Lavc60.3.100 aac"


...


ffmpeg] "frame=  526 fps=2.8 q=26.0 size=    1024kB time=00:00:47.62 bitrate= 176.2kbits/s speed=0.253x    "
[ffmpeg] "frame=  529 fps=2.8 q=26.0 size=    1280kB time=00:00:47.90 bitrate= 218.9kbits/s speed=0.254x    "
[ffmpeg] "frame=  581 fps=3.1 q=-1.0 Lsize=    1466kB time=00:00:48.41 bitrate= 248.1kbits/s speed=0.254x    "
[ffmpeg] "video:790kB audio:651kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.808592%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] frame I:6     Avg QP: 6.81  size: 10277"
[ffmpeg] "[libx264 @ 0x55f29d2da640] frame P:218   Avg QP:13.90  size:  2892"
[ffmpeg] "[libx264 @ 0x55f29d2da640] frame B:357   Avg QP:11.85  size:   325"
[ffmpeg] "[libx264 @ 0x55f29d2da640] consecutive B-frames: 13.9%  7.9% 13.4% 64.7%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] mb I  I16..4: 82.2% 16.3%  1.5%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] mb P  I16..4:  2.7%  2.4%  0.6%  P16..4:  0.7%  0.3%  0.1%  0.0%  0.0%    skip:93.3%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  1.9%  0.1%  0.0%  direct: 0.0%  skip:97.9%  L0:41.7% L1:56.9% BI: 1.5%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] 8x8 transform intra:33.7% inter:81.9%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] coded y,uvDC,uvAC intra: 10.8% 21.1% 19.4% inter: 0.1% 0.2% 0.1%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] i16 v,h,dc,p: 95%  3%  2%  0%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 19% 32%  3%  2%  2%  5%  2%  2%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 29% 30%  3%  3%  2%  5%  1%  4%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] i8c dc,h,v,p: 82% 11%  4%  3%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] Weighted P-Frames: Y:31.2% UV:29.4%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] ref P L0: 68.5%  5.5% 12.9% 13.1%  0.0%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] ref B L0: 88.5%  9.6%  1.9%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] ref B L1: 98.6%  1.4%"
[ffmpeg] "[libx264 @ 0x55f29d2da640] kb/s:133.52"
[ffmpeg] "[aac @ 0x55f29d2db880] "
[ffmpeg] "Qavg: 9181.998"
MOVIE = 131.0 sec
[W][13264.310764] pw.conf      | [          conf.c:  939 try_load_conf()] can't load config client.conf: No such file or directory
[E][13264.311391] pw.conf      | [          conf.c:  963 pw_conf_load_conf_for_context()] can't load default config client.conf: No such file or directory

I have uploaded a small demo video. Pencil2D Demo - YouTube

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.