FFmpeg h264_nvenc interlaced encode


I trying transcode h264 interlaced video file with h264_nvenc codec and want keep interlacing.
I using ffmpeg 3.2 and NVENC 7:

ffmpeg version 3.2 Copyright © 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --cpu=native --enable-pthreads --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-libfdk-aac --enable-nonfree --enable-gpl --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-nvenc

ffmpeg -i source.mpg -vcodec h264_nvenc -flags +ildct+ilme -acodec copy -f mpegts out.mpg

And receidev the following video:

But I have no problems with libx264 codec.

Is ffmpeg supported interlaced encoding via nvenc? Or my ffmpeg command is incorrect?


This same in device Quadro M4000.

So, this possible set interlace TFF in ffmpeg + nvenc encoder ?

It’s an issue with new video drivers. Everything is fine with video driver 361.28 and lower.
I already sent this issue to NVIDIA Support with Reference Number 161118-000164

I tested Cuda 8.0, version nvidia from 367.42 to 375.20, ffmpeg 3.2 and ffmpeg git version in today. (–enable-cuda --enable-cuvid --enable-rpath --enable-nvenc)

run ffmpeg with options “-flags:v +ildct -top 1”

My picture is bad, showing this same what in post #1.

My Video M4000 , OS Ubuntu 14.04.05

Support Nvidia, please help find solution.

This issue is root-caused and fix will be available in our next driver branch (due out in February 2017). Thank you for reporting the issue.

This issue has been fixed in the new 375.39 driver. Thanks!

Hi, are there plans to fix the issue in the legacy 367.xx series? We’re using AWS G2 instances with GRID K520 GPU and if I try to install 375.39 or 375.13 the installer fails with:
The NVIDIA GRID K520 GPU installed in this system is supported through the NVIDIA 367.xx legacy Linux graphics drivers. Please visit http://www.nvidia.com/object/unix.html for more information. The 378.13 NVIDIA Linux graphics driver will ignore this GPU.
The latest available 367.57 still shows the issue.


Hi, is there any plan to release R375+ driver or to fix the R367 driver for NVIDIA GUID K520 GPU? We are using AWS G2 instance and experiencing exactly same issue at the moment.

i have the same problem in my Quadro GP100 and driver 430.40

Hi sva083,
Can you confirm this is a regression and which ffmpeg command line you are using?


if i add option -flags:v +ildct for output then all interlaced frames are discarded
and video doesn’t play

/usr/local/bin/ffmpeg -buffer_size 131072 -fifo_size 120000 -overrun_nonfatal 1 -i udp:// -y -sn -dn -vcodec h264_nvenc -flags:v +ildct -acodec aac -hls_time 10 -map 0 -ignore_unknown -strict -2 -use_localtime 1 -use_localtime 1 -use_localtime_mkdir 1 -preset:v fast -profile:v main -rc:v cbr -b:v 3M -maxrate:v 4M -bufsize:v 16M -hls_segment_filename /store/records/TVK/%Y/%m/%d/%H/%s.ts /hls/tmp/TVK.m3u8

what news? if i use libx264 all intarlaced frames are output…

We are not able to reproduce this issue on GP100 + Ubuntu 18.04 + 430.40 + FFMPEG 4.1.4

Can you try with minimal ffmpeg command line options and see if this is still an issue, e.g.
./ffmpeg -i ~/decode_clips/h264/big_buck_bunny_1920x1080_420_8_14400.h264 -vcodec h264_nvenc -flags +ildct -acodec copy -f mpegts out.mpg

Are you sure this file contains interlaced frames?

show me output for this command:

ffprobe -show_frames ./big_buck_bunny_1920x1080_420_8_14400.h264 | grep inter | wc -l

and for out.mpg

ffprobe -show_frames ./out.mpg | grep inter | wc -l

For the command line mentioned in comment #13, input used is progressive h264 and encoded output is interlaced. ffprobe shows interlaced_frame=1 for each frame of the output.


ok, but problem appears if input file contains interlaced frames!
i don’t know cases than is needed convert prograssive to interlaced, its needed conver interlaced to interlaced!! And this dont work!!