openshot-qt icon indicating copy to clipboard operation
openshot-qt copied to clipboard

is it normal for OpenShot to consume > 64GB of RAM during export for 1080p/24fps video?

Open ezonakiusagi opened this issue 7 years ago • 42 comments
trafficstars

My Question: I'm new to OpenShot and still trying to figure it out. Every time I try to export a video, it's a gamble - most of the time it will crash due to out of memory issue. Some times it will succeed. I've tried lowering the quality level, but that doesn't improve my chances. I finally resorted to adding a 128GB swap file, and now I can finish the export, but for Openshot to consume 64GB or more RAM just seems absurd. But, maybe that is expected? I don't know... and would appreciate feedback. So far, it's very painful to export video and produce anything.

System Details

  • Operating System / Distro: Fedora 28 Linux
  • OpenShot Version 2.4.3
  • Hardware: 1st machine had 32GB of DDR4 and when it started crashing due to out of memory, I tried on 2nd machine with 64GB of DDR4 and that would occasionally succeed. I've now resorted to adding a 128GB swap file as a workaround. i see that during export, allocated virtual memory for openshot reaches over 60GB or more.

Screenshots i can share some screenshots, but i don't think it would add much value to my description above.

ezonakiusagi avatar Oct 15 '18 08:10 ezonakiusagi

Thank you, sir, for the clear description of the problem. It most certainly is out of the ordinary for OpenShot to do so. Perhaps you could attach the logs so that the devs can further look into this?

peanutbutterandcrackers avatar Oct 15 '18 11:10 peanutbutterandcrackers

@ezonakiusagi - Hello, Do you have details on the video format? This would be very helpful to help us debug the issue.

DylanC avatar Oct 17 '18 08:10 DylanC

Open Shot consumes much memory, and this are all programs doing that use a comparable software basis, i believe it is using the melt-libraries, but i am not sure about this. I have added 16GB to my computer so it now has 32GB, and added a SSD of 60GB as a swap disk. This works well. A good way to reduce memory use is to save the project after editing, restarting open shot and the start the rendering. My open shot is doing a render of a 3,5K-video, was consuming about 20GB when rendering directly after edit, now with restarted Open SHot it consumes 7GB and is short before end of render. But, as mentiened, much programs that are comparable to Open Shot show the same memory behaviour, KDEnlive, Flowblade, and these programs need a restart before rendering, too.

LeosWelt avatar Oct 20 '18 09:10 LeosWelt

@peanutbutterandcrackers : i looked at the logs, they are not small, but I would have to sanitize them before I can share them publicly so I haven't had time to do that.

@DylanC : Profile=Web, Target=Youtube-HD, Video Profile=HD 1080p 23.98fps, Quality=Med, Audio Codec=libmp3lame, Sample Rate=48000, Channel Layout=Stereo, Bit Rate/Quality=256 kb/s. Adjusting the quality lower doesn't seem to help the situation.

@LeosWelt : i realize these type of programs require a bit of ram, but > 64GB for 1080p video seems really excessive. I discussed this problem with a friend who uses another software and he can do 4k videos with 16GB. I definitely think something is wrong here... also, the fact that you need to save and re-open; that in itself seems like a bug, no?

ezonakiusagi avatar Oct 20 '18 09:10 ezonakiusagi

@ezonakiusagi : I did not tell that these are no bugs. I have just seen these bugs with enormous memory-consumation with KDEnlive and Flowblade. OpenShot has the advantage for me agains KDEnlive that the use of multiple cores is working very well, rendering with 800% speed on a six-core AMD Ryzen. I am sure that DylanC also needs an info about the input format. In my case it is mp4 4K-video from a SONY Handycam 4K or from OBS at 2,5K as MP4. I rendered to 4K UHD 2160p 25fps (3840x2160) or 2,5K QDH 1140p 25 fps (2560x1440), format MP4(h.264), quality high or medium (mostly the second)...

LeosWelt avatar Oct 20 '18 20:10 LeosWelt

memory Memory after a render in 4K, about 4 minutes of video. The rendering is finished, but the memory is not made available by the program.

LeosWelt avatar Oct 20 '18 21:10 LeosWelt

so, is this looking like a memory leak then?

ezonakiusagi avatar Oct 21 '18 19:10 ezonakiusagi

this is getting silly:

