Page 1 of 1

hwaccel cuvid / hwaccel dxva2

Posted: Sun May 20, 2018 1:45 pm
by FranceBB
Hi,
I know I can add a custom ffmpeg command line, but I don't know which lines the default XDCAM node uses.
People that have NVIDIA GPU can get a lot of improvements over the normal encoding if they use -hwaccel cuvid before "input".
Other people may also get many speed improvements using dxva2, so using -hwaccel dxva2.
I think you should add a setting in the XDCAM50 node called "use hardware acceleration" and enable users to use cuvid or dxva2.

By the way, this is my command line:

________________________________

ffmpeg.exe -hwaccel cuvid -i "AVS Script.avs" -pix_fmt yuv422p -vcodec mpeg2video -threads 32 -s 1920:1080 -aspect 16:9 -vf setfield=tff -flags +ildct+ilme -r 25 -b:v 50000k -minrate 50000k -maxrate 50000k -bufsize 36408333 -acodec pcm_s16le -ar 48000 -g 12 -bf 2 -profile:v 0 -level:v 2 -color_range 1 -color_primaries 1 -color_trc 1 -colorspace 1 -f mxf "output.mxf"

PAUSE

________________________________

I'd like to add a custom ffmpeg command line that is different, though.
I'd like to add a custom ffmpeg node that has the very same settings as these in the screen (default XDCAM50 node) but also -hwaccel cuvid:

Image

Re: hwaccel cuvid / hwaccel dxva2

Posted: Mon May 21, 2018 9:29 am
by taner
A workaround is to trigger a script with your ffmpeg-commands using the command executor-node

Re: hwaccel cuvid / hwaccel dxva2

Posted: Mon May 21, 2018 10:10 pm
by FranceBB
Sure, I can do that, but it wouldn't automatically crop.
Let's say I have a 720x480 flagged 4:3 footage; I should crop 60 top and 60 bottom and the upscale to 1920x1080, but my command line is not gonna do that. I don't know how this is handled by the XDCAM node and I don't know how the "analyze" is handled in the XDCAM node (I mean, for progressive footages and interlaced footages). I could add a bunch of conditional node and do it using Avisynth, but I don't see it as a very practical solution.

In other words, if someone can provide the exact same ffmpeg command line the XDCAM node uses, I can just put -hwaccel dxva2 in front of it and everything is gonna work flawlessly.

Re: hwaccel cuvid / hwaccel dxva2

Posted: Tue May 22, 2018 6:59 am
by admin
Hi FranceBB,

Remember that the inbuilt encoders has LOTS of "conditional nodes" to decide how to construct a proper command line to make the source fit your settings. There is no easy or practical way around this. But, luckily for you, FFAStrans will write the exact ffmpeg commands used in a log file if you enable this in the workflow properties -> "special" -> "log to files". Just submit a file and search for the string "_Simple_MediaOutput executing:" in the log file. Here's a full example of an 4:1:1, lower field, NTSC SD 4:3 file coverted to XDCAM-HD422i50:

"D:\FFAStrans0.9.1\Processors\FFMpeg\x64\ffmpeg.exe" -probesize 536870912 -analyzeduration 536870912 -fpsprobesize 536870912 -i "E:\Broadcast test media files\Broadcast\NTSC_SD_DV25_colorbar.mxf" -f lavfi -i aevalsrc=0 -f lavfi -i color=color=black:size=1920x1080 -shortest -map_metadata -1 -map 0:17 -filter_complex "[0:0]pan=1|c0=c0[a1],[0:1]pan=1|c0=c0[a2],[0:2]pan=1|c0=c0[a3],[0:3]pan=1|c0=c0[a4],[a1]amerge=1[astr1],[a2]amerge=1[astr2],[a3]amerge=1[astr3],[a4]amerge=1[astr4]" -map "[astr1]" -c:a pcm_s24le -ar 48000 -map "[astr2]" -c:a pcm_s24le -ar 48000 -map "[astr3]" -c:a pcm_s24le -ar 48000 -map "[astr4]" -c:a pcm_s24le -ar 48000 -vf copy,crop=720:368:0:56,il=l=d:c=d,scale=0:0:sws_dither=ed:in_range=full:out_range=full,format=yuv422p,colorspace=fast=1:all=bt709:format=yuv422p:ispace=bt470bg:itrc=bt470bg:iprimaries=smpte170m,il=l=i:c=i,bwdif=1:1,scale=1920:1080:flags=lanczos:sws_dither=ed:in_range=full:out_range=full,framerate=50,setfield=tff,separatefields,select='not(mod(n\,4))+not(mod(n+1\,4))',weave=t,setfield=tff,setdar=dar=16/9,setsar=sar=1 -field_order tt -top 1 -flags +ildct+ilme -alternate_scan 1 -g 12 -timecode 00:00:00:00 -c:v mpeg2video -r 25 -pix_fmt yuv422p -aspect 16:9 -seq_disp_ext 1 -video_format component -color_range 1 -color_primaries 1 -color_trc 1 -colorspace 1 -chroma_sample_location topleft -signal_standard 4 -non_linear_quant 1 -dc 11 -intra_vlc 1 -qmin 1 -lmin "1*QP2LAMBDA" -qmax 28 -lmax "56*QP2LAMBDA" -b:v 50000000 -minrate 50000000 -maxrate 50000000 -minrate 50000000 -bufsize 17825792 -bf 2 -metadata creation_time=now -y "g:\.ffastrans_work_root\20180516091431\20180522-085315-389-613A9E63B689\~20180522-085317-977-2D28DD65BD35.mxf"

-steinar