intel / intel-vaapi-driver

VA-API user mode driver for Intel GEN Graphics family
https://01.org/linuxmedia
Other
308 stars 126 forks source link

sigserv/segfaultt observed on /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so when the VAAPI encoder for VP8 is called up on Skylake #183

Closed Brainiarc7 closed 7 years ago

Brainiarc7 commented 7 years ago

Attempting to encode VP8 via the vp8_vaapi encoder on FFmpeg (and liabv) fails on Intel Skylake with a sigserv/segfault:

First, I built and configured FFmpeg with debugging enabled so as to run a gdb trace and find out what triggers the sigserv:

FFmpeg build configuration:

This generates a local FFmpeg build for use with VAAPI only.

Includes extra components as needed:

Build and deploy Yasm: Yasm is an assembler for x86 optimizations used by x264 and FFmpeg. Highly recommended or your resulting build may be very slow.

cd ~/ffmpeg_sources
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="/apps/ffmpeg/dyn" --bindir="/apps/ffmpeg/dyn/bin"
make -j$(nproc) VERBOSE=1
make -j$(nproc) install
make -j$(nproc) distclean

Build and deploy libx264 statically: This library provides a H.264 video encoder. See the H.264 Encoding Guide for more information and usage examples. This requires ffmpeg to be configured with --enable-gpl --enable-libx264.

cd ~/ffmpeg_sources
wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjvf last_x264.tar.bz2
cd x264-snapshot*
PATH="/apps/ffmpeg/dyn/bin:$PATH" ./configure --prefix="/apps/ffmpeg/dyn" --bindir="/apps/ffmpeg/dyn/bin" --enable-static --disable-opencl
PATH="/apps/ffmpeg/dyn/bin:$PATH" make -j$(nproc) VERBOSE=1
make -j$(nproc) install VERBOSE=1
make -j$(nproc) distclean

Build and configure libx265: This library provides a H.265/HEVC video encoder. See the H.265 Encoding Guide for more information and usage examples.

sudo apt-get install cmake mercurial
cd ~/ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
cd ~/ffmpeg_sources/x265/build/linux
PATH="$/apps/ffmpeg/dyn/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/apps/ffmpeg/dyn" -DENABLE_SHARED:bool=off ../../source
make -j$(nproc) VERBOSE=1
make -j$(nproc) install VERBOSE=1
make -j$(nproc) clean VERBOSE=1

Build and deploy the libfdk-aac library: This provides an AAC audio encoder. See the AAC Audio Encoding Guide for more information and usage examples. This requires ffmpeg to be configured with --enable-libfdk-aac (and --enable-nonfree if you also included --enable-gpl).

cd ~/ffmpeg_sources
wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master
tar xzvf fdk-aac.tar.gz
cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure --prefix="/apps/ffmpeg/dyn" --disable-shared
make -j$(nproc)
make -j$(nproc) install
make -j$(nproc) distclean

Build and configure libvpx:

 cd ~/ffmpeg_sources
   git clone https://github.com/webmproject/libvpx/
   cd libvpx
   ./configure --prefix="/apps/ffmpeg/dyn" --enable-runtime-cpu-detect --enable-vp9 --enable-vp8 \
   --enable-postproc --enable-vp9-postproc --enable-multi-res-encoding --enable-webm-io --enable-vp9-highbitdepth --enable-onthefly-bitpacking --enable-realtime-only \
   --cpu=native --as=yasm
   time make -j$(nproc)
   time make -j$(nproc) install
   time make clean -j$(nproc)
   time make distclean

Build LibVorbis:

 cd ~/ffmpeg_sources
   wget -c -v http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz
   tar -xvf libvorbis-1.3.5.tar.xz
   cd libvorbis-1.3.5
   ./configure --enable-static --prefix="/apps/ffmpeg/dyn"
   time make -j$(nproc)
   time make -j$(nproc) install
   time make clean -j$(nproc)
   time make distclean

Build FFmpeg:

cd ~/ffmpeg_sources
git clone https://github.com/FFmpeg/FFmpeg -b master
cd FFmpeg
PATH="/apps/ffmpeg/dyn/bin:$PATH" PKG_CONFIG_PATH="/apps/ffmpeg/dyn/lib/pkgconfig" ./configure \
  --pkg-config-flags="--static" \
  --prefix="/apps/ffmpeg/dyn" \
  --extra-cflags="-I/apps/ffmpeg/dyn/include" \
  --extra-ldflags="-L/apps/ffmpeg/dyn/lib" \
  --bindir="/apps/ffmpeg/dyn/bin" \
  --enable-debug=3 \
  --enable-vaapi \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-gpl \
  --cpu=native \
  --enable-opengl \
  --enable-libfdk-aac \
  --enable-libx264 \
  --enable-libx265 \
  --enable-nonfree 
