[RESOLVED] FFMPEG cuvid NVDEC frame drop when using option deint 2

Hi

ffmpeg is running ok with cuda 9.0rc until I want to deinterlace with cuvid instead yadif filter.

OS: Unbuntu 16.04.03
GPU: M4000
DRIVER: 384.69
CUDA: 9.0RC103
FFMPEG: latest from GIT

ffmpeg -c:v h264_cuvid -resize 1280x720 -deint 2 -i udp://@239.4.1.4:6670 -vcodec h264_nvenc -profile:v high -preset fast -pix_fmt yuv420p -vb 3000K -bf 2 -acodec libfdk_aac -ab 128000 -ar 48000

Main goal is to resize and deinterlace image from stream by NVDEC instead CPU.

NVDEC resize is ok and works perfect.
but When I add option deint 1 or 2, directly I have framedrop with message : Past duration 0.669716 too large

It seems deint option create blocking or too long action and the frame must be dropped.

Does someone can Help me ?

regards

Armand

Hi,
Deintelacer makes double framerate, 1080i25 → 1080p50
Try drop_second_field option.

ex.
ffmpeg -hwaccel cuvid -c:v h264_cuvid -deint 2 -drop_second_field 1 -surfaces 10 -resize 1024x576 -i xxxxx

Many thanks. It is working good :-)

Hi,

What is surfaces number?

Decoding with ffmpeg 3.2.4 is good, Decoding with ffmpeg 3.4 is bad. I have to add the -drop_second_field 1 and -surfaces 10 parameters.
Why -surfaces 10?

./ffmpeg -hwaccel_device 2 -hwaccel cuvid -c:v h264_cuvid -deint 2 -surfaces 8 -drop_second_field 1 -i udp://ip:port

regards

FFmpeg 3.4:
Decoder h264_cuvid [Nvidia CUVID H264 decoder]:
General capabilities: delay
Threading capabilities: none
Supported pixel formats: cuda nv12 p010le p016le
h264_cuvid AVOptions:
-deint .D.V… Set deinterlacing mode (from 0 to 2) (default weave)
weave .D.V… Weave deinterlacing (do nothing)
bob .D.V… Bob deinterlacing
adaptive .D.V… Adaptive deinterlacing
-gpu .D.V… GPU to be used for decoding
-surfaces .D.V… Maximum surfaces to be used for decoding (from 0 to INT_MAX) (default 25)
-drop_second_field .D.V… Drop second field when deinterlacing (default false)
-crop .D.V… Crop (top)x(bottom)x(left)x(right)
-resize .D.V… Resize (width)x(height)

FFmpeg 3.2.4:
Decoder h264_cuvid [Nvidia CUVID H264 decoder]:
General capabilities: delay
Threading capabilities: none
Supported pixel formats: cuda nv12
h264_cuvid AVOptions:
-deint .D.V… Set deinterlacing mode (from 0 to 2) (default weave)
weave .D.V… Weave deinterlacing (do nothing)
bob .D.V… Bob deinterlacing
adaptive .D.V… Adaptive deinterlacing
-gpu .D.V… GPU to be used for decoding

It seems to me it is a bug, what if you WANT to have frame doubling on deinterlacing? It is a feature which is supported by cuvid so why does ffmpeg drops every other frame?

This is working fine till ffmpeg 3.3.x , by setting output framerate with -r 50 (if original is 25i), for example:
ffmpeg -hwaccel cuvid -c:v h264_cuvid -deint 2 -resize 1280x720 -f mpegts -i interlaced_1080i50.ts -vcodec h264_nvenc -preset slow -r 50 -f mpegts out.ts

However, -r 50 for output framerate does nothing from 3.4.x till latest 4.0.2 (haven’t tried latest git but I guess it will be the same).

Is this something to be reported to ffmpeg or is it an issue with cuvid?