top - 15:57:34 up 7 days, 2:27, 1 user, load average: 4.47, 5.91, 5.18 Tasks: 621 total, 1 running, 497 sleeping, 1 stopped, 0 zombie %Cpu(s): 18.9 us, 3.1 sy, 8.1 ni, 69.3 id, 0.0 wa, 0.3 hi, 0.2 si, 0.0 st KiB Mem : 32856436 total, 295128 free, 32181596 used, 379712 buff/cache KiB Swap: 67108860 total, 7966204 free, 59142656 used. 195288 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
11066 ezonaki 20 0 83.560g 0.026t 17524 S 383.3 85.2 113:50.35 openshot-qt

ezonakiusagi avatar Oct 24 '18 22:10 ezonakiusagi

@LeosWelt @ezonakiusagi - This is most definitely a bug at this point.

DylanC avatar Oct 25 '18 09:10 DylanC

This happens to me too. I'm running on a 16 GB RAM laptop and it maxes out my cpu.

ghost avatar Oct 25 '18 23:10 ghost

any news or progress with this bug? this seems like a pretty serious issue to me... i've been working around it by saving/closing and then re-opening openshot before the final export.

ezonakiusagi avatar Jan 17 '19 21:01 ezonakiusagi

Next to the party. Openshot 2.4.3 on Voidlinux 64-bit. Ryzen 7 2700x, 16GB DDR4. Rendering 1440p 60FPS video. 2 audio tracks, one video track and title on additional video track. I am unable to render it with 16GB ram and 20GB swap. With the same setup kdenlive and shotcut had no problem at all, used memory was about 5-8GB.

ernierasta avatar Mar 08 '19 10:03 ernierasta

Openshot 2.4.4 Arch Linux. 16gb Ram. Intel i7 4790k Sources: (Recorded on Yi 4K) MP4 H264 1080p 59.94fps Profile: 1080p 59.94 fps Exporting to: as above. Bug present on export. Suspect about the 3 minute mark going by last noticed % on export bar.

jwm-art-net avatar Mar 23 '19 21:03 jwm-art-net

Saw comment https://github.com/OpenShot/openshot-qt/issues/2352#issuecomment-456886021 Basically you can work around this issue by using multiple exports of different sections of your project by using the advanced tab and specifying start & end frame options and then concatenating resulting exported files together (ie using FFMPEG without re-encoding).

jwm-art-net avatar Mar 23 '19 22:03 jwm-art-net

It seems that using a lot of small clips contribute a lot to making OpenShot's memory usage explode.

I had a project with about 35 video files (cut into something like 60 clips) and 50 pictures. Despite the video being less than 10 minutes long and only 720p, the memory usage would explode and exhaust my RAM+swap.

Exporting the project in two parts (using the advanced settings for start/end frames), then creating a new project with the two parts videos and exporting it worked.

The increased memory usage following an export doesn't stop when the export finishes, it is necessary to close and reopen openshot, so memory is leaking.

(All this with 2.4.4)

Alayan-stk-2 avatar Apr 29 '19 16:04 Alayan-stk-2

Major memory leakage was solved by https://github.com/OpenShot/libopenshot/commit/85d6ac6ad56643fc12365a1649b2e1be40c7b1d7 So, issue may be closed.

SuslikV avatar Jun 12 '19 09:06 SuslikV

Great, thank you for letting us know. If I understand it correctly code containing this fix was not released yet (it is only in develop branch of libopenshot), so I will wait for release (knowing Voidlinux maintainers it will be in repo very soon after official libopenshot release).

I will test then test it and report results.

ernierasta avatar Jun 12 '19 09:06 ernierasta

Note that I'm running openshot-qt 2.5.1 with libopenshot 0.2.5 on Guix; when exporting to the default h.264 option, I still get a memory leak that threatens to consume all memory on my system until exporting completes. AFAICT then 85d6ac6 should be accounted for in the release I have, but the problem persists.

cwebber avatar Sep 20 '20 16:09 cwebber

