[FFmpeg-trac] #8831(undetermined:new): When using the overlay_cuda filter, I get the warning "Error while add the frame to buffer source(Internal bug, should not have happened) and encoding never starts"

FFmpeg trac at avcodec.org
Thu Jul 30 17:02:48 EEST 2020


#8831: When using the overlay_cuda filter, I get the warning "Error while add the
frame to buffer source(Internal bug, should not have happened) and encoding
never starts"
-------------------------------------+-------------------------------------
             Reporter:  Brainiarc7   |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  git-master   |               Resolution:
             Keywords:               |               Blocked By:
  overlay_cuda                       |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Changes (by Brainiarc7):

 * cc: dmngaie@… (added)
 * version:  unspecified => git-master


Comment:

 '''An update:'''

 With either {{{NVCDEC}}} or {{{CUVID}}}, as demonstrated with the command-
 lines:

 (a). NVDEC:

 {{{
 ffmpeg \
 -init_hw_device cuda=cuda:0 -filter_hw_device cuda \
 -hwaccel nvdec -hwaccel_device cuda \
 -loglevel debug \
 -fflags +genpts -fix_sub_duration \
 -threads 1 -extra_hw_frames 3 -avoid_negative_ts disabled -async 1 \
 -f mpegts -fix_teletext_pts 1 -scan_all_pmts 1 -merge_pmt_versions 1 \
 -i 'output.ts' \
 -filter_complex \
 "[0:v:0]format=yuv420p,hwupload[main]; \
 [0:s:3]format=yuva420p,hwupload[subs]; \
 [main][subs]overlay_cuda[v]; \
 [v]split=2[a][b]; \
 [a]scale_npp=1280:720:interp_algo=super[c]; \
 [b]scale_npp=720:576:interp_algo=super[d]" \
 -bsf:a aac_adtstoasc -c:a aac -ac 2 -ar 48000 -b:a 128k \
 -b:v:0 2250k -c:v:0 h264_nvenc -preset:v:0 llhq -profile:v:0 high -rc:v:0
 vbr_hq -level:v:0 4.2 -r:v:0 25 -g:v:0 100 -bf:v:0 3 -strict_gop:v:0 1 \
 -b:v:1 1750k -c:v:1 h264_nvenc -preset:v:1 llhq -profile:v:1 high -rc:v:0
 vbr_hq -level:v:1 4.2 -r:v:1 25 -g:v:1 100 -bf:v:1 3 -strict_gop:v:1 1 \
 -flags +global_header+cgop \
 -map "[c]" -map "[d]" -map a:2 \
 -f tee  \
 "[select=\'v:0,a\':f=mpegts]'test0.ts'| \
 [select=\'v:1,a\':f=mpegts]'test1.ts'"
 }}}

 (b). CUVID:

 {{{
 ffmpeg \
 -init_hw_device cuda=cuda:0 -filter_hw_device cuda \
 -hwaccel cuvid -hwaccel_device cuda -hwaccel_output_format cuda \
 -fflags +genpts -fix_sub_duration \
 -threads 1 -extra_hw_frames 3 -avoid_negative_ts disabled -async 1 \
 -f mpegts -fix_teletext_pts 1 -scan_all_pmts 1 -merge_pmt_versions 1 \
 -c:v h264_cuvid -i 'output.ts' \
 -filter_complex \
 "[0:v:0]scale_npp=format=yuv420p[main]; \
 [0:s:3]format=yuva420p,hwupload[subs]; \
 [main][subs]overlay_cuda[v]; \
 [v]split=2[a][b]; \
 [a]scale_npp=1280:720:interp_algo=super[c]; \
 [b]scale_npp=720:576:interp_algo=super[d]" \
 -bsf:a aac_adtstoasc -c:a aac -ac 2 -ar 48000 -b:a 128k \
 -b:v:0 2250k -c:v:0 h264_nvenc -preset:v:0 llhq -profile:v:0 high -rc:v:0
 vbr_hq -level:v:0 4.2 -r:v:0 25 -g:v:0 100 -bf:v:0 3 -strict_gop:v:0 1 \
 -b:v:1 1750k -c:v:1 h264_nvenc -preset:v:1 llhq -profile:v:1 high -rc:v:0
 vbr_hq -level:v:1 4.2 -r:v:1 25 -g:v:1 100 -bf:v:1 3 -strict_gop:v:1 1 \
 -flags +global_header+cgop \
 -map "[c]" -map "[d]" -map a:2 \
 -f tee  \
 "[select=\'v:0,a\':f=mpegts]'test0.ts'| \
 [select=\'v:1,a\':f=mpegts]'test1.ts'"
 }}}

 I now get a somewhat more cryptic error message:

 "Failed to inject frame into filter network: Internal bug, should not have
 happened".

 Snippet of the log with the message when Ctrl+C is pressed to kill the
 process:

 {{{
 ffmpeg -loglevel verbose -init_hw_device cuda=cuda:0 -filter_hw_device
 cuda -hwaccel cuvid -hwaccel_device cuda -hwaccel_output_format cuda
 -fflags +genpts -fix_sub_duration -threads 1 -extra_hw_frames 3
 -avoid_negative_ts disabled -async 1 -f mpegts -fix_teletext_pts 1
 -scan_all_pmts 1 -merge_pmt_versions 1 -c:v h264_cuvid -i 'output.ts'
 -filter_complex "[0:v:0]scale_npp=format=yuv420p[main]; \
 [0:s:3]format=yuva420p,hwupload[subs]; \
 [main][subs]overlay_cuda[v]; \
 [v]split=2[a][b]; \
 [a]scale_npp=1280:720:interp_algo=super[c]; \
 [b]scale_npp=720:576:interp_algo=super[d]" -bsf:a aac_adtstoasc -c:a aac
 -ac 2 -ar 48000 -b:a 128k -b:v:0 2250k -c:v:0 h264_nvenc -preset:v:0 llhq
 -profile:v:0 high -rc:v:0 vbr_hq -level:v:0 4.2 -r:v:0 25 -g:v:0 100
 -bf:v:0 3 -strict_gop:v:0 1 -b:v:1 1750k -c:v:1 h264_nvenc -preset:v:1
 llhq -profile:v:1 high -rc:v:0 vbr_hq -level:v:1 4.2 -r:v:1 25 -g:v:1 100
 -bf:v:1 3 -strict_gop:v:1 1 -flags +global_header+cgop -map "[c]" -map
 "[d]" -map a:2 -f tee  "[select=\'v:0,a\':f=mpegts]'test0.ts'| \
 [select=\'v:1,a\':f=mpegts]'test1.ts'"
 ffmpeg version N-98600-gbe3c10d551 Copyright (c) 2000-2020 the FFmpeg
 developers
   built with gcc 8 (Ubuntu 8.4.0-1ubuntu1~18.04)
   configuration: --pkg-config-flags=--static --enable-static --disable-
 shared --prefix=/home/brainiarc7 --bindir=/home/brainiarc7/bin --extra-
 cflags=-I/home/brainiarc7/include --extra-ldflags=-L/home/brainiarc7/lib
 --enable-cuda-nvcc --enable-cuvid --enable-libnpp --extra-
 cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/
 --enable-nvenc --enable-libass --disable-debug --enable-libvorbis
 --enable-libvpx --enable-libdrm --enable-opencl --enable-libxml2 --enable-
 gpl --cpu=native --enable-opengl --enable-libfdk-aac --enable-libx264
 --enable-libx265 --enable-openssl --enable-librtmp --enable-libpulse
 --enable-libzvbi --enable-librav1e --enable-libvmaf --enable-libsrt
 --enable-avisynth --enable-libsvtav1 --enable-version3 --enable-pic
 --nvccflags='-gencode arch=compute_75,code=sm_75 -O2' --extra-
 libs='-lpthread -lm -lz -ldl' --enable-nonfree
   libavutil      56. 57.100 / 56. 57.100
   libavcodec     58. 98.100 / 58. 98.100
   libavformat    58. 49.100 / 58. 49.100
   libavdevice    58. 11.101 / 58. 11.101
   libavfilter     7. 87.100 /  7. 87.100
   libswscale      5.  8.100 /  5.  8.100
   libswresample   3.  8.100 /  3.  8.100
   libpostproc    55.  8.100 / 55.  8.100
 [h264 @ 0x55e3fb6e1180] Reinit context to 1920x1088, pix_fmt: yuv420p
 [h264 @ 0x55e3fb6e1180] Increasing reorder buffer to 2
 [mpegts @ 0x55e3fb6c0540] start time for stream 7 is not set in
 estimate_timings_from_pts
 [mpegts @ 0x55e3fb6c0540] start time for stream 8 is not set in
 estimate_timings_from_pts
 [mpegts @ 0x55e3fb6c0540] start time for stream 10 is not set in
 estimate_timings_from_pts
 [mpegts @ 0x55e3fb6c0540] start time for stream 11 is not set in
 estimate_timings_from_pts
 [mpegts @ 0x55e3fb6c0540] start time for stream 12 is not set in
 estimate_timings_from_pts
 [mpegts @ 0x55e3fb6c0540] start time for stream 13 is not set in
 estimate_timings_from_pts
 [mpegts @ 0x55e3fb6c0540] start time for stream 14 is not set in
 estimate_timings_from_pts
 [mpegts @ 0x55e3fb6c0540] start time for stream 15 is not set in
 estimate_timings_from_pts
 [mpegts @ 0x55e3fb6c0540] start time for stream 16 is not set in
 estimate_timings_from_pts
 [mpegts @ 0x55e3fb6c0540] Forcing DTS/PTS to be unset for a non-
 trustworthy PES packet for PID 264 as PCR hasn't been received yet.
 [mpegts @ 0x55e3fb6c0540] Forcing DTS/PTS to be unset for a non-
 trustworthy PES packet for PID 268 as PCR hasn't been received yet.
 [mpegts @ 0x55e3fb6c0540] Forcing DTS/PTS to be unset for a non-
 trustworthy PES packet for PID 271 as PCR hasn't been received yet.
 [mpegts @ 0x55e3fb6c0540] Forcing DTS/PTS to be unset for a non-
 trustworthy PES packet for PID 269 as PCR hasn't been received yet.
 [mpegts @ 0x55e3fb6c0540] Forcing DTS/PTS to be unset for a non-
 trustworthy PES packet for PID 263 as PCR hasn't been received yet.
 [mpegts @ 0x55e3fb6c0540] Forcing DTS/PTS to be unset for a non-
 trustworthy PES packet for PID 266 as PCR hasn't been received yet.
 [mpegts @ 0x55e3fb6c0540] Forcing DTS/PTS to be unset for a non-
 trustworthy PES packet for PID 270 as PCR hasn't been received yet.
 Input #0, mpegts, from 'output.ts':
   Duration: 00:02:00.14, start: 1.400000, bitrate: 14627 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: h264 (Main), 1 reference frame
 ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first, left), 1920x1080
 (1920x1088) [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
     Stream #0:1[0x101](cze): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
 stereo, fltp, 256 kb/s
     Stream #0:2[0x102](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000
 Hz, stereo, fltp, 448 kb/s
     Stream #0:3[0x103](hun): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
 stereo, fltp, 256 kb/s
     Stream #0:4[0x104](tur): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
 stereo, fltp, 256 kb/s
     Stream #0:5[0x105](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
 stereo, fltp, 256 kb/s
     Stream #0:6[0x106](gre): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
 stereo, fltp, 256 kb/s
     Stream #0:7[0x107](swe): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
     Stream #0:8[0x108](mkd): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
     Stream #0:9[0x109](gre): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
     Stream #0:10[0x10a](rum): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
     Stream #0:11[0x10b](hrv): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
     Stream #0:12[0x10c](slv): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
     Stream #0:13[0x10d](dan): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
     Stream #0:14[0x10e](nor): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
     Stream #0:15[0x10f](srp): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
     Stream #0:16[0x110](cze): Subtitle: dvb_subtitle ([6][0][0][0] /
 0x0006)
 [h264_mp4toannexb @ 0x55e3fb6ecf80] The input looks like it is Annex B
 already
 [h264_cuvid @ 0x55e3fda84640] CUVID capabilities for h264_cuvid:
 [h264_cuvid @ 0x55e3fda84640] 8 bit: supported: 1, min_width: 48,
 max_width: 4096, min_height: 16, max_height: 4096
 [h264_cuvid @ 0x55e3fda84640] 10 bit: supported: 0, min_width: 0,
 max_width: 0, min_height: 0, max_height: 0
 [h264_cuvid @ 0x55e3fda84640] 12 bit: supported: 0, min_width: 0,
 max_width: 0, min_height: 0, max_height: 0
 Stream mapping:
   Stream #0:0 (h264_cuvid) -> scale_npp (graph 0)
   Stream #0:10 (dvbsub) -> format (graph 0)
   scale_npp (graph 0) -> Stream #0:0 (h264_nvenc)
   scale_npp (graph 0) -> Stream #0:1 (h264_nvenc)
   Stream #0:3 -> #0:2 (mp2 (native) -> aac (native))
 Press [q] to stop, [?] for help
 [graph_1_in_0_3 @ 0x55e3fbab1d40] tb:1/48000 samplefmt:s16p
 samplerate:48000 chlayout:0x3
 -async is forwarded to lavfi similarly to -af
 aresample=async=1:min_hard_comp=0.100000:first_pts=0.
 [graph_1_aresample_in_0_3 @ 0x55e3fd821880] ch:2 chl:stereo fmt:s16p
 r:48000Hz -> ch:2 chl:stereo fmt:fltp r:48000Hz
 [graph_1_aresample_in_0_3 @ 0x55e3fd821880] [SWR @ 0x55e3fd7ed700] adding
 4224 audio samples of silence
 [h264_cuvid @ 0x55e3fda84640] Formats: Original: cuda | HW: cuda | SW:
 nv12
 [graph 0 input from stream 0:0 @ 0x55e3fbae3640] w:1920 h:1080 pixfmt:cuda
 tb:1/90000 fr:25/1 sar:1/1
 [mpegts @ 0x55e3fb6c0540] sub2video: using 1920x1080 canvas
 [graph 0 input from stream 0:10 @ 0x55e3fbb0af00] w:1920 h:1080
 pixfmt:bgra tb:1/90000 fr:0/1 sar:0/1
 [auto_scaler_0 @ 0x55e3fdb48980] w:iw h:ih flags:'bilinear' interl:0
 [Parsed_format_1 @ 0x55e3fbac2f40] auto-inserting filter 'auto_scaler_0'
 between the filter 'graph 0 input from stream 0:10' and the filter
 'Parsed_format_1'
 [Parsed_scale_npp_0 @ 0x55e3fbbfaec0] w:1920 h:1080 -> w:1920 h:1080
 [auto_scaler_0 @ 0x55e3fdb48980] w:1920 h:1080 fmt:bgra sar:0/1 -> w:1920
 h:1080 fmt:yuva420p sar:0/1 flags:0x2
 [Parsed_overlay_cuda_3 @ 0x55e3fd9481c0] [framesync @ 0x55e3fd948338] Sync
 level 2
 [Parsed_scale_npp_6 @ 0x55e3fda41400] w:1920 h:1080 -> w:720 h:576
 [Parsed_scale_npp_5 @ 0x55e3fda87b00] w:1920 h:1080 -> w:1280 h:720
 [h264_nvenc @ 0x55e3fd768240] Using input frames context (format cuda)
 with h264_nvenc encoder.
 [h264_nvenc @ 0x55e3fd768240] Loaded Nvenc version 10.0
 [h264_nvenc @ 0x55e3fd768240] Nvenc initialized successfully
 [h264_nvenc @ 0x55e3fd768240] Strict GOP target enabled.
 [h264_nvenc @ 0x55e3fba6dbc0] Using input frames context (format cuda)
 with h264_nvenc encoder.
 [h264_nvenc @ 0x55e3fba6dbc0] Loaded Nvenc version 10.0
 [h264_nvenc @ 0x55e3fba6dbc0] Nvenc initialized successfully
 [h264_nvenc @ 0x55e3fba6dbc0] Strict GOP target enabled.
 [mpegts @ 0x55e3fcc105c0] service 1 using PCR in pid=256, pcr_period=80ms
 [mpegts @ 0x55e3fcc105c0] muxrate VBR, sdt every 500 ms, pat/pmt every 100
 ms
 [tee @ 0x55e3fbb19d40] filename:'test0.ts' format:mpegts
 [tee @ 0x55e3fbb19d40]     stream:0 codec:h264 type:video bsfs: null
 [tee @ 0x55e3fbb19d40]     stream:1 codec:aac type:audio bsfs: null
 [mpegts @ 0x55e3fcc17cc0] service 1 using PCR in pid=256, pcr_period=80ms
 [mpegts @ 0x55e3fcc17cc0] muxrate VBR, sdt every 500 ms, pat/pmt every 100
 ms
 [tee @ 0x55e3fbb19d40] filename:'test1.ts' format:mpegts
 [tee @ 0x55e3fbb19d40]     stream:0 codec:h264 type:video bsfs: null
 [tee @ 0x55e3fbb19d40]     stream:1 codec:aac type:audio bsfs: null
 Output #0, tee, to '[select=\'v:0,a\':f=mpegts]'test0.ts'|
 [select=\'v:1,a\':f=mpegts]'test1.ts'':
   Metadata:
     encoder         : Lavf58.49.100
     Stream #0:0: Video: h264 (h264_nvenc) (High), 1 reference frame, cuda,
 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 2250 kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.98.100 h264_nvenc
     Side data:
       cpb: bitrate max/min/avg: 0/0/2250000 buffer size: 4500000
 vbv_delay: N/A
     Stream #0:1: Video: h264 (h264_nvenc) (High), 1 reference frame, cuda,
 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 1750 kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.98.100 h264_nvenc
     Side data:
       cpb: bitrate max/min/avg: 0/0/1750000 buffer size: 3500000
 vbv_delay: N/A
     Stream #0:2(hun): Audio: aac (LC), 48000 Hz, stereo, fltp, delay 1024,
 128 kb/s
     Metadata:
       encoder         : Lavc58.98.100 aac
 Error while add the frame to buffer source(Internal bug, should not have
 happened).
 Error while filtering: Internal bug, should not have happenedrate=N/A
 speed=0.0543x
 Failed to inject frame into filter network: Internal bug, should not have
 happened
 Error while processing the decoded data for stream #0:0
 [h264_nvenc @ 0x55e3fd768240] Nvenc unloaded
 [h264_nvenc @ 0x55e3fba6dbc0] Nvenc unloaded
 [aac @ 0x55e3fbbc5a80] Qavg: 5722.258
 [aac @ 0x55e3fbbc5a80] 2 frames left in the queue on closing
 [AVIOContext @ 0x55e3fb6c9740] Statistics: 6770832 bytes read, 2 seeks
 Exiting normally, received signal 2.
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8831#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list