NVIDIA Optimized FFMPEg fails to do NVResize (Error 400)

Dear All ,

I have tried steps mentioned in document below and indeed nvenc encoder is working.
Unfortunately nvresize fails with error 400.

http://developer.download.nvidia.com/compute/redist/ffmpeg/1511-patch/FFMPEG-with-NVIDIA-Acceleration-on-Ubuntu_UG_v01.pdf

My current configuration is Dell-Precision-T1700 (Xeon Dual core, Quadro K620)
{ Ubuntu 14.04, 64 bit, Cuda 7.5 , NVidia SDK 5.0.1 , driver version 352.55}

[b]Error I receive is
[Parsed_nvresize_0 @ 0x180e9a0] nvresize::uninit

[libavfilter/vf_nvresize.c:412]dl_func->cu_launch_kernel(func, DIV_UP(dst_width, BLOCKX), DIV_UP(dst_height, BLOCKY), 1, BLOCKX, BLOCKY, 1, 0, NULL, args_uchar, NULL) has returned CUDA error 400
[/b]

Here is my ffmpeg command and response

ffmpeg -y -i BVE_Localize.mp4 -filter_complex
nvresize=5:s=hd1080|hd720|hd480|wvga|cif:readback=0[out0][out1][out2][out3][out4]
-map [out0] -strict -2 -vcodec nvenc_h264 -vb 5000k -acodec aac -ab 256k -f mpegts BVELocalize_hd.ts
-map [out1] -strict -2 -vcodec nvenc_h264 -vb 4000k -acodec aac -ab 128k -f mpegts BVELocalize_720p.ts
-map [out2] -strict -2 -vcodec libx264 -vb 2000k -acodec aac -ab 96k -f mpegts BVELocalize_480p.ts
-map [out3] -strict -2 -vcodec libx264 -vb 1000k -acodec aac -ab 64k -f mpegts BVELocalize_wvga.ts
-map [out4] -strict -2 -vcodec libx264 -vb 500k -acodec aac -ab 32k -f mpegts BVELocalize_cif.ts

ffmpeg version N-76688-ga01ba7f Copyright © 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --prefix=/home/amagi/melt/20151116 --enable-nonfree --enable-gpl --enable-version3 --enable-shared --enable-pthreads --enable-nvenc --enable-runtime-cpudetect --enable-nvresize --extra-cflags=-I…/cudautils --extra-ldflags=-L…/cudautils --disable-doc --enable-libmp3lame --enable-libx264
libavutil 55. 6.100 / 55. 6.100
libavcodec 57. 15.100 / 57. 15.100
libavformat 57. 14.100 / 57. 14.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 15.100 / 6. 15.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘BVE_Localize.mp4’:
Metadata:
major_brand : mp42
minor_version : 18743379
compatible_brands: mp42isom
creation_time : 2015-09-07 11:49:33
Duration: 00:05:22.32, start: 0.000000, bitrate: 12541 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s (default)
Metadata:
creation_time : 2015-09-07 11:49:33
handler_name : Sound Media Handler
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 12217 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
Metadata:
creation_time : 2015-09-07 11:49:33
handler_name : Video Media Handler
encoder : AVC Coding
[Parsed_nvresize_0 @ 0x180e9a0] nvresize::uninit
[libx264 @ 0x1be0c40] using SAR=640/639
[libx264 @ 0x1be0c40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x1be0c40] profile High, level 3.0
[libx264 @ 0x1be4220] using SAR=640/639
[libx264 @ 0x1be4220] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x1be4220] profile High, level 3.0
[libx264 @ 0x1be6f60] using SAR=16/11
[libx264 @ 0x1be6f60] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x1be6f60] profile High, level 2.0
Output #0, mpegts, to ‘BVELocalize_hd.ts’:
Metadata:
major_brand : mp42
minor_version : 18743379
compatible_brands: mp42isom
encoder : Lavf57.14.100
Stream #0:0: Video: h264 (nvenc_h264), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1–1, 5000 kb/s, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
encoder : Lavc57.15.100 nvenc_h264
Output #1, mpegts, to ‘BVELocalize_720p.ts’:
Metadata:
major_brand : mp42
minor_version : 18743379
compatible_brands: mp42isom
encoder : Lavf57.14.100
Stream #1:0: Video: h264 (nvenc_h264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1–1, 4000 kb/s, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
encoder : Lavc57.15.100 nvenc_h264
Output #2, mpegts, to ‘BVELocalize_480p.ts’:
Metadata:
major_brand : mp42
minor_version : 18743379
compatible_brands: mp42isom
encoder : Lavf57.14.100
Stream #2:0: Video: h264 (libx264), yuv420p, 852x480 [SAR 640:639 DAR 16:9], q=-1–1, 2000 kb/s, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
encoder : Lavc57.15.100 libx264
Output #3, mpegts, to ‘BVELocalize_wvga.ts’:
Metadata:
major_brand : mp42
minor_version : 18743379
compatible_brands: mp42isom
encoder : Lavf57.14.100
Stream #3:0: Video: h264 (libx264), yuv420p, 852x480 [SAR 640:639 DAR 16:9], q=-1–1, 1000 kb/s, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
encoder : Lavc57.15.100 libx264
Output #4, mpegts, to ‘BVELocalize_cif.ts’:
Metadata:
major_brand : mp42
minor_version : 18743379
compatible_brands: mp42isom
encoder : Lavf57.14.100
Stream #4:0: Video: h264 (libx264), yuv420p, 352x288 [SAR 16:11 DAR 16:9], q=-1–1, 500 kb/s, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
encoder : Lavc57.15.100 libx264
Stream mapping:
Stream #0:1 (h264) -> nvresize
nvresize:out0 -> Stream #0:0 (nvenc_h264)
nvresize:out1 -> Stream #1:0 (nvenc_h264)
nvresize:out2 -> Stream #2:0 (libx264)
nvresize:out3 -> Stream #3:0 (libx264)
nvresize:out4 -> Stream #4:0 (libx264)
Press [q] to stop, [?] for help
[libavfilter/vf_nvresize.c:412]dl_func->cu_launch_kernel(func, DIV_UP(dst_width, BLOCKX), DIV_UP(dst_height, BLOCKY), 1, BLOCKX, BLOCKY, 1, 0, NULL, args_uchar, NULL) has returned CUDA error 400
Last message repeated 971 times