PATH="/apps/ffmpeg/dyn/bin:$PATH" make -j$(nproc) 
make -j$(nproc) install 

Note: I skipped the distclean section so as to retain the ffmpeg_g binary.

Now, to debug the segfault encountered with the vp8_vaapi encoder on FFmpeg, I ran ffmpeg_g under a local gdb session, passing the necessary arguments as shown below:

FFmpeg debug output with gdb:

lin@phantom:~/Desktop/encodes/src$ gdb ~/ffmpeg_sources/FFmpeg/ffmpeg_g GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/lin/ffmpeg_sources/FFmpeg/ffmpeg_g...done.
(gdb) run -loglevel debug -threads 4 -vaapi_device /dev/dri/renderD129 -i "Demon.Hunter.One.Step.Behind.mkv" -c:a aac \
-filter:v 'format=nv12,hwupload,scale_vaapi=w=1920:h=1080' \
-c:v vp8_vaapi -loop_filter_level:v 32 -b:v 2500k \
-f matroska -y "Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv"
Starting program: /home/lin/ffmpeg_sources/FFmpeg/ffmpeg_g -loglevel debug -threads 4 -vaapi_device /dev/dri/renderD129 -i "Demon.Hunter.One.Step.Behind.mkv" -c:a aac -filter:v 'format=nv12,hwupload,scale_vaapi=w=1920:h=1080' -c:v vp8_vaapi -loop_filter_level:v 32 -b:v 2500k -f matroska -y "Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ffmpeg version N-86329-ga47273c Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --pkg-config-flags=--static --prefix=/apps/ffmpeg/dyn --extra-cflags=-I/apps/ffmpeg/dyn/include --extra-ldflags=-L/apps/ffmpeg/dyn/lib --bindir=/apps/ffmpeg/dyn/bin --enable-debug=3 --enable-vaapi --enable-libvorbis --enable-libvpx --enable-gpl --cpu=native --enable-opengl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.101 / 57. 96.101
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 90.100 /  6. 90.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-threads' ... matched as AVOption 'threads' with argument '4'.
Reading option '-vaapi_device' ... matched as option 'vaapi_device' (set VAAPI hardware device (DRM path or X11 display name)) with argument '/dev/dri/renderD129'.
Reading option '-i' ... matched as input url with argument 'Demon.Hunter.One.Step.Behind.mkv'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-filter:v' ... matched as option 'filter' (set stream filtergraph) with argument 'format=nv12,hwupload,scale_vaapi=w=1920:h=1080'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'vp8_vaapi'.
Reading option '-loop_filter_level:v' ... matched as AVOption 'loop_filter_level:v' with argument '32'.
Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '2500k'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'matroska'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option vaapi_device (set VAAPI hardware device (DRM path or X11 display name)) with argument /dev/dri/renderD129.
[AVHWDeviceContext @ 0x29e34c0] Opened VA display via DRM device /dev/dri/renderD129.
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x29e34c0] Initialised VAAPI connection: version 0.39
[AVHWDeviceContext @ 0x29e34c0] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x29e34c0] Format 0x30323449 -> unknown.
[AVHWDeviceContext @ 0x29e34c0] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x29e34c0] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x29e34c0] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x29e34c0] Format 0x48323234 -> yuv422p.
[AVHWDeviceContext @ 0x29e34c0] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x29e34c0] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x29e34c0] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x29e34c0] Matched "Intel i965 driver for Intel(R) Skylake - 1.7.0" as known driver "Intel i965 (Quick Sync)".
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url Demon.Hunter.One.Step.Behind.mkv.
Successfully parsed a group of options.
Opening an input file: Demon.Hunter.One.Step.Behind.mkv.
[file @ 0x29ed4a0] Setting default whitelist 'file,crypto'
[matroska,webm @ 0x29ecdc0] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 0x29ecdc0] Before avformat_find_stream_info() pos: 971 bytes read:32768 seeks:0 nb_streams:2
[hevc @ 0x29eff40] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x29eff40] Decoding VPS
[hevc @ 0x29eff40] Main profile bitstream
[hevc @ 0x29eff40] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x29eff40] Decoding SPS
[hevc @ 0x29eff40] Main profile bitstream
[hevc @ 0x29eff40] Decoding VUI
[hevc @ 0x29eff40] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x29eff40] Decoding PPS
[matroska,webm @ 0x29ecdc0] All info found
[matroska,webm @ 0x29ecdc0] After avformat_find_stream_info() pos: 7136 bytes read:32768 seeks:0 frames:3
Input #0, matroska,webm, from 'Demon.Hunter.One.Step.Behind.mkv':
  Metadata:
    ENCODER         : Lavf57.72.101
  Duration: 00:05:09.70, start: -0.007000, bitrate: 5106 kb/s
    Stream #0:0(eng), 2, 1/1000: Video: hevc (Main), 1 reference frame, yuv420p(tv, progressive), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 0/1, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      ENCODER         : Lavc57.96.101 hevc_vaapi
      DURATION        : 00:05:09.685000000
    Stream #0:1(eng), 1, 1/1000: Audio: opus, 48000 Hz, stereo, fltp, delay 312 (default)
    Metadata:
      DURATION        : 00:05:09.701000000
