Transcoding to HLS using h264_nvenc does not work

Here you can submit bugreports
Post Reply
dlebrero
Posts: 15
Joined: Thu Apr 06, 2017 3:01 pm

Transcoding to HLS using h264_nvenc does not work

Post by dlebrero »

I was trying to use ffastrans to encode 3 HLS renditions using Nvidia Cuda h264_nvenc, but to my surprise it did not work, it displays an error about not being able to load the nvcuda.dll

The same command used on a Commmand Prompt works correctly

Code: Select all

P:\FFASTRANS-2\FFAStrans1.2.1\Processors\ffmpeg\x64\ffmpeg.exe -i "T:\Transcoding_Area\2-WORK_BENCH\1-TV\1-ENGLISH\1-TV\UTAUN000100010000000\UTAUN000100010000000.ts" -filter_complex "[0:v]split=3[v1][v2][v3]; [v1]scale=w=1280:h=720[v1out]; [v2]scale=w=852:h=480[v2out]; [v3]scale=w=640:h=360[v3out]" -map [v1out] -c:v:0 h264_nvenc -preset fast -rc:v cbr -pix_fmt yuv420p -profile:v baseline -level 4.1 -bf 2 -strict_gop 1 -no-scenecut 1 -b:v:0 1465k -g 30 -sc_threshold 0 -keyint_min 30 -map [v2out] -c:v:1 h264_nvenc -preset fst -rc:v cbr -pix_fmt yuv420p -profile:v baseline -level 4.1 -bf 2 -strict_gop 1 -no-scenecut 1 -b:v:1 964k -g 30 -sc_threshold 0 -keyint_min 30 -map [v3out] -c:v:2 h264_nvenc -preset fast -rc:v cbr -pix_fmt yuv420p -profile:v baseline -level 4.1 -bf 2 -strict_gop 1 -no-scenecut 1 -b:v:2 764k -g 30 -sc_threshold 0 -keyint_min 30 -map a:0 -c:a:0 aac -b:a:0 96k -ac 2 -map a:0 -b:a:1 96k -map a:0 -b:a:2 48k -f hls -var_stream_map "v:0,a:0,name:1465  v:1,a:1,name:964 v:2,a:2,name:764" -hls_time 6 -hls_playlist_type vod -hls_flags independent_segments -hls_segment_type mpegts -hls_segment_filename "P:\HLS\Outbox\Test\%v_%05d.ts" -f hls -master_pl_name "index.m3u8" "P:\HLS\Outbox\Test\%v.m3u8"
Attached is the workflow that does not work

Thanks for taking a look.

Regards,
Daniel
Attachments
TEST-HLS-GPU.json
(4.62 KiB) Downloaded 164 times
dlebrero
Posts: 15
Joined: Thu Apr 06, 2017 3:01 pm

Re: Transcoding to HLS using h264_nvenc does not work

Post by dlebrero »

I figure out wha the issue was with the DLL not loading, it was sending the job to another machine that had no Cuda drivers or GPU, but I have a new error now.

this is the error I'm getting:
"msg": "Custom FFmpeg@DESKTOP-0A33PFB: Encoding: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument."
emcodem
Posts: 1643
Joined: Wed Sep 19, 2018 8:11 am

Re: Transcoding to HLS using h264_nvenc does not work

Post by emcodem »

Hey dlebrero

congrats, you just wrote topic #1000 and #1001 on this forum :D
Same as when you ask the ffmpeg user group, we need the full, uncut command + output of your ffmpeg command on commandline.
If you cannot reproduce the problem on commandline, please zip and send us the full log directory of the job.

Thanks!
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1659
Joined: Sat Feb 08, 2014 10:39 pm

Re: Transcoding to HLS using h264_nvenc does not work

Post by admin »

Hi Daniel,

Since you need to control the output your command is not suited for the custom ffmpeg node. I suggest you use the command executor instead. Also, please note the following from the help section of the custom ffmpeg node:

If "nul", "null" or no extension is specified, the encoder will output to null, and thus no file will be written. Useful for benchmarking.

-steinar
dlebrero
Posts: 15
Joined: Thu Apr 06, 2017 3:01 pm

