Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#8078 closed defect (invalid)

Closed captions removed when decoding with NVDEC

Reported by: Daniel Cantarín Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: cuda cc
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

NVDEC seems to remove CEA-608/708 captions from stream.

Related:
https://devtalk.nvidia.com/default/topic/1025092/video-codec-and-optical-flow-sdk/nvenc-with-ffmpeg-for-transcoding-closed-caption-text-display-order-issue-while-using-quot-bf-2-quot-/
http://trac.ffmpeg.org/ticket/6802
http://trac.ffmpeg.org/ticket/6726

Please note the difference between NVDEC (decoding) and NVENC (encoding). This ticket is about the DEcoding system, while the other tickets are ENcoding related.

How to reproduce:

root@cdn1:/# nvidia-smi
Fri Aug  9 21:18:57 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.40       Driver Version: 430.40       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro M4000        Off  | 00000000:05:00.0 Off |                  N/A |
| 55%   65C    P0    49W / 120W |   2640MiB /  8126MiB |     48%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+


root@cdn1:/# wget "http://samples.ffmpeg.org/MPEG-VOB/ClosedCaptions/Starship_Troopers.vob"
--2019-08-09 21:19:40--  http://samples.ffmpeg.org/MPEG-VOB/ClosedCaptions/Starship_Troopers.vob
Resolving samples.ffmpeg.org (samples.ffmpeg.org)... 79.124.17.100
Connecting to samples.ffmpeg.org (samples.ffmpeg.org)|79.124.17.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 29618176 (28M)
Saving to: 'Starship_Troopers.vob'

Starship_Troopers.vob                           100%[=====================================================================================================>]  28.25M  7.24MB/s    in 3.9s    

2019-08-09 21:19:45 (7.24 MB/s) - 'Starship_Troopers.vob' saved [29618176/29618176]