Successfully opened the file.
Parsing a group of options: output url Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv.
Applying option c:a (codec name) with argument aac.
Applying option filter:v (set stream filtergraph) with argument format=nv12,hwupload,scale_vaapi=w=1920:h=1080.
Applying option c:v (codec name) with argument vp8_vaapi.
Applying option b:v (video bitrate (please use -b:v)) with argument 2500k.
Applying option f (force format) with argument matroska.
Successfully parsed a group of options.
Opening an output file: Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv.
[file @ 0x2a00d80] Setting default whitelist 'file,crypto'
Successfully opened the file.
[hevc @ 0x2a0e260] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0e260] Decoding VPS
[hevc @ 0x2a0e260] Main profile bitstream
[hevc @ 0x2a0e260] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0e260] Decoding SPS
[hevc @ 0x2a0e260] Main profile bitstream
[hevc @ 0x2a0e260] Decoding VUI
[hevc @ 0x2a0e260] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0e260] Decoding PPS
[New Thread 0x7fffeda24700 (LWP 9783)]
[New Thread 0x7fffed223700 (LWP 9784)]
[New Thread 0x7fffeca22700 (LWP 9785)]
[New Thread 0x7fffec221700 (LWP 9786)]
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> vp8 (vp8_vaapi))
  Stream #0:1 -> #0:1 (opus (native) -> aac (native))
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
[hevc @ 0x2a0e260] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0e260] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0e260] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0e260] nal_unit_type: 19(IDR_W_RADL), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0e260] Decoding VPS
[hevc @ 0x2a0e260] Main profile bitstream
[hevc @ 0x2a0e260] Decoding SPS
[hevc @ 0x2a0e260] Main profile bitstream
[hevc @ 0x2a0e260] Decoding VUI
[hevc @ 0x2a0e260] Decoding PPS
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[hevc @ 0x2a1b460] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
detected 8 logical cores
[New Thread 0x7fffeb341700 (LWP 9787)]
[New Thread 0x7fffea941700 (LWP 9788)]
[New Thread 0x7fffea140700 (LWP 9789)]
[hevc @ 0x2a1b460] Output frame with POC 0.
[New Thread 0x7fffe993f700 (LWP 9790)]
[New Thread 0x7fffe8db8700 (LWP 9791)]
[New Thread 0x7fffe3fff700 (LWP 9792)]
[New Thread 0x7fffe37fe700 (LWP 9793)]
[New Thread 0x7fffe2ffd700 (LWP 9794)]
[New Thread 0x7fffe27fc700 (LWP 9795)]
[graph_1_in_0_1 @ 0x2b132a0] Setting 'time_base' to value '1/48000'
[graph_1_in_0_1 @ 0x2b132a0] Setting 'sample_rate' to value '48000'
[graph_1_in_0_1 @ 0x2b132a0] Setting 'sample_fmt' to value 'fltp'
[graph_1_in_0_1 @ 0x2b132a0] Setting 'channel_layout' to value '0x3'
[graph_1_in_0_1 @ 0x2b132a0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[format_out_0_1 @ 0x2b134c0] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x2b134c0] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 0x2a269e0] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 3 times
[hevc @ 0x2a38f40] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[hevc @ 0x2a38f40] Output frame with POC 1.
[hevc @ 0x2a49aa0] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a49aa0] Output frame with POC 2.
[hevc @ 0x2a0e260] Decoded frame with POC 0.
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 2 times
[hevc @ 0x2a0e260] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a38f40] Decoded frame with POC 1.
[hevc @ 0x2a1b460] Decoded frame with POC 3.
[New Thread 0x7fffe1726700 (LWP 9796)]
[New Thread 0x7fffe0f25700 (LWP 9797)]
[New Thread 0x7fffd7fff700 (LWP 9798)]
[New Thread 0x7fffd77fe700 (LWP 9799)]
[New Thread 0x7fffd6ffd700 (LWP 9800)]
[New Thread 0x7fffd67fc700 (LWP 9801)]
[New Thread 0x7fffd5ffb700 (LWP 9802)]
[New Thread 0x7fffd57fa700 (LWP 9803)]
[New Thread 0x7fffd4ff9700 (LWP 9804)]
[Parsed_format_0 @ 0x2a57920] compat: called with args=[nv12]
[Parsed_format_0 @ 0x2a57920] Setting 'pix_fmts' to value 'nv12'
[Parsed_scale_vaapi_2 @ 0x2cac120] Setting 'w' to value '1920'
[Parsed_scale_vaapi_2 @ 0x2cac120] Setting 'h' to value '1080'
[graph 0 input from stream 0:0 @ 0x2cacc80] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x2cacc80] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x2cacc80] Setting 'time_base' to value '1/1000'
[graph 0 input from stream 0:0 @ 0x2cacc80] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x2cacc80] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x2cacc80] Setting 'frame_rate' to value '24000/1001'
[graph 0 input from stream 0:0 @ 0x2cacc80] w:1920 h:1080 pixfmt:yuv420p tb:1/1000 fr:24000/1001 sar:1/1 sws_param:flags=2
[format @ 0x2cabfe0] compat: called with args=[vaapi_vld]
[format @ 0x2cabfe0] Setting 'pix_fmts' to value 'vaapi_vld'
[auto_scaler_0 @ 0x2cad2c0] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0x2cad2c0] w:iw h:ih flags:'bicubic' interl:0
[Parsed_format_0 @ 0x2a57920] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_format_0'
[AVFilterGraph @ 0x2ca1940] query_formats: 6 queried, 4 merged, 1 already done, 0 delayed
[auto_scaler_0 @ 0x2cad2c0] w:1920 h:1080 fmt:yuv420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x4
[hwupload @ 0x2a57fe0] Surface format is nv12.
[AVHWFramesContext @ 0x2b2e1a0] Created surface 0x4000000.
[AVHWFramesContext @ 0x2b2e1a0] Direct mapping possible.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x4000001.
[AVHWFramesContext @ 0x2cd3fc0] Direct mapping possible.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x4000002.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x4000003.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x4000004.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x4000005.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x4000006.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x4000007.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x4000008.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x4000009.
[AVHWFramesContext @ 0x2cd3fc0] Created surface 0x400000a.
[hevc @ 0x2a0e260] Output frame with POC 3.
[AVHWFramesContext @ 0x2b2e1a0] Map surface 0x4000000.
[AVHWFramesContext @ 0x2b2e1a0] Unmap surface 0x4000000.
[scale_vaapi @ 0x2cac220] Filter input: vaapi_vld, 1920x1080 (7).
[scale_vaapi @ 0x2cac220] Using surface 0x4000000 for scale input.
[scale_vaapi @ 0x2cac220] Using surface 0x400000a for scale output.
[scale_vaapi @ 0x2cac220] Pipeline parameter buffer is 0x8000000.
[scale_vaapi @ 0x2cac220] Filter output: vaapi_vld, 1920x1080 (7).
[vp8_vaapi @ 0x2a0c840] VBR rate control is not supported with this driver version; using CBR instead.
[vp8_vaapi @ 0x2a0c840] Using nv12 as format of reconstructed frames.
[AVHWFramesContext @ 0x2cc5020] Created surface 0x400000b.
[AVHWFramesContext @ 0x2cc5020] Direct mapping possible.
[AVHWFramesContext @ 0x2cc5020] Created surface 0x400000c.
[AVHWFramesContext @ 0x2cc5020] Created surface 0x400000d.
Output #0, matroska, to 'Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv':
  Metadata:
    encoder         : Lavf57.72.101
    Stream #0:0(eng), 0, 1/1000: Video: vp8 (vp8_vaapi), 1 reference frame (VP80 / 0x30385056), vaapi_vld, 1920x1080 [SAR 1:1 DAR 16:9], 0/1, q=2-31, 2500 kb/s, 23.98 fps, 1k tbn, 23.98 tbc (default)
    Metadata:
      DURATION        : 00:05:09.685000000
      encoder         : Lavc57.96.101 vp8_vaapi
    Stream #0:1(eng), 0, 1/1000: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
    Metadata:
      DURATION        : 00:05:09.701000000
      encoder         : Lavc57.96.101 aac
