[FFmpeg-devel] NVENC H.265 4K Uncatchable 60fps Performance

Ali KIZIL alikizil at gmail.com
Fri Apr 10 12:04:50 CEST 2015

Hello All,

A few days ago, Philip Langdale added NVENC H.265 (HEVC) support to FFmpeg. 
During my tests, I faced that both H.265 and H.264 can not pass over 30 fps
 for 4K video even with a Geforce Titan X GPU.

Fiannly, I reached a contact in Nvidia to learn the reason:

"These GPU’s (he means Titan X and GTX 980) have two independent NVENC 
engines,  each capable of ~30 fps 4K H.264 encoding in parallel. That’s 
why you are able to  do 2 independent encodings. For a single 60 fps, 
it cannot do it because it’s still limited by the clock speed."

I have a few questions. 
I will be grateful is someone can give an idea / reply.

1) On nvenc.c under libavcodec, is it possible to create more than one 
instance of nvenc to perform 4K 60 fps encoding using 
nvEncodeAPICreateInstance ?

2) I checked FFmpeg is capable of stacking videos vertically/horizontally. 
However, for stacking FFmpeg is re-encoding the videos. 
Here are the commands I tried;

ffmpeg -video_size 3840x2160 -framerate 50 -i /Projects/YUV/soccer.yuv -vcodec 
nvenc_h265 -an -filter:v "crop=in_w:in_h/2:0:0" -r 50 -g 50 -preset hp -cbr 1 
-2pass 0 -minrate 30000k -maxrate 30000k -bufsize 60000k -muxrate 30000k 
-y -f hevc top.hevc

ffmpeg -video_size 3840x2160 -framerate 50 -i /Projects/YUV/soccer.yuv -vcodec 
nvenc_h265 -an -filter:v "crop=in_w:in_h/2:0:in_h/2" -r 50 -g 50 -preset hp 
-cbr 1 -2pass 0 -minrate 30000k -maxrate 30000k -bufsize 60000k -muxrate 30000k 
-y -f hevc bottom.hevc

ffmpeg -i top.hevc -vf 'pad=iw:2*ih [top]; movie=bottom.hevc [bottom]; [top]
[bottom] overlay=0:main_h/2' stacked.hevc

Above first 2 commands use 2 engines of NVENC. And also last command tries 
to use NVENC as well. Geforce cards are limited to 2 sessions, 
so real time encoding fails.

Is there any way to stack videos without re-encoding ?

Kind Regards,

More information about the ffmpeg-devel mailing list