root@cdn1:/# ffprobe Starship_Troopers.vob 
ffprobe version N-94476-gf12e662 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-sdk --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpeg, from 'Starship_Troopers.vob':
  Duration: 00:00:51.30, start: 1986.626100, bitrate: 4618 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x83]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:2[0x82]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:3[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:4[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:5[0x20]: Subtitle: dvd_subtitle
    Stream #0:6[0x22]: Subtitle: dvd_subtitle



root@cdn1:/# ffmpeg -y -i Starship_Troopers.vob -map 'i:0x1e0' -c:v h264_nvenc -f mpegts out1.mp4
ffmpeg version N-94476-gf12e662 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-sdk --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpeg, from 'Starship_Troopers.vob':
  Duration: 00:00:51.30, start: 1986.626100, bitrate: 4618 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x83]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:2[0x82]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:3[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:4[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:5[0x20]: Subtitle: dvd_subtitle
    Stream #0:6[0x22]: Subtitle: dvd_subtitle
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
Output #0, mpegts, to 'out1.mp4':
  Metadata:
    encoder         : Lavf58.30.100
    Stream #0:0: Video: h264 (h264_nvenc) (Main), yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=-1--1, 2000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.55.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: -1
[mpeg @ 0x5580626fca00] New subtitle stream 0:7 at pos:8497166 and DTS:1999.51s/s speed=17.9x    
[mpeg2video @ 0x55806273b080] ac-tex damaged at 3 270:47.48 bitrate=1678.4kbits/s speed=23.7x    
[mpeg2video @ 0x55806273b080] Warning MVs not available
[mpeg2video @ 0x55806273b080] concealing 135 DC, 135 AC, 135 MV errors in I frame
Starship_Troopers.vob: corrupt decoded frame in stream 0
frame= 1229 fps=575 q=23.0 Lsize=   10725kB time=00:00:51.28 bitrate=1713.2kbits/s speed=  24x    
video:9811kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.312987%




root@cdn1:/# ffprobe out1.mp4              
ffprobe version N-94476-gf12e662 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-sdk --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpegts, from 'out1.mp4':
  Duration: 00:00:51.32, start: 1.400000, bitrate: 1712 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc




root@cdn1:/# ffmpeg -y -c:v mpeg2_cuvid -i Starship_Troopers.vob -map 'i:0x1e0' -c:v h264_nvenc -f mpegts out2.mp4
ffmpeg version N-94476-gf12e662 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-sdk --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpeg, from 'Starship_Troopers.vob':
  Duration: 00:00:51.30, start: 1986.626100, bitrate: 4618 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x83]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:2[0x82]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:3[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:4[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:5[0x20]: Subtitle: dvd_subtitle
    Stream #0:6[0x22]: Subtitle: dvd_subtitle
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (mpeg2_cuvid) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
Output #0, mpegts, to 'out2.mp4':
  Metadata:
    encoder         : Lavf58.30.100
    Stream #0:0: Video: h264 (h264_nvenc) (Main), nv12, 720x480 [SAR 32:27 DAR 16:9], q=-1--1, 2000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.55.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: -1
[mpeg @ 0x55621a00fa40] New subtitle stream 0:7 at pos:8497166 and DTS:1999.51s/s speed=10.4x    
frame= 1229 fps=371 q=23.0 Lsize=   10718kB time=00:00:51.35 bitrate=1709.8kbits/s speed=15.5x    
video:9806kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.301291%




root@cdn1:/# ffprobe out2.mp4 
ffprobe version N-94476-gf12e662 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-sdk --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpegts, from 'out2.mp4':
  Duration: 00:00:51.38, start: 1.400000, bitrate: 1708 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 720x480 [SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc



root@cdn1:/# ffmpeg -y -c:v h264_cuvid -i out1.mp4 -map 'i:0x100' -c:v h264_nvenc -f mpegts out3.mp4
ffmpeg version N-94476-gf12e662 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-sdk --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpegts, from 'out1.mp4':
  Duration: 00:00:51.32, start: 1.400000, bitrate: 1712 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
Output #0, mpegts, to 'out3.mp4':
  Metadata:
    encoder         : Lavf58.30.100
    Stream #0:0: Video: h264 (h264_nvenc) (Main), nv12, 720x480 [SAR 32:27 DAR 16:9], q=-1--1, 2000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.55.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: -1
frame= 1229 fps=427 q=21.0 Lsize=   10752kB time=00:00:51.41 bitrate=1713.0kbits/s speed=17.9x    
video:9834kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.330894%




root@cdn1:/# ffprobe out3.mp4 
ffprobe version N-94476-gf12e662 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-sdk --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpegts, from 'out3.mp4':
  Duration: 00:00:51.45, start: 1.400000, bitrate: 1711 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 720x480 [SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc

Those steps should be reproducible on a machine with nvidia card by just copying and pasting the commands. Please note the ffprobe output after each test: with software DEcoding, even when using hardware ENcoding, the stream deails say "Closed Captions". With hardware DEcoding, closed captions are never detected again, no matter the input stream codec (in the example, I've tested mpeg2 and h264).

I believe this was fixed in another (now closed) issue, but only for ENcoding.

Change History (10)

comment:1 by Timo R., 5 years ago

Does this also happen with other hardware decoders? Cause the code parsing stuff like CC is independent of the hardware decoder, which only decodes the actual video. None of the other hardware decoders deal with a53 in their code.

comment:2 by Daniel Cantarín, 5 years ago

Oh, I don't know, good point.

Now that you say it, I'm thinking about other possible decoders. I may have a raspberry pi somewhere, but right now I just have nVidia cards here. Do you know of any other common hardware decoder we could try?

If you happen to have some non-nVidia HW Decoder, please do try it and tell us what happens.
Thanks.

comment:3 by Timo R., 5 years ago

You at the very least have access to d3d11va or vdpau, depending on OS.

comment:4 by Hendrik, 5 years ago

You are using the deprecated cuvid decoder implementations, which don't support such metadata.
If you instead used the actual nvdec hardware acceleration, it should work just fine.

comment:5 by Daniel Cantarín, 5 years ago

@heleppkes

I've rebuilt ffmpeg with --enable-nvdec and don't see any indication of a "nvdec" hwaccel or any "*_nvdec" decoder.

root@cdn1:/opt/src/build/ffmpeg_build# ffmpeg -hwaccels
ffmpeg version N-94476-gf12e662 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-nvdec --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-nvcc --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Hardware acceleration methods:
vdpau
cuda
vaapi
opencl
cuvid

root@cdn1:/opt/src/build/ffmpeg_build# ffmpeg -decoders | grep -i nv
ffmpeg version N-94476-gf12e662 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-nvdec --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-nvcc --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
 V....D dsicinvideo          Delphine Software International CIN video
 V..... h264_cuvid           Nvidia CUVID H264 decoder (codec h264)
 V..... hevc_cuvid           Nvidia CUVID HEVC decoder (codec hevc)
 V....D idcinvideo           id Quake II CIN video (codec idcin)
 V..... mjpeg_cuvid          Nvidia CUVID MJPEG decoder (codec mjpeg)
 V..... mpeg1_cuvid          Nvidia CUVID MPEG1VIDEO decoder (codec mpeg1video)
 V..... mpeg2_cuvid          Nvidia CUVID MPEG2VIDEO decoder (codec mpeg2video)
 V..... mpeg4_cuvid          Nvidia CUVID MPEG4 decoder (codec mpeg4)
 V..... vc1_cuvid            Nvidia CUVID VC1 decoder (codec vc1)
 V..... vp8_cuvid            Nvidia CUVID VP8 decoder (codec vp8)
 V..... vp9_cuvid            Nvidia CUVID VP9 decoder (codec vp9)
 V....D wnv1                 Winnov WNV1
 A....D twinvq               VQF TwinVQ

However, I can see the encoders named "*_nvenc":

root@cdn1:/opt/src/build/ffmpeg_build# ffmpeg -encoders | grep -i nv   
ffmpeg version N-94476-gf12e662 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=./ --disable-shared --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda-8.0/targets/x86_64-linux/include --extra-cflags=-I../nvidia/cudautils --extra-ldflags=-L/usr/local/cuda-8.0/targets/x86_64-linux/lib --extra-ldflags=-L../nvidia/cudautils --enable-nonfree --enable-gpl --enable-version3 --enable-avresample --enable-avisynth --enable-openal --enable-opencl --enable-opengl --enable-libnpp --enable-nvenc --enable-nvdec --enable-libxvid --enable-libxml2 --enable-cuda --enable-cuda-nvcc --enable-vaapi --enable-vdpau --enable-libx264 --enable-libx265 --enable-libass --enable-libwavpack --enable-libsoxr --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libssh --enable-openssl --enable-omx-rpi --enable-omx --enable-libsrt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
 V..... h264_nvenc           NVIDIA NVENC H.264 encoder (codec h264)
 V..... nvenc                NVIDIA NVENC H.264 encoder (codec h264)
 V..... nvenc_h264           NVIDIA NVENC H.264 encoder (codec h264)
 V..... nvenc_hevc           NVIDIA NVENC hevc encoder (codec hevc)
 V..... hevc_nvenc           NVIDIA NVENC hevc encoder (codec hevc)

May it be some other flag I need to enable? Maybe some dependency? I'm working in an Ubuntu 18.04 system.

comment:6 by Timo R., 5 years ago

Analyzed by developer: set
Resolution: invalid
Status: newclosed

It's a hwaccel, not a dedicated decoder. Just pass -hwaccel nvdec and use the default decoder.

comment:7 by Daniel Cantarín, 5 years ago

Thanks oromit.

-hwaccel nvdec did work, even as it was not printed in the ffmpeg -hwaccels list.
However, if I transcode decoding with just hwaccel and default decoder, it works at ~10X. If I use -c:v mpeg2_cuvid for the input, it works at ~16X. That's a lot of performance loss.

Isn't there a mpeg2_nvdec decoder out there that I may be missing?

comment:8 by Philip Langdale, 5 years ago

You need both -hwaccel nvdec and -hwaccel_output_format cuda to get a full transcoding pipeline. This is normal hwaccel behaviour. The fact that cuvid defaults the hardware output format is the exception, and not the rule.

After that, you should see equivalent performance.

comment:9 by Carl Eugen Hoyos, 5 years ago

Component: ffmpegundetermined
Keywords: cuda added; nvidia nvdec removed

comment:10 by Mike, 4 years ago

Analyzed by developer: unset

Hi Canta. Were you able to get closed captioning to survive while maintaining performance? If so what does you command end up looking like? Thank you.

Note: See TracTickets for help on using tickets.