Hi,
thanks for your interest in trying out nvresize.
At this time it only supports resizing to ‘n’ nvenc instances.
The “readback” parameter is if it should copy back to CPU memory after the resize. If the downstream is nvenc you leave this as ‘0’ - ie zero-copy.

So, if you want to try nvresize on non-nvidia encoders you can try “readback=1”…

eg

ffmpeg -y -i BVE_Localize.mp4 -filter_complex
nvresize=5:s=hd1080|hd720|hd480|wvga|cif:readback=1[out0][out1][out2][out3][out4]
-map [out0] -strict -2 -vcodec nvenc_h264 -vb 5000k -acodec aac -ab 256k -f mpegts BVELocalize_hd.ts
-map [out1] -strict -2 -vcodec nvenc_h264 -vb 4000k -acodec aac -ab 128k -f mpegts BVELocalize_720p.ts
-map [out2] -strict -2 -vcodec libx264 -vb 2000k -acodec aac -ab 96k -f mpegts BVELocalize_480p.ts
-map [out3] -strict -2 -vcodec libx264 -vb 1000k -acodec aac -ab 64k -f mpegts BVELocalize_wvga.ts
-map [out4] -strict -2 -vcodec libx264 -vb 500k -acodec aac -ab 32k -f mpegts BVELocalize_cif.ts

Dear Edward,

Usage of readback=0 or 1 doesn’t help,while nvenc_h264 continues to work , nvresize gives same 400 error.
I have also tried upgrading NVIDIA drivers to 352.63 that doesn’t help either.

Regards,
Abhijit

Hi,
did you resolve this?
Edward

Hi,
has anybody resolv this? I am usig ffmpeg from git or from 3.0 with a GTX970 and nvidia cuda 7.5 and nvidia codec video 6.0.1 and I always when try to use the nvresize filter I obtain this

[libavfilter/vf_nvresize.c:412]dl_func->cu_launch_kernel(func, DIV_UP(dst_width, BLOCKX), DIV_UP(dst_height, BLOCKY), 1, BLOCKX, BLOCKY, 1, 0, NULL, args_uchar, NULL) has returned CUDA error 400

this is my command line

ffmpeg -re -i …/Vídeos/ToS-4k-1920.mov -filter_complex nvresize=1:s=hd1080:readback=0[out0] -map [out0]0:a -f flv -c:v nvenc_h264 -preset hp -profile:v high -level 4.2 -b:v 4000k -maxrate 4200k -r 25 -c:a libfdk_aac -ar 48000 -ab 192k rtmp://…

best regards

thanks for all

Hi, jalowin.
I’ve got this error while compiling ffmpeg with --enable-shared and --disable-static flags.
Removed these flags from configure and successfully enabled nvresize and nvenc in ffmpeg.