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

OpenShot Freezes when Exporting MP4

Open makeasnek opened this issue 1 year ago • 5 comments

Describe the bug: When trying to export, OpenShot freezes.

Steps to reproduce the behavior:

  1. Open Project
  2. Go to export
  3. Export to any video format
  4. Freezes at 80 something percent.

Expected behavior: Not freeze. Instead, fail with a useful error message detailing what went wrong. Worth noting that I seem to be able to play the entire video in the preview window without issue. Export method is CPU-only.

System Details:

  • OpenShot Version [e.g. 2.4.3]: 3.1.1. Tried both stable and daily, both from official PPA, same results.
  • Operating System / Distro: Ubuntu 20.04.6 x64

Log Files:

Exception / Stacktrace: With debugging mode on, program spits this out on repeat when frozen. I will gladly provide logs, but they are too large to upload and I feel a little uncomfortable posting publicly on Github. Please let me know where I can e-mail them. I can provide the original project files as well, if useful.

INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: frame not ready yet from decoder [" + av_err2string(receive_frame_err) + "]) (receive_frame_err=-541478720.0000, send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: AVERROR_EOF: EOF detected from decoder, flushing buffers) (send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::ReadStream (GetNextPacket) (requested_frame=131951.0000, packets_read=3268.0000, packets_decoded=3255.0000, is_seeking=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: frame not ready yet from decoder [" + av_err2string(receive_frame_err) + "]) (receive_frame_err=-541478720.0000, send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: AVERROR_EOF: EOF detected from decoder, flushing buffers) (send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::ReadStream (GetNextPacket) (requested_frame=131951.0000, packets_read=3268.0000, packets_decoded=3255.0000, is_seeking=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: frame not ready yet from decoder [" + av_err2string(receive_frame_err) + "]) (receive_frame_err=-541478720.0000, send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: AVERROR_EOF: EOF detected from decoder, flushing buffers) (send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::ReadStream (GetNextPacket) (requested_frame=131951.0000, packets_read=3268.0000, packets_decoded=3255.0000, is_seeking=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: frame not ready yet from decoder [" + av_err2string(receive_frame_err) + "]) (receive_frame_err=-541478720.0000, send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: AVERROR_EOF: EOF detected from decoder, flushing buffers) (send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::ReadStream (GetNextPacket) (requested_frame=131951.0000, packets_read=3268.0000, packets_decoded=3255.0000, is_seeking=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: frame not ready yet from decoder [" + av_err2string(receive_frame_err) + "]) (receive_frame_err=-541478720.0000, send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: AVERROR_EOF: EOF detected from decoder, flushing buffers) (send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::ReadStream (GetNextPacket) (requested_frame=131951.0000, packets_read=3268.0000, packets_decoded=3255.0000, is_seeking=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: frame not ready yet from decoder [" + av_err2string(receive_frame_err) + "]) (receive_frame_err=-541478720.0000, send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: AVERROR_EOF: EOF detected from decoder, flushing buffers) (send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::ReadStream (GetNextPacket) (requested_frame=131951.0000, packets_read=3268.0000, packets_decoded=3255.0000, is_seeking=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: frame not ready yet from decoder [" + av_err2string(receive_frame_err) + "]) (receive_frame_err=-541478720.0000, send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: AVERROR_EOF: EOF detected from decoder, flushing buffers) (send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::ReadStream (GetNextPacket) (requested_frame=131951.0000, packets_read=3268.0000, packets_decoded=3255.0000, is_seeking=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: frame not ready yet from decoder [" + av_err2string(receive_frame_err) + "]) (receive_frame_err=-541478720.0000, send_packet_pts=0.0000) INFO logger_libopenshot: FFmpegReader::GetAVFrame (receive frame: AVERROR_EOF: EOF detected from decoder, flushing buffers) (send_packet_pts=0.0000)

makeasnek avatar Jan 18 '24 11:01 makeasnek

Hello @makeasnek. Two things to try:

  1. Make sure you have plenty of free disk space. Typically an error messag pops up so most likely this is not it but worth checking for.

  2. Let's see if we can isolate the issue as I have seen this previously. a. Open your project and perform a File | Save Project As... and name it something like test01. This way we can experiment with this instead of your original project. b. Click on Export and click on the Advanced tab. c. Make a note of the "End Frame:". Let's say it is 4000 (this is dependent on the size of your project). d. Change the 4000 to 2000 and Export the video. This will export only half your project. e. If this worked then continue. f. Click Export again and change the "Start Frame:" to 2001 and leave the "End Frame:" at 4000. g. Click Export. I expect this is where the Export will freeze. h. Now, using the "Start Frame:" and "End Frame:" options Export 2001-3000, then 3001-4000....etc. You get the idea to try an narrow down as to which clip on your timeline may be the issue.

Once you narrow down to a clip then see if removing that clip from the timeline resolves the freezing issue. If it does then we need to figure out why and how to fix it.

This doesn't solve the fact that OpenShot is unable to gracefully deal with a possibly corrupt imported file/clip but at least gives you the change to move forward with your project. h. Now, open your project again

Colorjet3 avatar Jan 18 '24 13:01 Colorjet3

Thank you for the response :). I was able to get it to export partially, here are my debugging notes:

  1. There's plenty of disk space, that wasn't the issue
  2. Done. Problem was a clip starting at 17:00 based on this testing method.

This project has two video source files, split into a number of clips within openshot. So something went wrong while splitting I'm guessing. I tried removing the problematic clip (webm file) and re-adding it, re-slicing it again so I could get the problematic segment again, but openshot crashed during the export process again.

I tried removing the clip, converting the clip to mp4 with ffmpeg: ffmpeg -fflags +genpts -i 'source.webm' -r 30 testoutput.mp4

Which produced a mp4 that can be played without issue in vlc. I slice the desired areas into place in openshot and... back to crashing on export.

I then tried re-muxing the mp4 file just in case something was wrong with it: ffmpeg -i input.mp4 -c copy output.mp4

Added it to openshot, trimmed it, same error. So I thought maybe the video is becoming corrupted by the trim operation somehow. But trimming it only in VLC still results in the same error.

So then I thought: maybe the problem is the audio tracks running in the track under the clip, since those only get exported when the video is long enough to include them. So deleted those, but it still crashes on export.

I tried to use the title function so I could at least export and keep the timing of the final audio tracks (and just make like a 20 minute title) but that also crashed on export. I even tried exporting to MP3 with the same result.

I eventually gave up and was able to export about 70% of the video, enough to get it into a new video editing program.

I would gladly provide the openshot project, source files, etc if it is any use to you. In any case, it seems there is still a bug somewhere. The app should fail gracefully, and hopefully identify the problematic clip for the user. Googling this issue, I am not the first one to encounter this, and the solution posted here and elsewhere or tyring to export different segments via frame number is rather tedious.

problematic clip: 17:00 in on timeline clip name: boinc_test_2204_screen0.webm

Results of trying to export frames 0-x :23000, trying, worked! :30000, trying worked :30200: testing, worked :30323: failed :30473: failed :31000, failed :32000, failed :33000, failed

trying x-34,000 30200: trying, failed 30400: trying, failed 33000: trying, worked!

To add to the strangeness, at one point I was able to export the entire project at a stupid low resolution (I wish I remember which one but I don't).

Edit: I did find a way to export an mp3 of all the audio, so that should make re-making the end of the video easier.

Anyways, enough testing/debugging for now. I have a partial solution and am calling it a day.

makeasnek avatar Jan 19 '24 23:01 makeasnek

Hello @makeasnek. Thank you for the detailed reporting and too bad that your were/are still experiencing the issue. There are many other reports with the Split function causing other issues as well so I am wondering if the combination of the Split issue and duration of a project, combined, has something to do with it.

I am not a developer so I am going to go ahead and assign this to the lead developer for his review and see what other information he may be interested in for further debugging.

Meanwhile, if you can try one last thing, time permitting. Rather than using ffmpeg to convert the file causing the issue, try using something like VLC, Handbrake, or ShutterEncoder to convert it back to .mp4 (obviously with a new name). Import this new file into OpenShot, perform your edit and see if the Export now works.

Colorjet3 avatar Jan 19 '24 23:01 Colorjet3

I tried the same with VLC and had the same issue

makeasnek avatar Jan 20 '24 00:01 makeasnek

I tried the same with VLC and had the same issue

Thank you for the update. This issue has now been assigned to the lead developer.

Colorjet3 avatar Jan 20 '24 17:01 Colorjet3