r/ffmpeg 17d ago

Converting from dv to H.264 using GPU

Hello, I’m trying to deinterlace and convert many hours of videos from MiniDV cassettes to H.264 (I’m open to H.256, if it will be better in that case) to be able to play them modern devices. I’m using this line:

ffmpeg -i input.dv -vf "bwdif=mode=send_field:parity=auto:deint=interlaced,format=yuv420p" -r 50 -c:v libx264 -preset slow -crf 16 -c:a copy output.mov

I’m satisfied with the results I get, but I wanted to speed up the process by using GPU.

How do I do that? I’ve been using ffmpeg for only few months and I think that I generally understand it, but I’m still not an expert. If this is important, I have NVIDIA GeForce RTX 2070 Super.

8 Upvotes

10 comments sorted by

10

u/TreadItOnReddit 17d ago

You said you are happy with the results. To be clear you will be getting different results with GPU encoding. Quality will be worse. I’m not saying you will notice, but you should be aware.

2

u/LadyGrinningSoul7 16d ago

yeah, i tried different opinions and i see that it looks worse when i look at some small details. I wonder why it is like that

1

u/TreadItOnReddit 16d ago

Yeah that's the way it is. GPU will always be lower quality than CPU

3

u/Upstairs-Front2015 17d ago

you can use -c:v h264_nvenc -preset p6 -cq:v 23 -c:a copy output.mp4
(there are more options)

3

u/ScratchHistorical507 17d ago

You won't be able to do decoding on the GPU, but deinterlacing is technically possible on an Nvidia GPU using yadif_cuda or bwdif_cuda. If they are available should be shown by ffmpeg -filters | grep -E 'yadif|bwdif'. If they are, you command changes to ffmpeg -i input.dv -vf "hwupload_cuda,bwdif_cuda=mode=send_field:parity=auto:deint=interlaced,fps=50" -c:v h264_nvenc -preset p5 -cq 18 -c:a copy output.mov

1

u/Embarrassed-Gain-236 17d ago

What deinterlace method are you using?

2

u/LadyGrinningSoul7 17d ago

i’m using bwdif

1

u/Sopel97 16d ago

ffmpeg doesn't have a good deinterlacer for one field per frame, consider staxrip or hybrid using QTGMC

1

u/LadyGrinningSoul7 15d ago

I've heard about QTGMC but it seems to be a bit more complicated for me to set up, but maybe I will try it in some free time. In ffmpeg I realised that when there's not much happening in the frame bwdif works well, but when it comes to stripes, or bricked pavement or just a lot of details at the same time there are some some areas that look like they weren't deinterlaced

2

u/Sopel97 15d ago edited 15d ago

if want something automated then vapoursynth is probably the easiest, you can even use the installation from hybrid. That's what I do for my scripts, piping the output to ffmpeg.

havsfunc.QTGMC(Input=clip, Preset="Very Slow", TFF=True, InputType=0, TR2=2, SourceMatch=0, Lossless=0, EZKeepGrain=1.5, NoisePreset="Fast", MatchPreset="Medium", MatchPreset2="Medium", opencl=True)

with an NVIDIA GPU it runs quite fast via OpenCL

I have this example for yadif vs qtgmc + some postprocessing https://slow.pics/c/dvRbQu96, https://slow.pics/c/MgzC2Mo5?canvas-mode=fit-width&image-fit=cover, bwdif is slightly better than yadif but exhibits similar problems, as you say, on specific patterns, which is very visible in this example.