[FFmpeg-trac] #6431(undetermined:new): Linux ffmpeg always segfaults using NVIDIA hw decoders/encoders
FFmpeg
trac at avcodec.org
Wed May 31 22:13:21 EEST 2017
#6431: Linux ffmpeg always segfaults using NVIDIA hw decoders/encoders
-------------------------------------+-------------------------------------
Reporter: bubbleguuum | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: nvidia | Blocked By:
Blocking: | Reproduced by developer: 1
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary: using NVIDIA hardware decoding features always crashes ffmpeg
with a Segmentation fault.
How to reprod:
- Required: a NVIDIA card (starting with Geforce 600 series) and working
NVIDIA binary drivers (reproduced with v375.66, v378.13 and the latest at
this time: 381.22)
- ffmpeg compiled with NVIDIA support (at least with the h264_nvdec
decoder)
This can be quickly reproduced using the static ffmpeg 3.3.1 (or git)
build from https://johnvansickle.com/ffmpeg/, with either the 32 bit or 64
bit version.
Crashing output, trying to encode with h264_nvenc:
{{{
ffmpeg -v debug -i
http://bubblesoftapps.com/bubbleupnpserver/transcode_test/tos_sample_h264.mkv
-map 0 -c:0 h264_nvenc -f null /dev/null
ffmpeg version 3.3.1-static http://johnvansickle.com/ffmpeg/ Copyright
(c) 2000-2017 the FFmpeg developers
built with gcc 5.4.1 (Debian 5.4.1-8) 20170304
configuration: --enable-gpl --enable-version3 --enable-static --disable-
debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio
--cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-
gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-
libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-
libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxvid --enable-libzimg
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with
argument 'debug'.
Reading option '-i' ... matched as input url with argument
'http://bubblesoftapps.com/bubbleupnpserver/transcode_test/tos_sample_h264.mkv'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0'.
Reading option '-c:0' ... matched as option 'c' (codec name) with argument
'h264_nvenc'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'null'.
Reading option '/dev/null' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url
http://bubblesoftapps.com/bubbleupnpserver/transcode_test/tos_sample_h264.mkv.
Successfully parsed a group of options.
Opening an input file:
http://bubblesoftapps.com/bubbleupnpserver/transcode_test/tos_sample_h264.mkv.
[http @ 0x3fde720] Setting default whitelist
'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[http @ 0x3fde720] request: GET
/bubbleupnpserver/transcode_test/tos_sample_h264.mkv HTTP/1.1
User-Agent: Lavf/57.71.100
Accept: */*
Range: bytes=0-
Connection: close
Host: bubblesoftapps.com
Icy-MetaData: 1
[matroska,webm @ 0x3fddec0] Format matroska,webm probed with size=2048 and
score=100
st:0 removing common factor 1000000 from timebase
[matroska,webm @ 0x3fddec0] Before avformat_find_stream_info() pos: 843
bytes read:3779 seeks:0 nb_streams:1
[h264 @ 0x3fe5300] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x3fe5300] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x3fe5300] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x3fe5300] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x3fe5300] user data:"x264 - core 148 r2762 90a61ec - H.264/MPEG-4
AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html -
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=2000
ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x3fe5300] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x3fe5300] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x3fe5300] user data:"x264 - core 148 r2762 90a61ec - H.264/MPEG-4
AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html -
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=2000
ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x3fe5300] Reinit context to 1920x800, pix_fmt: yuv420p
[h264 @ 0x3fe5300] no picture
[matroska,webm @ 0x3fddec0] All info found
[matroska,webm @ 0x3fddec0] After avformat_find_stream_info() pos: 89449
bytes read:91521 seeks:0 frames:4
Input #0, matroska,webm, from
'http://bubblesoftapps.com/bubbleupnpserver/transcode_test/tos_sample_h264.mkv':
Metadata:
COMPATIBLE_BRANDS: mp42isomavc1
MAJOR_BRAND : mp42
MINOR_VERSION : 0
ENCODER : Lavf57.72.101
Duration: 00:00:02.00, start: 0.000000, bitrate: 1359 kb/s
Stream #0:0, 4, 1/1000: Video: h264 (High), 1 reference frame,
yuv420p(progressive, left), 1920x800 [SAR 1:1 DAR 12:5], 0/1, 24 fps, 24
tbr, 1k tbn, 48 tbc (default)
Metadata:
ENCODER : Lavc57.93.100 libx264
DURATION : 00:00:02.000000000
Successfully opened the file.
Parsing a group of options: output url /dev/null.
Applying option map (set input stream mapping) with argument 0.
Applying option c:0 (codec name) with argument h264_nvenc.
Applying option f (force format) with argument null.
Successfully parsed a group of options.
Opening an output file: /dev/null.
Successfully opened the file.
detected 8 logical cores
[h264 @ 0x3fe9840] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x3fe9840] nal_unit_type: 8, nal_ref_idc: 3
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
Last message repeated 1 times
[h264 @ 0x3fe9840] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x3fe9840] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x3fe9840] user data:"x264 - core 148 r2762 90a61ec - H.264/MPEG-4
AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html -
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=2000
ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x3fe9840] Reinit context to 1920x800, pix_fmt: yuv420p
[h264 @ 0x3fe9840] no picture
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x3ffe2e0] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x3ffe2e0] no picture
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x4005a20] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x40933c0] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x40bfb80] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x40db720] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x40f72c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x4113160] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x412f000] nal_unit_type: 1, nal_ref_idc: 0
[h264 @ 0x3fe9840] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[h264 @ 0x3ffe2e0] nal_unit_type: 1, nal_ref_idc: 2
[graph 0 input from stream 0:0 @ 0x40b8520] Setting 'video_size' to value
'1920x800'
[graph 0 input from stream 0:0 @ 0x40b8520] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x40b8520] Setting 'time_base' to value
'1/1000'
[graph 0 input from stream 0:0 @ 0x40b8520] Setting 'pixel_aspect' to
value '1/1'
[graph 0 input from stream 0:0 @ 0x40b8520] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 0:0 @ 0x40b8520] Setting 'frame_rate' to value
'24/1'
[graph 0 input from stream 0:0 @ 0x40b8520] w:1920 h:800 pixfmt:yuv420p
tb:1/1000 fr:24/1 sar:1/1 sws_param:flags=2
[format @ 0x40b8ca0] compat: called with
args=[yuv420p|nv12|p010le|yuv444p|yuv444p16le|bgr0|rgb0|cuda]
[format @ 0x40b8ca0] Setting 'pix_fmts' to value
'yuv420p|nv12|p010le|yuv444p|yuv444p16le|bgr0|rgb0|cuda'
[AVFilterGraph @ 0x46254c0] query_formats: 4 queried, 3 merged, 0 already
done, 0 delayed
Segmentation fault (core dumped)
}}}
strace (see attached file) shows that the crash happens shortly after
/usr/lib/x86_64-linux-gnu/libcuda.so.1 and /usr/lib/x86_64-linux-gnu
/libnvidia-fatbinaryloader.so.378.13 are dynamically loaded.
Using -hwaccel cuvid and/or *_cuvid encoders also crash identically.
This issue is not GPU specific as I know someone else got it with a
different NVIDIA GPU than me.
This crash is also mentioned in one of the last comment of this gist page,
using a custom build of ffmpeg:
https://gist.github.com/Brainiarc7/988473b79fd5c8f0db54b92ebb47387a
Could this issue be related to issue #6405 ?
Could this issue be specific to static ffmpeg builds ?
In any case, this issue makes using NVIDIA acceleration impossible
currently on Linux.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/6431>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list