[vp8_vaapi @ 0x2a0c840] Encode frame: 1920x1080 (0).
[vp8_vaapi @ 0x2a0c840] Pictures: IDR (0/0)
[vp8_vaapi @ 0x2a0c840] Issuing encode for pic 0/0 as type IDR.
[vp8_vaapi @ 0x2a0c840] No reference pictures.
[vp8_vaapi @ 0x2a0c840] Input surface is 0x400000a.
[vp8_vaapi @ 0x2a0c840] Recon surface is 0x400000d.
[vp8_vaapi @ 0x2a0c840] Allocated output buffer 0x8000000
[vp8_vaapi @ 0x2a0c840] Output buffer is 0x8000000.
[vp8_vaapi @ 0x2a0c840] Param buffer (27) is 0x8000001.
[vp8_vaapi @ 0x2a0c840] Param buffer (27) is 0x8000002.
[vp8_vaapi @ 0x2a0c840] Param buffer (22) is 0x8000003.
[vp8_vaapi @ 0x2a0c840] Param buffer (23) is 0x8000004.
[vp8_vaapi @ 0x2a0c840] Param buffer (11) is 0x8000005.
[hevc @ 0x2a49aa0] Decoded frame with POC 2.

Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault.
0x00007fffedf009ad in ?? ()
   from /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
