Hi, I need some help or a hint, I try to transcode a live stream with ffmpeg and I wish to burn dvbsub same time, this process must be CPU friendly :) so GPU must do the work, this is the map of stream:
Stream #0:1[0xb5f]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn
Stream #0:20xb60: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 256 kb/s
Stream #0:30xb64: Subtitle: dvb_subtitle (dvbsub) ([6][0][0][0] / 0x0006)
I have manage to overlay subtitle (with CPU) and transcode with GPU and all good, this is the command I use:
ffmpeg -fflags +genpts -nostats -nostdin -hide_banner -c:v h264_cuvid -deint 2 -drop_second_field 1 -surfaces 10 -i input -filter_complex “[0:s:0] scale=1920:1080 [sub],[0:v][sub] overlay=x=0:y=0:format=auto” -vcodec hevc_nvenc -b_ref_mode 0 -preset fast -cq 10 -g 150 -b:v 3500k -minrate 3000k -maxrate 4000k -bufsize 1002k -map 0:a:0 -c:a libfdk_aac -ac 2 -b:a 192k out
But subtitle is burned with CPU.
In the command from bellow, I try to burn subtitle with GPU, but the color is not right and this is the solution I found so far:
ffmpeg -hwaccel cuvid -c:v h264_cuvid -canvas_size 1820x1080 -i input -filter_complex “[0:v]hwdownload,format=nv12[base];
[0:s:0]scale=1920:1080[subtitle]; [base][subtitle]overlay=y=500:x=620[v];
[v]hwupload_cuda=0,yadif_cuda=0:-1:0[v]” -map “[v]” -vcodec hevc_nvenc -rc-lookahead 20 -i_qfactor 0.75 -b_qfactor 1.1 -b_ref_mode 0 -preset llhq -tune ll -cq 10 -g 150 -b:v 3500k -minrate 3000k -maxrate 4000k -bufsize 2002k -map 0:a:0 -c:a libfdk_aac -ac 2 -b:a 192k out
GPU used : GP104GL [Tesla P4]
FFmpeg version : N-118215-gdd5696c197
Sample of input video : Digi Storage - Download link for dgl.ts
The problem I think it’s because of incorrect format of subtitle, can I correct somehow this problem, if not I think if I put a black background color in the back of the subtitle I will obtain the same color and will not be influenced of what is running, any idea, hint, help will be appreciated, thank you.