OpenShot / openshot-qt

OpenShot Video Editor is an award-winning free and open-source video editor for Linux, Mac, and Windows, and is dedicated to delivering high quality video editing and animation solutions to the world.
http://www.openshot.org
Other
4.33k stars 540 forks source link

Video preview of last video in a Track consumes extreme RAM #5074

Closed Jan-OF closed 1 year ago

Jan-OF commented 1 year ago

Describe the bug A clear and concise description of the issue

Steps to reproduce the behavior:

  1. Go to Video Preview
  2. Click on the last video in the Track
  3. Click on Next Key Frame
  4. Click on Play
  5. The video play does not start, the memory usage starts spiking up and does not stop until the system is out of RAM or Openshot is killed from taskmgr. Standard application closing with a cross does not work.
  6. Video export with the affected track works without any issues.

Expected behavior Video play does not cause a system failure. Memory leak suspicion.

System Details

Log Files I have them, but libopenshot.log went from nothing to 260MB size within seconds. openshot-qt.log generated 3x25MBs logs within the same time. How to upload these, please?

Exception / Stacktrace No stacktrace found in log files

Screenshots (Optional) If applicable, add screenshots to help explain your problem. You can include screenshots by copy/pasting them on GitHub or dragging-and-dropping into the GitHub page. All images are public, so please don't post screenshots containing personal information.

openshot-qt.log

Colorjet3 commented 1 year ago

Hello @Jan-OF Please tell me a little bit more about your project so I can try and replicate it.

  1. How many files did you import? Video/audio? images? audio?
  2. Why type of files did you import? .mp3? .mp4? .mov?, .jpg, etc?
  3. Give me an idea of the size of your files.
  4. A little bit about your project itself: a. How many tracks are you using? b. How many clips do you have on a track? c. Have you done any animation of any king? If yes, what?
  5. What happens if you remove this last video from the track. Does the problem go away or are you still able to replicate the issue?
  6. In general, are you able to replicate this issue every time?

Try this:

  1. Start a new project.
  2. Import the video file that is the last one on the track in your project that you are having an issue with.
  3. Can you replicate the problem just with this one file/clip?

Any other details you can provide to help troubleshoot.

Jan-OF commented 1 year ago

@Colorjet3

1. How many files did you import? Video/audio? images? audio?

Video only, without audio track, 37 tracks with different size and length, total import size 1.01GB It's a camera footage that I want to merge to a single video file.

2. Why type of files did you import?  .mp3? .mp4? .mov?, .jpg, etc?

mp4 only

3. Give me an idea of the size of your files.

1.01GB in total, the smallest file is 4MB, the largest 246MB

  1. A little bit about your project itself: a. How many tracks are you using? 1 b. How many clips do you have on a track? 37 c. Have you done any animation of any king? If yes, what? no, only razor tool of the first and the last source file
  2. What happens if you remove this last video from the track. Does the problem go away or are you still able to replicate the issue? I can replicate it with the 'new' last track
  3. In general, are you able to replicate this issue every time? Yes

Try this:

1. Start a new project.
2. Import the video file that is the last one on the track in your project that you are having an issue with.
3. Can you replicate the problem just with this one file/clip?

I can't replicate it with only one file. New project did not help.

Any other details you can provide to help troubleshoot. This is the first time I have such an issue, I already did the same job with same type of source files, even though with less than 37 source files. MediaInfo of one of the files, all other files are same (except the length): ` Format : MPEG-4 Format profile : Base Media Codec ID : isom (mp41/avc1) File size : 241 MiB Duration : 9 min 42 s Overall bit rate : 3 467 kb/s Encoded date : UTC 2023-01-02 22:03:34 Tagged date : UTC 2023-01-02 22:03:34 Writing application : vlc 3.0.18 stream output

Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L5 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 9 min 42 s Bit rate : 3 467 kb/s Width : 2 688 pixels Height : 1 520 pixels Display aspect ratio : 16:9 Frame rate mode : Variable Frame rate : 10.067 FPS Minimum frame rate : 10.000 FPS Maximum frame rate : 1000 000.000 FPS Original frame rate : 15.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.084 Stream size : 241 MiB (100%) Writing library : x264 core 155 Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x13 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=15 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 Language : English Encoded date : UTC 2023-01-02 22:03:34 Tagged date : UTC 2023-01-02 22:03:34 Color range : Full Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709 Codec configuration box : avcC `

No issues with playing the source files in VLC. The video export has set resolution to 1920x1080, 11fps.

Colorjet3 commented 1 year ago

@Jan-OF Thank you so much for all this information. I am going to see if I can replicate this issue. One more bit of information for now.

  1. Please give me a screen shot of your Edit | Preferences | Cache tab.
  2. How much RAM do you have in your computer?
  3. How much free disk space you have?
  4. Did you enable Verbose logging (Edit | Preferences | Debug)? This will make the log files even bigger.

