Mesut Can
Mesut Can

Reputation: 291

Nvidia Nvenc Video Conversion from mxf to mp4 getting error for multiple streams inside

I am trying to convert a video that have multiple video streams and one audio stream from mxf format to mp4 format and getting an error. How can i solve this problem? Thank you.

E:\video>ffmpeg -loglevel error -y -i E:\video\19_12_2018\Files\MEDIA\media_data.mxf -map 0 -c:v h264_nvenc -acodec copy nvidia_output.mp4

[h264_nvenc @ 0000020b30c86e80] OpenEncodeSessionEx failed: out of memory (10)
[h264_nvenc @ 0000020b30c86e80] No NVENC capable devices found
Error initializing output stream 0:2 -- Error while opening encoder for output stream #0:2 - maybe incorrect parameters such as bit_rate, rate, width or height

[h264_nvenc @ 00000204c1e37040] OpenEncodeSessionEx failed: out of memory (10)
[h264_nvenc @ 00000204c1e37040] No NVENC capable devices found
[h264_nvenc @ 00000204c1e37040] Nvenc unloaded
[jpeg2000 @ 00000204c2d90080] End mismatch 1
    Last message repeated 1 times
Error initializing output stream 0:2 -- Error while opening encoder for output stream #0:2 - maybe incorrect parameters such as bit_rate, rate, width or height

My FFPROBE output

E:\video>ffmpeg ffprobe
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig 
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype 
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb 
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy 
--enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx 
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 
--enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp 
--enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa 
--enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf 
--enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec
 --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100

Upvotes: 1

Views: 1748

Answers (1)

Dennis Mungai
Dennis Mungai

Reputation: 1689

The error you're seeing is expected, if you're using a consumer-grade NVIDIA GPU wherein the maximum simultaneous NVENC session limit of 2 is enforced at the firmware and driver level. See the NVIDIA GPU Matrix for more information on this.

There are two ways you can overcome this limitation:

1. Explicitly select the video stream(s) you desire to encode, via -map options, such that only two video streams are encoded at any given time per session. The example below explicitly selects the first and second video stream only:

E:\video>ffmpeg -loglevel error -y -i E:\video\19_12_2018\Files\MEDIA\media_data.mxf -map 0:v:0 -map 0:v:1 -map:0:a -c:v h264_nvenc -acodec copy nvidia_output.mp4

It would be awesome if you'd provide the ffprobe output for the input file you're working with, and that way, we can suggest what to do with the other video streams. An alternative to such would be falling back to a software-based encoder (such as x264) if so needed.

2. Override the aforementioned NVENC session count limit above: This will require you to patch the NVIDIA driver, as documented in this repository. Instructions for Linux are also available here.

Upvotes: 3

Related Questions