(gdb) 

So it seems that the crash originates from /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so, which is registered as the VAAPI driver under vainfo, as shown below:

For your reference:

Platform information:

  1. Vainfo's output:

    libva info: VA-API version 0.39.2
    libva info: va_getDriverName() returns 0
    libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
    libva info: Found init function __vaDriverInit_0_39
    libva info: va_openDriver() returns 0
    vainfo: VA-API version: 0.39 (libva 1.7.1)
    vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 1.7.0
    vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
  2. lspci's output:

    00:00.0 Host bridge: Intel Corporation Sky Lake Host Bridge/DRAM Registers (rev 07)
    00:01.0 PCI bridge: Intel Corporation Sky Lake PCIe Controller (x16) (rev 07)
    00:02.0 VGA compatible controller: Intel Corporation Skylake Integrated Graphics (rev 06)
    00:08.0 System peripheral: Intel Corporation Sky Lake Gaussian Mixture Model
    00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
    00:14.2 Signal processing controller: Intel Corporation Sunrise Point-H Thermal subsystem (rev 31)
    00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
    00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA Controller [AHCI mode] (rev 31)
    00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #1 (rev f1)
    00:1c.4 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #5 (rev f1)
    00:1d.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #9 (rev f1)
    00:1d.5 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #14 (rev f1)
    00:1d.6 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #15 (rev f1)
    00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31)
    00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31)
    00:1f.3 Audio device: Intel Corporation Sunrise Point-H HD Audio (rev 31)
    00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31)
    01:00.0 VGA compatible controller: NVIDIA Corporation Device 1c20 (rev ff)
    03:00.0 PCI bridge: Intel Corporation Device 1576
    04:00.0 PCI bridge: Intel Corporation Device 1576
    04:01.0 PCI bridge: Intel Corporation Device 1576
    04:02.0 PCI bridge: Intel Corporation Device 1576
    05:00.0 System peripheral: Intel Corporation Device 1575
    07:00.0 USB controller: Intel Corporation Device 15b5
    3c:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd Device a804
    3d:00.0 Ethernet controller: Qualcomm Atheros Killer E2400 Gigabit Ethernet Controller (rev 10)
    3e:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)
  3. OS information:

    uname -r
    
    4.10.12
    
    lsb_release -a
    
    $ lsb_release -a
    LSB Version:    core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:printing-9.20160110ubuntu0.2-amd64:printing-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
    Distributor ID: Ubuntu
    Description:    Ubuntu 16.04.2 LTS
    Release:    16.04
    Codename:   xenial

So far, it seems that this crash originates from the i915 driver's interactions with VAAPI, and I was also able to reproduce the exact crash with libav. Please help.

QuPengfei commented 7 years ago

Do you reproduce it without "scale_vaapi=w=1920:h=1080"?

Brainiarc7 commented 7 years ago

Hello @QuPengfei ,

Yes, I was able to reproduce the exact crash without using the vaapi scale filter, as shown below:

