Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libopenshot crash on all nvenc codecs #956

Open
aperture147 opened this issue May 13, 2024 · 0 comments
Open

libopenshot crash on all nvenc codecs #956

aperture147 opened this issue May 13, 2024 · 0 comments

Comments

@aperture147
Copy link

aperture147 commented May 13, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant