I am using this ffmpeg command(values removed for simplicity)
ffmpeg -hwaccel cuvid -c:v h264_cuvid -y -ss 1 -i "FILE0001.MOV" -ss 0 -i "GOPR0621.MP4" -filter_complex
[0:v][1:v]
midequalizer
[al];
[al]
yadif
lenscorrection
scale
[vl];
[1:v]
lenscorrection
scale
[vr];
[vl][vr]
hstack=shortest=1
-an -c:v h264_nvenc -preset slow "output.mp4"
on a machine with a cuda graphics card.
I get
ffmpeg version N-90979-g08032331ac Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 18.100 / 56. 18.100
libavcodec 58. 19.100 / 58. 19.100
libavformat 58. 13.101 / 58. 13.101
libavdevice 58. 4.100 / 58. 4.100
libavfilter 7. 21.100 / 7. 21.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000254a8afc0c0] st: 0 edit list: 1 Missing key frame while searching for timestamp: 6006
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000254a8afc0c0] st: 0 edit list 1 Cannot find an index entry before timestamp: 6006.
....
Stream mapping:
Stream #0:0 (h264_cuvid) -> midequalizer:in0
Stream #1:0 (h264) -> midequalizer:in1
Stream #1:0 (h264) -> lenscorrection
hstack -> Stream #0:0 (h264_nvenc)
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
Error reinitializing filters!
The same command without CUDA works, ie
ffmpeg -y -ss 1 -i "FILE0001.MOV" -ss 0 -i "GOPR0621.MP4" -filter_complex
[0:v][1:v]
midequalizer
[al];
[al]
yadif
lenscorrection
scale
[vl];
[1:v]
lenscorrection
scale
[vr];
[vl][vr]
hstack=shortest=1
-an "output.mp4"
How do I make it work on a Windows 10 machine with cuda?
solution as of 2020: you need to pass hwupload_cuda
along with the filter to explicitly tell FFmpeg what to do.
So your command should look like this:
ffmpeg -hwaccel cuvid -c:v h264_cuvid -vsync 0 -y -i input.mp4 -vf "hwupload_cuda,scale_npp=w=1280:h=-2" -c:v h264_nvenc ...
Detail about this issue is described here: https://trac.ffmpeg.org/ticket/5587
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With