hardware cuda decoding error Please see my input udp stream information: 


  ffprobe udp://IP:PORT


Input #0, mpegts, from 'udp://IP:PORT':
  Duration: N/A, start: 29796.225911, bitrate: N/A
  Program 16
    Stream #0:3[0x641]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, top first), 720x576 [SAR 12:11 DAR 15:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:5[0x642](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s (clean effects)
  Program 39
    Stream #0:7[0xf3d]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, top first), 720x576 [SAR 12:11 DAR 15:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:8[0xf3e](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s (clean effects)
  Program 11
    Stream #0:2[0x13ed]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, top first), 720x576 [SAR 12:11 DAR 15:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:6[0x13ee](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s (clean effects)
  Program 3
    Stream #0:9[0x10ce]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:4[0x10cf](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 96 kb/s
  Program 1
    Stream #0:0[0x1006]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1007](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 256 kb/s


I want to decode the video stream (Stream #0:0[0x1006]) with Program id 1  And doing it with the following command: 


  ffmpeg -analyzeduration 2G -probesize 11M -y -hwaccel cuvid -c:v
  h264_cuvid -i udp://IP:PORT -map
  0:#0x1006 -f rawvideo cuda_decoded.yuv


Please see the log:

[mpegts @ 0x2351d60] decoding for stream 0 failed
Input #0, mpegts, from 'udp://IP:PORT':
  Duration: N/A, start: 30271.455156, bitrate: N/A
  Program 16
    Stream #0:5[0x641]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, top first), 720x576 [SAR 12:11 DAR 15:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:6[0x642](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s (clean effects)
  Program 39
    Stream #0:2[0xf3d]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, top first), 720x576 [SAR 12:11 DAR 15:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:4[0xf3e](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s (clean effects)
  Program 11
    Stream #0:3[0x13ed]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, top first), 720x576 [SAR 12:11 DAR 15:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:8[0x13ee](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s (clean effects)
  Program 3
    Stream #0:7[0x10ce]: Video: h264 ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 16:15 DAR 4:3], 26.17 fps, 2.08 tbr, 90k tbn, 50 tbc
    Stream #0:9[0x10cf](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 96 kb/s
  Program 1
    Stream #0:0[0x1006]: Video: h264 ([2][0][0][0] / 0x0002), yuvj420p(pc, progressive), 16x32, 2.08 fps, 2.08 tbr, 90k tbn, 2514.04 tbc
    Stream #0:1[0x1007](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 256 kb/s
[h264_cuvid @ 0x240ca20] ctx-&gt;cvdl-&gt;cuvidCreateDecoder(&amp;cudec, &amp;cuinfo) failed -&gt; CUDA_ERROR_INVALID_VALUE: invalid argument
Stream mapping:
  Stream #0:0 -&gt; #0:0 (h264 (h264_cuvid) -&gt; rawvideo (native))
Error while opening decoder for input stream #0:0 : Generic error in an external library


Also I can decode it without any problems with the next command:


  ffmpeg -analyzeduration 2G -probesize 11M -y -i udp://IP:PORT -map
  0:#0x1006 -f rawvideo -pix_fmt yuv420p software_decoded.yuv


This issue affects only for some input streams. 

Have you any ideas why this issue occurs and any recommendations how to fix it?
Stream 0 is Stream #0:0[0x1006]: Video: mpeg2video for which you need -c:v mpeg2_cuvid