FFMPEG + NVENC: Segmentation Fault if some option is active

OS: Linux x86_64 (Gentoo)
Videocard: NVIDIA GT 650M (PRIME)
Driver: 352.21
NVENC SDK: 5.0.1
FFMPEG: 2.7.2

Part 1:

I have been captured video from screen:

ffmpeg -f x11grab -r 30 -s 1600x900 -i :0.0 -re -f alsa -i pulse -ac 2 -ar 44100 -acodec libfaac -vcodec nvenc -preset hq -tune film -threads 0 output.mkv


Part 2:

I have been applied a watermark on my video:

ffmpeg -i output.mkv -acodec copy -vcodec nvenc -preset hq -tune film -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=0:main_h-overlay_h-0 [out]" output-watermark.mkv


Part 3:

I tried to crop video from 1600x900 to 1280x720. This is a gameplay video, and the game is in window. I open a video in fullscreen, then I’ve took a screnshot. Then I found an offset: this is 316,50. Then I found a manual:

That’s my command:

ffmpeg -i output.mkv -acodec copy -vcodec nvenc -preset hq -tune film -filter:v "crop=1280:720:316:50" output-cropped.mkv


ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.6.4 (Gentoo 4.6.4 p1.0, pie-0.5.2)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=core-avx-i -Os -pipe' --extra-cflags='-march=core-avx-i -Os -pipe' --extra-cxxflags='-march=core-avx-i -Os -pipe' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-version3 --enable-nonfree --disable-indev=oss --disable-indev=jack --disable-outdev=oss --disable-outdev=sdl --enable-version3 --enable-bzlib --enable-runtime-cpudetect --disable-debug --disable-doc --enable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --enable-ffplay --disable-vaapi --enable-vdpau --enable-zlib --enable-libvo-aacenc --disable-libvo-amrwbenc --enable-libmp3lame --enable-libaacplus --enable-libfaac --enable-libtheora --enable-libtwolame --disable-libwavpack --enable-libx264 --enable-libxvid --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --enable-libv4l2 --enable-libpulse --enable-x11grab --disable-libflite --disable-frei0r --enable-fontconfig --disable-ladspa --enable-libass --enable-libfreetype --disable-libsoxr --enable-pthreads --enable-libopencore-amrwb --enable-libopencore-amrnb --disable-libfdk-aac --disable-libopenjpeg --enable-libbluray --disable-libcelt --enable-libgme --enable-libgsm --enable-libmodplug --enable-libopus --disable-libquvi --enable-librtmp --enable-libssh --enable-libschroedinger --enable-libspeex --enable-libvorbis --enable-libvpx --disable-libzvbi --disable-amd3dnow --disable-amd3dnowext --disable-altivec --disable-avx2 --disable-neon --cpu=core-avx-i --enable-nvenc
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'output.mkv':
    ENCODER         : Lavf56.36.100
  Duration: 00:24:33.54, start: 0.000000, bitrate: 7918 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv), 1600x900 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
[matroska @ 0x22e6120] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, matroska, to 'output-cropped.mkv':
    encoder         : Lavf56.36.100
    Stream #0:0: Video: h264 (nvenc) (H264 / 0x34363248), nv12, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 1k tbn, 30 tbc (default)
      encoder         : Lavc56.41.100 nvenc
    Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, stereo (default)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (nvenc))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Segmentation fault

Part 4:

I tried to switch:

-vcodec nvenc -preset hq -tune film


-vcodec libx264 -preset ultrafast

It works. I think that is the bug in NVENC!

hi Zenitur
nvencoder does not provide a good quality like a traditional ffmpeg and x264 .

Segmentation fault in which library ? Could you please share backtrace ? did you test with latest nvidia drivers?