mifi / lossless-cut

The swiss army knife of lossless video/audio editing
https://losslesscut.app/
GNU General Public License v2.0
27.7k stars 1.34k forks source link

Multiple Segments have a fairly large performance hit to seek behavior. #1727

Open Delerium opened 1 year ago

Delerium commented 1 year ago

I have a lot of issues to go through, so in order to make it easier for me to help you, I ask that you please try these things first

Operating System

Windows 10

System Info

AMD Ryzen 5 3600X 32 Gb DDR4-3600 RAM NVIDIA GeForce RTX 3070

Tested on both my 10TB WD Red NAS Drive (5400 RPM) as well as my extremely fast Samsung 990 Pro 2TB SSD with the same results on both hard drives.

Steps to reproduce

Open a video of any size, Hold down the right arrow to seek through the file and it performs just fine, keeping up with the video. Next, keep adding segments to the timeline and test the right arrow seek.

Expected behavior

Seek performance should not change much as you add segments within typical use cases (It's understandable if you have like 100 or 500 segments, but not under 20)

Actual behavior

As I add more segments, the playback video starts hitching while seeking. Add enough segments and the performance degrades to the point where the video stops when you hold down the right arrow, and doesn't resume until you release it. On my system, it completely stops showing video when seeking at around 16 segments, but I start noticing a performance hit at around 10.

For now, my workaround is to export a partially cut video and re-open it in LosslessCut to finish the rest of the cuts when it gets too unresponsive. Not a huge deal, but I figured I'd report it in case it is something that might cause performance problems other than just seeking.

YK-SNM commented 7 months ago

Hello, when you have to cut very long videos, it becomes impossible to do it all at once because performance drops as segments are added. I leave a sample of how it behaves when adding many segments (working on an nvme SSD). It becomes too slow when browsing the timeline. With less than 15 segments it works well.

https://github.com/mifi/lossless-cut/assets/63490946/baaf4908-49ab-4d1b-ad0d-0ec5a5515722

mifi commented 6 months ago

I did some testing and it seems to be caused by the side bar. So as a workaround you could hide the sidebar (right) and it should be faster. Will look more into it

mifi commented 6 months ago

LosslessCut uses react-sortablejs for the segment list. It seems like it's the culprit. I thought of virtualizing it (so that we don't have to render all the segments, even those not visible), however it doesn't seem to support it. need to find an alternative library that supports sorting as well as virtualization