Note that here, "all available ram" was that an hour long talk consumed 15gb of ram, growing incrementally through the entire process. (I guess I'm very lucky since I have 16gb of ram... I closed every single other program on my computer I could in order to be able to do the export!)

cwebber avatar Sep 20 '20 16:09 cwebber

Rendering smaller segments then compositing a final version worked for me. I was rendering 1080p 60fps quality:high *.mp4 over 1 hour long videos on Ryzen 2400G with 16gb + 5gb swap initially and always required closing and reopening the file before rendering to avoid a ram leak crash.

After upgrading to 32gb of ram the renders are noticeably faster even when swap isn't being consumed. If you're using a high cache limit of memory in the settings try lowering it to 750mb or after you're done editing. Also, reduce the size of the preview pane, it causes a lot of bugs when jogging back and forth in both openShot and kdenlive in my recent experience.

Renders will always work if you chop all the clips into bite sized pieces then do a final composition of all the bits after the fact. It's also a lot easier to make changes if you're doing professional work with a fussy client. Making a bunch of tiny adjustments to a giant piece is always going to be prone to audio sync issues and render crashes from what I've gathered in my playing around and subsequent hunting through forums.

Once the experimental features are mainline these issues will all be moot anyway, I'm pretty sure. We just gotta tough it out for now and make sure to close and reopen before committing to the final render. With 16gb you can definitely do a 1080p 60fps render with only 5gb of swap; I've done 4 in the last 2 months. It just takes a bit of massaging to keep it from croaking for now.

paxdriver avatar Nov 21 '20 01:11 paxdriver

I have the same problem. My 16GB of ram filled up and then openshot closes it self. The video is only 2min 36s. So i think this must be a memleak. After the video was exported, the memory is still in use. It does not free the memory. How can i help to find what's wrong?

TheRaven500 avatar Nov 28 '20 19:11 TheRaven500

@TheRaven500 and anyone else who stumbles upon this issue ... I opened this over 2 yrs ago. no progress has been made to fix this. it's not a hard issue to replicate, as evidenced by other "me too" posts here. I'm glad I gave up and stopped wasting my time with OpenShot. it's just not ready and perhaps there just aren't enough devs working on it. moved to shotcut since reporting this issue and it has been trouble free for 2 yrs, and has GPU acceleration.

ezonakiusagi avatar Nov 29 '20 01:11 ezonakiusagi

Yes you are right and i can understand your frustration. The same happens to me yesterday. I like to make a short video and can not export it because it eats nearby 20GB of ram for a 2:30min video. But now i tested shotcut and the first impression are lot's of segmentation faults. Sorry but looks not really better! :-( My hope is still that someone can fix this memleak, because i really like openshot.

TheRaven500 avatar Nov 29 '20 09:11 TheRaven500

I am able to create my HD-youtube-stuff with OpenShot, are videos about 10 minutes to over an hour, and the memory usage is OK for this. The problem starts when rendering 4K-videos, with maximum settings for calculation threads this leads to a consumption of all 32GB i have installed, i am testing now with a OpenSHot-Configuration that does not use all threads that are available, and the memory consumption seems to be nicer, has rendered abou 8 percent of the 30 minute video, and consumes about 10GB, will have to wait about 2 hours to be sure if this had worked...

LeosWelt avatar Nov 29 '20 10:11 LeosWelt

This is an interesting observation! With only 1 thread it uses "only" about 7GB of Ram. Still to much for an 2:30min video but much better than 16GB :-) In my Case it is a 1080p video which eats more than 16GB of Ram, because of that i switched to 720p and this works with 16GB. Edit: With one thread 1080p seems also to work with 16GB of Ram!

TheRaven500 avatar Nov 29 '20 14:11 TheRaven500

Hello, i have not got the 4K-video to run, working with KDEnlive works, and finially, i used Flowblade for this. A 30 minute 4K-video used about 20GB of RAm while rendering, only took 2 hours for rendering. Rendering HD-videos is no problem in my case. I use videos from a Sony Handycam, Videos about 10 minute sto one hour, and speed them up for a youtube-channel of my wife. Almost no memory consumption with Open Shot, but working without reatarting Open Shot after each Project leads to high memory consumption. memory seems to be reserved and not given back.

LeosWelt avatar Dec 02 '20 17:12 LeosWelt

I have an other tipp how to handle such situations. I have used an old system until End of 2018, and 8GB of RAM was too short, so i bought a SSD of 64GB for about 30 Euros, and use this SSD just as a swap drive. I am using Linux, think its also possible to do this with windows. The swap drive is much faster than a swap drive on a normal HDD and you have the possibility to get jobs done although your system is out of RAM.

LeosWelt avatar Dec 03 '20 20:12 LeosWelt

@LeosWelt Perfect answer, this is how we solve memleaks in the year 2020 :-D I switched now to shotcut and the problem is also solved for me.

TheRaven500 avatar Dec 07 '20 14:12 TheRaven500

I know this is old but I too have had plenty of issues since 2.5+ landed. Now just adding clips to a project causes RAM to spike. I have 128GB and 40 CPU threads and OpenShot is happy to just gobble it all up until it crashes - not even error handled. Sad to see such a great project have issues like this. screenshot1

jboero avatar Apr 10 '21 08:04 jboero

Interesting I've tried to strace where it's going wrong and it's also dumping gigs of '\' to ~/.openshot_qt/openshot-qt.log* files... 9 GB of just '\'

jboero avatar Apr 10 '21 08:04 jboero