Re: Transcoding to HLS using h264_nvenc does not work

Post by dlebrero »

Sorry my bad, the command was ill constructed, I was able to make it work with the following command and it works fine with GPU, Now I will have to scale it to the whole farm.

Here is the command that works.

Code: Select all

-filter_complex "[0:v]split=3[v1][v2][v3]; [v1]scale=w=1280:h=720[v1out]; [v2]scale=w=852:h=480[v2out]; [v3]scale=w=640:h=360[v3out]" -map [v1out] -c:v:0 h264_nvenc -preset fast -rc:v cbr -pix_fmt yuv420p -profile:v baseline -level 4.1 -bf 2 -strict_gop 1 -no-scenecut 1 -b:v:0 1465k -g 30 -sc_threshold 0 -keyint_min 30 -map [v2out] -c:v:1 h264_nvenc -preset fst -rc:v cbr -pix_fmt yuv420p -profile:v baseline -level 4.1 -bf 2 -strict_gop 1 -no-scenecut 1 -b:v:1 964k -g 30 -sc_threshold 0 -keyint_min 30 -map [v3out] -c:v:2 h264_nvenc -preset fast -rc:v cbr -pix_fmt yuv420p -profile:v baseline -level 4.1 -bf 2 -strict_gop 1 -no-scenecut 1 -b:v:2 764k -g 30 -sc_threshold 0 -keyint_min 30 -map a:0 -c:a:0 aac -b:a:0 96k -ac 2 -map a:0 -b:a:1 96k -map a:0 -b:a:2 48k -f hls -var_stream_map "v:0,a:0,name:1465  v:1,a:1,name:964 v:2,a:2,name:764" -hls_time 6 -hls_playlist_type vod -hls_flags independent_segments -hls_segment_type mpegts -hls_segment_filename "P:\HLS\Outbox\%s_original_name%\%v_%05d.ts" -master_pl_name "index.m3u8" "P:\HLS\Outbox\%s_original_name%\%v.m3u8"

BTW, to allow GPU encoding I installed the cuda drivers Cuda_11.4.0_471.11_win10.exe from this site: https://developer.nvidia.com/cuda-downl ... =exe_local and then a matching version of the Nvidia drivers

I also had to pacth the nvidia drivers with this https://github.com/keylase/nvidia-patch to remove the artificial limitation of number of transcoded streams per card.

Hope this help others using Nvidia encoding, it could also be applied to other formats, not only HLS, if someone needs help, just shoot me an email. Next step for me will be using decoding also on the Nvidia GPU
dlebrero
Posts: 15
Joined: Thu Apr 06, 2017 3:01 pm

Re: Transcoding to HLS using h264_nvenc does not work

Post by dlebrero »

The weird symbols that appears on my post are the following
"-c:v:1" minus c colon v colon 1
"-b:a:2" minus b colon a colon 2
emcodem
Posts: 1643
Joined: Wed Sep 19, 2018 8:11 am

Re: Transcoding to HLS using h264_nvenc does not work

Post by emcodem »

Thanks for sharing your stuff :D
for the weird symbols, just mark the text and click the "</>" symbol in the text editor ("code") :D - i just edited your post accordingly
emcodem, wrapping since 2009 you got the rhyme?
dlebrero
Posts: 15
Joined: Thu Apr 06, 2017 3:01 pm

Re: Transcoding to HLS using h264_nvenc does not work

Post by dlebrero »

I hope that all people that uses this great software shares their workflows and their knowledge, ffmpeg is very convoluted to use, poorly documented, there are options that are not documented at all, and no examples to follow, is a very painful process to learn how to use it.

BTW, I'm trying to get information on transcoding with Broadcast Profiles, interlaced stuff, True Constant Bitrate encoding, etc, anyone that has information and want share I'd love to hear
momocampo
Posts: 592
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Transcoding to HLS using h264_nvenc does not work

Post by momocampo »

Hello Dlebrero,
Yep you're right that's why we tried to create a wiki with main processes and with examples to help people to understand how FFAStrans works. I hope it helps many users.
bye ;)
Post Reply