lin@phantom:~/Desktop/encodes/src$ gdb ~/ffmpeg_sources/FFmpeg/ffmpeg_g 
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/lin/ffmpeg_sources/FFmpeg/ffmpeg_g...done.
(gdb) run -loglevel debug -threads 4 -vaapi_device /dev/dri/renderD129 -i "Demon.Hunter.One.Step.Behind.mkv" -c:a aac \
-filter:v 'format=nv12,hwupload' \
-c:v vp8_vaapi -loop_filter_level:v 32 -b:v 2500k \
-f matroska -y "Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv"
Starting program: /home/lin/ffmpeg_sources/FFmpeg/ffmpeg_g -loglevel debug -threads 4 -vaapi_device /dev/dri/renderD129 -i "Demon.Hunter.One.Step.Behind.mkv" -c:a aac -filter:v 'format=nv12,hwupload' -c:v vp8_vaapi -loop_filter_level:v 32 -b:v 2500k -f matroska -y "Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ffmpeg version N-86329-ga47273c Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --pkg-config-flags=--static --prefix=/apps/ffmpeg/dyn --extra-cflags=-I/apps/ffmpeg/dyn/include --extra-ldflags=-L/apps/ffmpeg/dyn/lib --bindir=/apps/ffmpeg/dyn/bin --enable-debug=3 --enable-vaapi --enable-libvorbis --enable-libvpx --enable-gpl --cpu=native --enable-opengl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.101 / 57. 96.101
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 90.100 /  6. 90.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-threads' ... matched as AVOption 'threads' with argument '4'.
Reading option '-vaapi_device' ... matched as option 'vaapi_device' (set VAAPI hardware device (DRM path or X11 display name)) with argument '/dev/dri/renderD129'.
Reading option '-i' ... matched as input url with argument 'Demon.Hunter.One.Step.Behind.mkv'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-filter:v' ... matched as option 'filter' (set stream filtergraph) with argument 'format=nv12,hwupload'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'vp8_vaapi'.
Reading option '-loop_filter_level:v' ... matched as AVOption 'loop_filter_level:v' with argument '32'.
Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '2500k'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'matroska'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option vaapi_device (set VAAPI hardware device (DRM path or X11 display name)) with argument /dev/dri/renderD129.
[AVHWDeviceContext @ 0x29e34c0] Opened VA display via DRM device /dev/dri/renderD129.
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x29e34c0] Initialised VAAPI connection: version 0.39
[AVHWDeviceContext @ 0x29e34c0] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x29e34c0] Format 0x30323449 -> unknown.
[AVHWDeviceContext @ 0x29e34c0] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x29e34c0] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x29e34c0] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x29e34c0] Format 0x48323234 -> yuv422p.
[AVHWDeviceContext @ 0x29e34c0] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x29e34c0] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x29e34c0] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x29e34c0] Matched "Intel i965 driver for Intel(R) Skylake - 1.7.0" as known driver "Intel i965 (Quick Sync)".
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url Demon.Hunter.One.Step.Behind.mkv.
Successfully parsed a group of options.
Opening an input file: Demon.Hunter.One.Step.Behind.mkv.
[file @ 0x29ed4a0] Setting default whitelist 'file,crypto'
[matroska,webm @ 0x29ecdc0] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 0x29ecdc0] Before avformat_find_stream_info() pos: 971 bytes read:32768 seeks:0 nb_streams:2
[hevc @ 0x29eff40] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x29eff40] Decoding VPS
[hevc @ 0x29eff40] Main profile bitstream
[hevc @ 0x29eff40] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x29eff40] Decoding SPS
[hevc @ 0x29eff40] Main profile bitstream
[hevc @ 0x29eff40] Decoding VUI
[hevc @ 0x29eff40] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x29eff40] Decoding PPS
[matroska,webm @ 0x29ecdc0] All info found
[matroska,webm @ 0x29ecdc0] After avformat_find_stream_info() pos: 7136 bytes read:32768 seeks:0 frames:3
Input #0, matroska,webm, from 'Demon.Hunter.One.Step.Behind.mkv':
  Metadata:
    ENCODER         : Lavf57.72.101
  Duration: 00:05:09.70, start: -0.007000, bitrate: 5106 kb/s
    Stream #0:0(eng), 2, 1/1000: Video: hevc (Main), 1 reference frame, yuv420p(tv, progressive), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 0/1, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      ENCODER         : Lavc57.96.101 hevc_vaapi
      DURATION        : 00:05:09.685000000
    Stream #0:1(eng), 1, 1/1000: Audio: opus, 48000 Hz, stereo, fltp, delay 312 (default)
    Metadata:
      DURATION        : 00:05:09.701000000
Successfully opened the file.
Parsing a group of options: output url Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv.
Applying option c:a (codec name) with argument aac.
Applying option filter:v (set stream filtergraph) with argument format=nv12,hwupload.
Applying option c:v (codec name) with argument vp8_vaapi.
Applying option b:v (video bitrate (please use -b:v)) with argument 2500k.
Applying option f (force format) with argument matroska.
Successfully parsed a group of options.
Opening an output file: Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv.
[file @ 0x2a00d80] Setting default whitelist 'file,crypto'
Successfully opened the file.
[hevc @ 0x2a0a1a0] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0a1a0] Decoding VPS
[hevc @ 0x2a0a1a0] Main profile bitstream
[hevc @ 0x2a0a1a0] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0a1a0] Decoding SPS
[hevc @ 0x2a0a1a0] Main profile bitstream
[hevc @ 0x2a0a1a0] Decoding VUI
[hevc @ 0x2a0a1a0] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0a1a0] Decoding PPS
[New Thread 0x7fffeda24700 (LWP 25021)]
[New Thread 0x7fffed223700 (LWP 25022)]
[New Thread 0x7fffeca22700 (LWP 25023)]
[New Thread 0x7fffec221700 (LWP 25024)]
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> vp8 (vp8_vaapi))
  Stream #0:1 -> #0:1 (opus (native) -> aac (native))
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
[hevc @ 0x2a0a1a0] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0a1a0] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0a1a0] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0a1a0] nal_unit_type: 19(IDR_W_RADL), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a0a1a0] Decoding VPS
[hevc @ 0x2a0a1a0] Main profile bitstream
[hevc @ 0x2a0a1a0] Decoding SPS
[hevc @ 0x2a0a1a0] Main profile bitstream
[hevc @ 0x2a0a1a0] Decoding VUI
[hevc @ 0x2a0a1a0] Decoding PPS
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[hevc @ 0x2a1dac0] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
detected 8 logical cores
[New Thread 0x7fffeb362700 (LWP 25025)]
[New Thread 0x7fffea6e3700 (LWP 25026)]
[New Thread 0x7fffe9ee2700 (LWP 25027)]
[New Thread 0x7fffe96e1700 (LWP 25028)]
[New Thread 0x7fffe8ee0700 (LWP 25029)]
[New Thread 0x7fffe3fff700 (LWP 25030)]
[New Thread 0x7fffe37fe700 (LWP 25031)]
[hevc @ 0x2a1dac0] Output frame with POC 0.
[New Thread 0x7fffe2ffd700 (LWP 25032)]
[New Thread 0x7fffe27fc700 (LWP 25033)]
[graph_1_in_0_1 @ 0x2b33360] Setting 'time_base' to value '1/48000'
[graph_1_in_0_1 @ 0x2b33360] Setting 'sample_rate' to value '48000'
[graph_1_in_0_1 @ 0x2b33360] Setting 'sample_fmt' to value 'fltp'
[graph_1_in_0_1 @ 0x2b33360] Setting 'channel_layout' to value '0x3'
[graph_1_in_0_1 @ 0x2b33360] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[format_out_0_1 @ 0x2b33580] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x2b33580] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 0x2a0a700] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 3 times
[hevc @ 0x2a39580] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[hevc @ 0x2a39580] Output frame with POC 1.
[hevc @ 0x2a4a040] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a4a040] Output frame with POC 2.
[hevc @ 0x2a0a1a0] Decoded frame with POC 0.
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 2 times
[hevc @ 0x2a1dac0] Decoded frame with POC 3.
[hevc @ 0x2a0a1a0] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x2a39580] Decoded frame with POC 1.
[New Thread 0x7fffe1925700 (LWP 25034)]
[New Thread 0x7fffe0f25700 (LWP 25035)]
[New Thread 0x7fffd7fff700 (LWP 25036)]
[New Thread 0x7fffd77fe700 (LWP 25037)]
[New Thread 0x7fffd6ffd700 (LWP 25038)]
[New Thread 0x7fffd67fc700 (LWP 25039)]
[New Thread 0x7fffd5ffb700 (LWP 25040)]
[New Thread 0x7fffd57fa700 (LWP 25041)]
[hevc @ 0x2a0a1a0] Output frame with POC 3.
[New Thread 0x7fffd4ff9700 (LWP 25042)]
[Parsed_format_0 @ 0x2a57440] compat: called with args=[nv12]
[Parsed_format_0 @ 0x2a57440] Setting 'pix_fmts' to value 'nv12'
[graph 0 input from stream 0:0 @ 0x2cabc60] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x2cabc60] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x2cabc60] Setting 'time_base' to value '1/1000'
[graph 0 input from stream 0:0 @ 0x2cabc60] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x2cabc60] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x2cabc60] Setting 'frame_rate' to value '24000/1001'
[graph 0 input from stream 0:0 @ 0x2cabc60] w:1920 h:1080 pixfmt:yuv420p tb:1/1000 fr:24000/1001 sar:1/1 sws_param:flags=2
[format @ 0x2a577a0] compat: called with args=[vaapi_vld]
[format @ 0x2a577a0] Setting 'pix_fmts' to value 'vaapi_vld'
[auto_scaler_0 @ 0x2befce0] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0x2befce0] w:iw h:ih flags:'bicubic' interl:0
[Parsed_format_0 @ 0x2a57440] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_format_0'
[AVFilterGraph @ 0x2befb20] query_formats: 5 queried, 3 merged, 1 already done, 0 delayed
[auto_scaler_0 @ 0x2befce0] w:1920 h:1080 fmt:yuv420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x4
[hwupload @ 0x2a57b80] Surface format is nv12.
[AVHWFramesContext @ 0x2befc00] Created surface 0x4000000.
[AVHWFramesContext @ 0x2befc00] Direct mapping possible.
[AVHWFramesContext @ 0x2befc00] Map surface 0x4000000.
[AVHWFramesContext @ 0x2befc00] Unmap surface 0x4000000.
[vp8_vaapi @ 0x2a0c840] VBR rate control is not supported with this driver version; using CBR instead.
[vp8_vaapi @ 0x2a0c840] Using nv12 as format of reconstructed frames.
[AVHWFramesContext @ 0x2cc0620] Created surface 0x4000001.
[AVHWFramesContext @ 0x2cc0620] Direct mapping possible.
[AVHWFramesContext @ 0x2cc0620] Created surface 0x4000002.
[AVHWFramesContext @ 0x2cc0620] Created surface 0x4000003.
Output #0, matroska, to 'Demon.Hunter.One.Step.Behind-VAAPIEXT.mkv':
  Metadata:
    encoder         : Lavf57.72.101
    Stream #0:0(eng), 0, 1/1000: Video: vp8 (vp8_vaapi), 1 reference frame (VP80 / 0x30385056), vaapi_vld, 1920x1080 [SAR 1:1 DAR 16:9], 0/1, q=2-31, 2500 kb/s, 23.98 fps, 1k tbn, 23.98 tbc (default)
    Metadata:
      DURATION        : 00:05:09.685000000
      encoder         : Lavc57.96.101 vp8_vaapi
    Stream #0:1(eng), 0, 1/1000: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
    Metadata:
      DURATION        : 00:05:09.701000000
      encoder         : Lavc57.96.101 aac
