Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#6952 closed defect (fixed)

Unable to decode & encode a file with cuvid & nvenc

Reported by: dogenius01 Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: nvenc cuvid hwaccel
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Unable to decode & encode a file with cuvid & nvenc

How to reproduce:

% ffmpeg -hide_banner -hwaccel cuvid -c:v h264_cuvid -resize 854x480 -i ./waterfall.mp4 -c:a copy -c:v h264_nvenc 123.mp4
ffmpeg version N-89471-g88e2dc7 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --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/ --enable-gpl --enable-libass --enable-libfdk-aac --enable-libx264 --enable-nvenc --enable-nonfree
  libavutil      56.  5.100 / 56.  5.100
  libavcodec     58.  6.103 / 58.  6.103
  libavformat    58.  3.100 / 58.  3.100
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  7.100 /  7.  7.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 './waterfall.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp41mp42isom
    creation_time   : 2017-06-28T01:08:40.000000Z
  Duration: 00:00:06.20, start: 0.000000, bitrate: 2675 kb/s
    Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x404, 2592 kb/s, 29.84 fps, 30 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2017-06-28T01:08:40.000000Z
      handler_name    : Core Media Video
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s (default)
    Metadata:
      creation_time   : 2017-06-28T01:08:40.000000Z
      handler_name    : Core Media Audio
File '123.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
Conversion failed!

You can view or download that video file from here => https://drive.google.com/file/d/1IE9opN-5CjwX7kp0zIcvyu6SyFBrmsMP/view

Change History (4)

comment:1 by dogenius01, 6 years ago

The rotation of input file is the problem. But i dont know how to fix it.
Does anyone know how to solve it?

Last edited 6 years ago by dogenius01 (previous) (diff)

comment:2 by Hendrik, 6 years ago

You can pass "-autorotate 0" to stop FFmpeg from trying to rotate the video (which it cannot perform if you use a full cuvid pipeline), but of course if thats required, it might still be a problem.

comment:3 by dogenius01, 6 years ago

Resolution: fixed
Status: newclosed

in reply to:  2 comment:4 by dogenius01, 6 years ago

Now it works perfectly with your advise.
$ ffmpeg -hide_banner -hwaccel cuvid -c:v h264_cuvid -resize 854x480 -autorotate 0 -i waterfall.mp4 -c:a aac -c:v h264_nvenc -rc vbr output.mp4

Replying to heleppkes:

You can pass "-autorotate 0" to stop FFmpeg from trying to rotate the video (which it cannot perform if you use a full cuvid pipeline), but of course if thats required, it might still be a problem.

Note: See TracTickets for help on using tickets.