libopenshot icon indicating copy to clipboard operation
libopenshot copied to clipboard

`libopenshot` crash on all `nvenc` codecs

Open aperture147 opened this issue 1 year ago • 2 comments

Hi, I'm building pyopenshot and libopenshot from scratch. For some reason libopenshot crash whenever I use codec h264_nvenc. This is an example code I ran:

from openshot import FFmpegReader, FFmpegWriter, Settings
from contextlib import contextmanager
from typing import TypeVar, Generator

T = TypeVar('T')

@contextmanager
def openshot_closing(reader: T) -> Generator[T, None, None]:
    try:
        reader.Open()
        yield reader
    finally:
        if reader.IsOpen():
            reader.Close()

setting_instance = Settings.Instance()
setting_instance.DEBUG_TO_STDERR = True 
setting_instance.HARDWARE_DECODER = 2 # setting encoder/decoder to cuda
setting_instance.HW_DE_DEVICE_SET = 0
setting_instance.HW_EN_DEVICE_SET = 0


with openshot_closing(FFmpegReader('video.mp4')) as reader:
    writer = FFmpegWriter('video_out.mp4')
    writer.SetVideoOptions(
        True,
        'h264_nvenc', # also crashed on `hevc_nvenc`
        reader.info.fps, reader.info.width, reader.info.height,
        reader.info.pixel_ratio, reader.info.interlaced_frame, reader.info.top_field_first, reader.info.video_bit_rate)
    with openshot_closing(writer) as c_writer:
        c_writer.WriteFrame(reader, 0, reader.info.video_length)

I've also obtained a log file from running this script (2k of lines): log.txt

As mentioned in #890 , FFmpegWriter crashed and closed on frame 33, with this error (line 2093 in log.txt):

FFmpegWriter::write_video_packet ERROR [Invalid argument] (result=-22.0000)

The code above runs fine if I switch to libx264, libx265 or libvpx.

aperture147 avatar May 13 '24 10:05 aperture147

Hint: The openshot APPIMAGE Version has no issues with nvidia hwenc. Just tested on Fedora Linux 40

Cyborgscode avatar Nov 26 '24 11:11 Cyborgscode

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:

  • No activity in the past 90 days
  • No one is assigned to this issue

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

  • If this issue is reporting a bug, please can you attempt to reproduce on the latest daily build to help us to understand whether the bug still needs our attention.
  • If this issue is proposing a new feature, please can you verify whether the feature proposal is still relevant.

Thanks again for your help!

stale[bot] avatar Apr 26 '25 07:04 stale[bot]