[vp8_vaapi @ 0x2a0c840] Encode frame: 1920x1080 (0).
[vp8_vaapi @ 0x2a0c840] Pictures: IDR (0/0)
[vp8_vaapi @ 0x2a0c840] Issuing encode for pic 0/0 as type IDR.
[vp8_vaapi @ 0x2a0c840] No reference pictures.
[vp8_vaapi @ 0x2a0c840] Input surface is 0x4000000.
[vp8_vaapi @ 0x2a0c840] Recon surface is 0x4000003.
[vp8_vaapi @ 0x2a0c840] Allocated output buffer 0x8000000
[vp8_vaapi @ 0x2a0c840] Output buffer is 0x8000000.
[vp8_vaapi @ 0x2a0c840] Param buffer (27) is 0x8000001.
[vp8_vaapi @ 0x2a0c840] Param buffer (27) is 0x8000002.
[vp8_vaapi @ 0x2a0c840] Param buffer (22) is 0x8000003.
[vp8_vaapi @ 0x2a0c840] Param buffer (23) is 0x8000004.
[vp8_vaapi @ 0x2a0c840] Param buffer (11) is 0x8000005.
[hevc @ 0x2a4a040] Decoded frame with POC 2.
[hevc @ 0x2a0a1a0] Decoded frame with POC 6.

Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault.
0x00007fffedf009ad in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
(gdb) 

Regards,

Brainiarc7

QuPengfei commented 7 years ago

would you try the latest VAAPI version?

the following command worked well in my side. it is different from your clip. and the VP8 actually work.

BTW, the latest VAAPI and driver has a big improvement on VP8. you can try it.

ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -i ~/workspace/stream/avc-improvement/otc_CBR_1920x1080_blue_sky_2M_ipb_01.h264 -an -vf 'format=nv12|vaapi,hwupload' :v 3000 -c:v vp8_vaapi output_vp8.ivf

Detail info: ffmpeg version N-85704-gcbfd44a Copyright (c) 2000-2017 the FFmpeg developers built with gcc 6.2.0 (Ubuntu 6.2.0-5ubuntu12) 20161005 configuration: libavutil 55. 61.100 / 55. 61.100 libavcodec 57. 93.100 / 57. 93.100 libavformat 57. 72.101 / 57. 72.101 libavdevice 57. 7.100 / 57. 7.100 libavfilter 6. 87.100 / 6. 87.100 libswscale 4. 7.101 / 4. 7.101 libswresample 2. 8.100 / 2. 8.100 libva info: VA-API version 0.40.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /opt/X11R7/lib/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_0_40 libva info: va_openDriver() returns 0 Input #0, h264, from '/home/bqu/workspace/stream/avc-improvement/otc_CBR_1920x1080_blue_sky_2M_ipb_01.h264': Duration: N/A, bitrate: N/A Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 25 fps, 25 tbr, 1200k tbn, 50 tbc Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> vp8 (vp8_vaapi)) Press [q] to stop, [?] for help Output #0, ivf, to 'output_vp8.ivf': Metadata: encoder : Lavf57.72.101 Stream #0:0: Video: vp8 (vp8_vaapi) (VP80 / 0x30385056), vaapi_vld, 1920x1080, q=2-31, 3 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc57.93.100 vp8_vaapi frame= 217 fps=132 q=-0.0 Lsize= 1003kB time=00:00:08.68 bitrate= 946.5kbits/s speed=5.28x video:1000kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.257334%

Brainiarc7 commented 7 years ago

Alright, let me try again with vaapi 0.40.0.

Brainiarc7 commented 7 years ago

I'll be testing against this PPA as it has the latest VAAPI builds for Ubuntu 16.04LTS at the moment.

QuPengfei commented 7 years ago

Also VAAPI driver version is 1.8.0+

here is vainfo libva info: VA-API version 0.40.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /opt/X11R7/lib/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_0_40 libva info: va_openDriver() returns 0 vainfo: VA-API version: 0.40 (libva ) vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 1.8.3.pre1 (glk-alpha-51-g5f479ac) vainfo: Supported profile and entrypoints

Brainiarc7 commented 7 years ago

Hello @QuPengfei,

It worked!

Upgrading to the latest libva and intel-vaapi-driver package fixed the problem.

I can now comfortably close this issue, and thanks for your time :-)