[FFmpeg-user] Corrupted output when resizing with scale_npp filter

Christian Kaik christian.kaik at cinepostproduction.de
Fri Jan 5 14:43:49 EET 2018


Hello everyone,

I've been struggling with this and unfortunately I'm not getting any further.
I'm trying to transcode a single video file into multiple variants with different
resolutions/bitrates using GPU acceleration - in one command.

The idea seems simple, and is even covered by NVIDIA
as well as ffmpeg on their respective websites, which is
what I've been following:
https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDACUVIDNvDecode
https://developer.nvidia.com/ffmpeg

The encoding/decoding part is working great and produces results as expected.
However when I try to resize using the scale_npp filter things start to turn green.
The resulting output from ffmpeg is just a green image
with very low bit rate/filesize, but correct resolution.

I considered using the NVDEC decoder's resizing function,
while that does work it makes things a bit more complicated,
since I have to launch a separate ffmpeg job for each and every encoding.

This is the command I've been using:

ffmpeg -y \
  -hwaccel cuvid -c:v h264_cuvid -i input.mp4 \
  -vf scale_npp=-1:480 \
  -c:v h264_nvenc -preset slow -ss 0 -t 90 output.mp4

I've tried this on Ubuntu 16.04/17.10 as well as Cent OS 7. CentOS and
Ubuntu 17.10 were on the same machine, Ubuntu 16.04 was on another one.
The output is at the end of this Message and it's from the Ubuntu 17.10 machine.
I only used self-compiled ffmpeg binaries. The result stays the same.

I appreciate your help.

Best Regards,
Christian

ffmpeg version N-89672-g41e51fb Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.2.0-8ubuntu3)
  configuration: --prefix=/home/user/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/user/ffmpeg_build/include --extra-ldflags=-L/home/user/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/user/bin --enable-gpl --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --extra-libs=-lpthread --enable-nvenc --enable-cuda-sdk --enable-cuvid --enable-libnpp --extra-cflags=-I../nv_sdk --extra-ldflags=-L../nv_sdk --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --nvccflags='-gencode arch=compute_61,code=sm_61 -O2' --enable-nonfree
  libavutil      56.  7.100 / 56.  7.100
  libavcodec     58.  9.100 / 58.  9.100
  libavformat    58.  3.100 / 58.  3.100
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  8.100 /  7.  8.100
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.3.100
  Duration: 01:24:24.36, start: 0.000000, bitrate: 19773 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 19772 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      timecode        : 01:00:00:00
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : TimeCodeHandler
      timecode        : 01:00:00:00
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.3.100
    Stream #0:0(eng): Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661), cuda, 853x480 [SAR 2560:2559 DAR 16:9], q=-1--1, 2000 kb/s, 0.04 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      timecode        : 01:00:00:00
      encoder         : Lavc58.9.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: -1
frame= 2250 fps=563 q=8.0 Lsize=      93kB time=00:01:29.96 bitrate=   8.5kbits/s speed=22.5x
video:83kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 12.122848%


More information about the ffmpeg-user mailing list