If I am unable to replicate your issue we'll figure out a way to to get your log files.

Jan-OF commented 1 year ago

Hello @Colorjet3

1. Please give me a screen shot of your Edit | Preferences | Cache tab.

It's a default setup, I didn't change anything. image

2. How much RAM do you have in your computer?

16GB, about 8GB is free when I start uploading all clips

  1. How much free disk space you have? 307GB
  2. Did you enable Verbose logging (Edit | Preferences | Debug)? This will make the log files even bigger. Yes, those log files I talk about are with verbose logging.

If I am unable to replicate your issue we'll figure out a way to to get your log files.

Thank you, appreciated!

Colorjet3 commented 1 year ago

Thank you for all that @Jan-OF. Your system definitely has all the resources. Please change the "Cache Max Frames" to 1024 and "Cache Limit (MB)" to 2048. Restart OpenShot and test again.

Jan-OF commented 1 year ago

@Colorjet3 hello Thank you for the effort. Unfortunately, that recommended setup did not help. Used resources shortly before I had to kill the app: image

CPU and Disk utilization was oscillating all the time on the same level as on the screenshot. RAM utilization started at about 500MB and was growing around 11MB/s until that value you see on the screenshot. The app was fully responsive during the process, such as opening Preferences menu, I even could click on Pause button, but it did not change anything. I was not able to close the app via cross in the top right corner, had to shut it down again via the taskmgr. That last clip has a file size of 8MB. The image preview of that clip was loaded when I pressed on Play button, then it stayed static. If you with to get verbose logs, let me know please for how long I should leave the app running, and where to upload the logs.

Thank you

Colorjet3 commented 1 year ago

Hello @Jan-OF

  1. Let it run for about 20-30 seconds.
  2. Please send me an email from your personal email at raffi@openshot.org. I will then give you access to Google Drive for you to upload your log files.

Just so that you are aware, I am not a developer and one of the DEV team members will need to look at the log file and analyze it. This is a very small team so I don't know how quickly we will get a response.

I thought of couple of options to further troubleshoot. It might be time consuming since you have so many files but here they are:

Option 1 - Run your .mp4 files through a converter. This is a common practice and other video editors can run into the same issue.

  1. Download and install HandBrake. This will allow a batch conversion process.
  2. Convert them all back to .mp4. Here is a youtube tutorial: https://www.google.com/search?client=firefox-b-1-d&q=handbrake+convert+.mp4+to+.mp4#kpvalbx=_qxK2Y4K2MdvM0PEP99qbiA4_44
  3. Start a new project and import those newly converted files and try again.
  4. If this works, it doesn't necessarily mean that OpenShot is off the hook. However, it can mean that one or more of your .mp4 files have some anomaly that OpenShot doesn't deal with very well or just flat out has a bug in it.

Option 2 - Process of elimination. See if we can figure out when the problem is introduced.

  1. Open your project.
  2. Perform File | Save As and save it to something like Testing01.osp. Let's not play with your original file.
  3. Delete all of the clips from the Tracks (not the Project Files).
  4. Select the first 10 files, right click, select "Add to Timeline" and click ok (don't make any changes.
  5. Save the project.
  6. See if you can reproduce the issue with just 10. Document the result.
  7. Restart Openshot and open Testing01.
  8. Delete all clips from the timeline (not project files).
  9. Now select the first 20 (this includes the first 10 you selected above), right click, select "Add to Timeline" and click OK.
  10. Save the project.
  11. See if you can reproduce the issue with just 20. Document the result.
  12. Repeat steps 7-11 but this time select all 37 files.

Option2 then gets a bit more involved. Say we find out that when did 20 clips, the problem started happening. This would tell us that something is wrong with one of the .mp4 files in the 2nd group of 10. We can then concentrate on which one.

If you did Option 1 and it all worked fine, then you definitely know that there was some kind of an issue with one or more .mp4 files and the problem is now resolved and you may not care any more. However, we will have your log files from your original report and the dev team hopefully can get to the bottom of it.

Obviously, you don't have to do any of this and we can see what the dev team will say when they look at your log files.

stale[bot] commented 1 year ago

Thank you so much for submitting an issue to help improve OpenShot Video Editor. We are sorry about this, but this particular issue has gone unnoticed for quite some time. To help keep the OpenShot GitHub Issue Tracker organized and focused, we must ensure that every issue is correctly labelled and triaged, to get the proper attention.

This issue will be closed, as it meets the following criteria:

We'd like to ask you to help us out and determine whether this issue should be reopened.

Thanks again for your help!