[FFmpeg-user] issue with nvenc and h264_cuvid

Evgeniy Kozhuhovskiy e.kozhuhovskiy at gmail.com
Tue Aug 16 17:46:53 EEST 2016


Hello.

I'm trying to decode and encode video on nvidia GTX960 card, and I've
stuck with a strange problem

If i'm specifying 720p resolution with -s 720x540 parameter - everything works.

But if i'm trying to specify any other resolution, i'm getting such error:
[h264_nvenc @ 0x27ecae0] InitializeEncoder failed: invalid param (8)

It doesn't matter on kind of input of output.

Here is working command:

ffmpeg -vcodec h264_cuvid -i
'udp://@232.0.5.133:1234?fifo_size=1048576&buffer_size=1048576&overrun_nonfatal=0'
-c:v h264_nvenc -g 30 -aspect 1280:720 -s 720x540 -b:v 2500k -maxrate
3500k -bufsize 3500k -profile:v main -level 3.1 -preset medium -c:a
libfdk_aac -b:a 128k -ac 2 -strict experimental -threads 1 -f mpegts
http://192.168.3.36:8080/test321/mpegts

ffmpeg version N-81285-gc1bfeda Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-cflags='-g -O2
-fstack-protector-strong -Wformat -Werror=format-security
-I../cudautils -I/usr/local/cuda-8.0/include/'
--extra-ldflags='-Wl,-z,relro -L../cudautils ' --cc='ccache cc'
--enable-gpl --enable-nonfree --enable-pthreads --enable-postproc
--enable-libx264 --enable-nonfree --enable-version3 --enable-avfilter
--disable-decoder=amrnb --libdir=/usr/lib/x86_64-linux-gnu
--disable-vda --disable-msa --disable-mipsfpu --disable-mipsdspr2
--enable-avresample --enable-libfdk-aac --enable-vaapi
--disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu --enable-nvenc
--enable-cuvid --enable-cuda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 51.100 / 57. 51.100
  libavformat    57. 46.100 / 57. 46.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 49.100 /  6. 49.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[udp @ 0x2e4c2a0] attempted to set receive buffer to size 1048576 but
it only ended up set as 425984Input #0, mpegts, from
'udp://@232.0.5.133:1234?fifo_size=1048576&buffer_size=1048576&overrun_nonfatal=0':
  Duration: N/A, start: 76764.542522, bitrate: N/A
  Program 14105
    Stream #0:0[0x145]: Video: h264 (High) ([27][0][0][0] / 0x001B),
nv12(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k
tbn, 25 tbc
    Stream #0:1[0x195](rus): Audio: mp2 ([4][0][0][0] / 0x0004), 48000
Hz, stereo, s16p, 192 kb/s (clean effects)
[mpegts @ 0x3042620] Using AVStream.codec to pass codec parameters to
muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mpegts, to 'http://192.168.3.36:8080/test321/mpegts':
  Metadata:
    encoder         : Lavf57.46.100
    Stream #0:0: Video: h264 (h264_nvenc) (Main), nv12, 720x540 [SAR
4:3 DAR 16:9], q=-1--1, 2500 kb/s, 50 fps, 90k tbn, 50 tbc
    Metadata:
      encoder         : Lavc57.51.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 3500000/0/2500000 buffer size: 3500000
vbv_delay: -1
    Stream #0:1(rus): Audio: aac (libfdk_aac), 48000 Hz, stereo, s16,
128 kb/s (clean effects)
    Metadata:
      encoder         : Lavc57.51.100 libfdk_aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
frame=  174 fps= 42 q=24.0 Lsize=    1298kB time=00:00:07.72
bitrate=1377.6kbits/s speed=1.86x
video:1065kB audio:116kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 9.941156%


With any other resolution it does not work:

ffmpeg -vcodec h264_cuvid -i
'udp://@232.0.5.133:1234?fifo_size=1048576&buffer_size=1048576&overrun_nonfatal=0'
-c:v h264_nvenc -g 30  -aspect 1280:720 -s 1280x720 -b:v 2500k
-maxrate 3500k -bufsize 3500k -profile:v main -level 3.1 -preset
medium -c:a libfdk_aac -b:a 128k -ac 2 -strict experimental -threads 1
-f mpegts  http://192.168.3.36:8080/test321/mpegts
ffmpeg version N-81285-gc1bfeda Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-cflags='-g -O2
-fstack-protector-strong -Wformat -Werror=format-security
-I../cudautils -I/usr/local/cuda-8.0/include/'
--extra-ldflags='-Wl,-z,relro -L../cudautils ' --cc='ccache cc'
--enable-gpl --enable-nonfree --enable-pthreads --enable-postproc
--enable-libx264 --enable-nonfree --enable-version3 --enable-avfilter
--disable-decoder=amrnb --libdir=/usr/lib/x86_64-linux-gnu
--disable-vda --disable-msa --disable-mipsfpu --disable-mipsdspr2
--enable-avresample --enable-libfdk-aac --enable-vaapi
--disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu --enable-nvenc
--enable-cuvid --enable-cuda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 51.100 / 57. 51.100
  libavformat    57. 46.100 / 57. 46.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 49.100 /  6. 49.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[udp @ 0x319f2a0] attempted to set receive buffer to size 1048576 but
it only ended up set as 425984SPS unavailable in decode_picture_timing
[h264_cuvid @ 0x31c38a0] non-existing PPS 0 referenced
[h264_cuvid @ 0x31c38a0] SPS unavailable in decode_picture_timing
[h264_cuvid @ 0x31c38a0] non-existing PPS 0 referenced
[h264_cuvid @ 0x31c38a0] SPS unavailable in decode_picture_timing
[h264_cuvid @ 0x31c38a0] non-existing PPS 0 referenced
[h264_cuvid @ 0x31c38a0] SPS unavailable in decode_picture_timing
[h264_cuvid @ 0x31c38a0] non-existing PPS 0 referenced
[h264_cuvid @ 0x31c38a0] SPS unavailable in decode_picture_timing
[h264_cuvid @ 0x31c38a0] non-existing PPS 0 referenced
Input #0, mpegts, from
'udp://@232.0.5.133:1234?fifo_size=1048576&buffer_size=1048576&overrun_nonfatal=0':
  Duration: N/A, start: 76814.510522, bitrate: N/A
  Program 14105
    Stream #0:0[0x145]: Video: h264 (High) ([27][0][0][0] / 0x001B),
nv12(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k
tbn, 25 tbc
    Stream #0:1[0x195](rus): Audio: mp2 ([4][0][0][0] / 0x0004), 48000
Hz, stereo, s16p, 192 kb/s (clean effects)
[h264_nvenc @ 0x361a780] InitializeEncoder failed: invalid param (8)
Output #0, mpegts, to 'http://192.168.3.36:8080/test321/mpegts':
    Stream #0:0: Unknown: none, SAR 1:1 DAR 0:0
    Metadata:
      encoder         : Lavc57.51.100 h264_nvenc
    Stream #0:1(rus): Unknown: none (clean effects)
    Metadata:
      encoder         : Lavc57.51.100 libfdk_aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (libfdk_aac))
Error while opening encoder for output stream #0:0 - maybe incorrect
parameters such as bit_rate, rate, width or height

After small research we've found that we're getting that error from
libnvidia-encode.so

Did anyone got same troubles, or may be solved such issue, or just
have any ideas?

-- 
With best regards, Evgeniy Kozhuhovskiy


More information about the ffmpeg-user mailing list