Opened 5 years ago

Closed 4 years ago

#8232 closed defect (invalid)

decklink -> nvenc -> mpegts crush

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

Description

Summary of the bug:
Hello!

Ubuntu 18.04.3
ffmpeg 4.2
Driver Version: 435.21
CUDA Version: 10.1
Nvenc version 9.1

Capture Device: DeckLink Mini Recorder 4K
GPU: NVidia GeForce GTX 1660

i need stream input video to mpegts udp:
How to reproduce:

% ffmpeg \
    -use_wallclock_as_timestamps 1 \
    -loglevel debug \
    -hwaccel nvdec \
    -threads 8 -thread_type frame \
    -f decklink \
    -video_pts wallclock \
    -audio_pts wallclock \
    -draw_bars true \
    -raw_format yuv422p10 \
    -channels 2 \
    -i 'DeckLink Mini Recorder 4K' \
\
    -c:v h264_nvenc \
    -vsync 0 \
    -preset:v slow \
    -profile:v high \
    -level:v 4.2 \
    -rc cbr_hq \
    -rc-lookahead 32 \
    -surfaces 64 \
    -weighted_pred 1 \
    -pix_fmt yuv420p \
    -b:v 4.8M \
    -cq 17 \
    -qmin 1 \
    -qmax 18 \
    -g 12 \
    -refs 2 \
\
    -c:a libfdk_aac \
    -profile:a aac_he_v2 \
    -ac 2 \
    -ar 48000 \
    -af 'aresample=async=1' \
\
    -f mpegts 'udp://@239.0.0.1:2266?pkt_size=1316&fifo_size=1000000&buffer_size=100000000&overrun_nonfatal=1'
ffmpeg version 4.2.git-3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=/tmp/ffmpeg_build --extra-version=3 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --extra-cflags=-I/tm
p/ffmpeg_build/include --extra-ldflags=-L/tmp/ffmpeg_build/lib --enable-gpl --disable-stripping --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable
-txtpages --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfontconfig --ena
ble-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libshin
e --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-li
bwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-frei0r --enable-l
ibx264 --enable-shared --enable-decklink --extra-cflags=-I/home/karcun/src/BMSDK11.3 --extra-ldflags=-L/home/karcun/src/BMSDK11.3 --enable-nonfree --extra-ldflags='-static-libst
dc++ -static-libgcc' --enable-static --enable-pic --enable-libfdk-aac --enable-cross-compile --pkg-config=pkg-config --enable-libnpp --enable-cuda-nvcc --enable-cuvid --enable-n
venc --enable-libopenmpt --enable-libxml2 --enable-libzmq --enable-opencl --arch=x86_64

after some little time of encoding, it crushes with one of reasons:

frame=17251 fps= 25 q=26.0 size=  420858kB time=00:11:29.95 bitrate=4997.0kbits/s speed=   1x
frame=17264 fps= 25 q=26.0 size=  421170kB time=00:11:30.50 bitrate=4996.7kbits/s speed=   1x
[decklink @ 0x55dc42b4ac00] Frame received (#17275) - Valid (5529600B) - QSize 0.000000MB
frame=17277 fps= 25 q=26.0 size=  421484kB time=00:11:31.01 bitrate=4996.7kbits/s speed=   1x
[decklink @ 0x55dc42b4ac00] Frame received (#17300) - Valid (5529600B) - QSize 63.378754MB
[decklink @ 0x55dc42b4ac00] Frame received (#17325) - Valid (5529600B) - QSize 195.402374MB
[decklink @ 0x55dc42b4ac00] Frame received (#17350) - Valid (5529600B) - QSize 327.425995MB
[decklink @ 0x55dc42b4ac00] Frame received (#17375) - Valid (5529600B) - QSize 459.449615MB
[decklink @ 0x55dc42b4ac00] Frame received (#17400) - Valid (5529600B) - QSize 591.473236MB
[decklink @ 0x55dc42b4ac00] Frame received (#17425) - Valid (5529600B) - QSize 723.496857MB
[decklink @ 0x55dc42b4ac00] Frame received (#17450) - Valid (5529600B) - QSize 855.520477MB
[decklink @ 0x55dc42b4ac00] Frame received (#17475) - Valid (5529600B) - QSize 987.544098MB
[decklink @ 0x55dc42b4ac00] Decklink input buffer overrun!
    Last message repeated 36 times
[decklink @ 0x55dc42b4ac00] Frame received (#17500) - Valid (5529600B) - QSize 1024.503296MB
[decklink @ 0x55dc42b4ac00] Decklink input buffer overrun!
    Last message repeated 49 times
[decklink @ 0x55dc42b4ac00] Frame received (#17525) - Valid (5529600B) - QSize 1024.503296MB
[decklink @ 0x55dc42b4ac00] Decklink input buffer overrun!
    Last message repeated 49 times
[decklink @ 0x55dc42b4ac00] Frame received (#17550) - Valid (5529600B) - QSize 1024.503296MB
[decklink @ 0x55dc42b4ac00] Decklink input buffer overrun!
    Last message repeated 49 times

and ffmpeg stay alive with repeating:

[decklink @ 0x55dc42b4ac00] Decklink input buffer overrun!
[decklink @ 0x55dc42b4ac00] Frame received (#{frame_number}) - Valid (5529600B) - QSize 1024.503296MB

syslog:

kernel: [ 1240.080358] NVRM: GPU at PCI:0000:01:00: GPU-6caba61c-b997-efe4-1f42-012b974eadb5
kernel: [ 1240.080362] NVRM: GPU Board Serial Number:
kernel: [ 1240.080369] NVRM: Xid (PCI:0000:01:00): 31, pid=2196, Ch 00000038, intr 00000000. MMU Fault: ENGINE NVENC0 HUBCLIENT_NVENC0 faulted @ 0x0_00001000. Fault is of type FAULT_PDE ACCESS_TYPE_VIRT_READ

or:

[h264_nvenc @ 0x5612f414e040] Failed locking bitstream buffer: invalid param (8)
Video encoding failed
[libfdk_aac @ 0x5612f416b480] 4 frames left in the queue on closing
Conversion failed!

it`s bug or i do it wrong?

Attachments (1)

2019_10_09__10_34_17.log (803.6 KB ) - added by ANTON CHELOSHKIN 5 years ago.
decklink->h264_nvenc complete log

Download all attachments as: .zip

Change History (4)

comment:1 by Carl Eugen Hoyos, 5 years ago

Component: ffmpegundetermined
Priority: criticalnormal
Version: 4.2unspecified

Please test current FFmpeg git head and provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

by ANTON CHELOSHKIN, 5 years ago

Attachment: 2019_10_09__10_34_17.log added

decklink->h264_nvenc complete log

comment:2 by ANTON CHELOSHKIN, 5 years ago

hmm... it`s a driver bug.
when i do pipeline:

decklink > libx246(q=1-3) -> rtmp (150Mbit/s) -> h264_nvenc(mpegts udp)

, it`s working fine!

most likely this is a bug of the proprietary nvidia driver.

i include complete ffmpeg output.
command is:

ffmpeg \
    -use_wallclock_as_timestamps 1 \
    -loglevel debug \
    -hwaccel nvdec \
    -threads 8 -thread_type frame \
    -f decklink \
    -video_pts wallclock \
    -audio_pts wallclock \
    -draw_bars true \
    -raw_format yuv422p10 \
    -channels 2 \
    -i 'DeckLink Mini Recorder 4K' \
\
    -c:v h264_nvenc \
    -vsync 0 \
    -preset:v slow \
    -profile:v high \
    -level:v 4.2 \
    -rc cbr_hq \
    -rc-lookahead 32 \
    -surfaces 64 \
    -weighted_pred 1 \
    -pix_fmt yuv420p \
    -b:v 4.8M \
    -cq 17 \
    -qmin 1 \
    -qmax 18 \
    -g 12 \
    -refs 2 \
\
    -c:a libfdk_aac \
    -profile:a aac_he_v2 \
    -ac 2 \
    -ar 48000 \
    -af 'aresample=async=1' \
\
    -f mpegts 'udp://@239.0.0.1:2266?pkt_size=1316&fifo_size=1000000&buffer_size=100000000&overrun_nonfatal=1'
Last edited 5 years ago by ANTON CHELOSHKIN (previous) (diff)

comment:3 by Carl Eugen Hoyos, 4 years ago

Resolution: invalid
Status: newclosed

Afaict, the kernel messages do not indicate a bug that can be fixed in FFmpeg.

Note: See TracTickets for help on using tickets.