[FFmpeg-user] size and bitrate issues with nvidia accelerated transcoding

Sreenath BH bhsreenath at gmail.com
Mon Mar 7 05:44:27 CET 2016


Hi all,

I am trying to use nvidia's nvenc codec to transcode video files.
ffmpeg has been built
with both libx264 and nvenc codecs enabled.

ffmpeg when run using nvenc codec creates a file that is almost double
the size of input
mp4 file and bitrate almost double the size of input file.

This is output of ffprobe on the input file:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'large.mp4':
 Metadata:
 Duration: 01:49:12.30, start: 0.000000, bitrate: 391 kb/s
  Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
768x432 [SAR 1:1 DAR 16:9], 292 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc
(default)
  Metadata:
    creation_time   : 2013-11-15 18:04:27
    handler_name    : Apple Video Media Handler

-----     Command used with libx264:
ffmpeg -i large.mp4 -loglevel quiet -c:a aac -c:v libx264 -pix_fmt
yuv420p -movflags +faststart out.mp4

output file has size of : 313818971  bytes
ffprobe output on the output file:

 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
 Metadata:
   encoder         : Lavf57.25.100
   Duration: 01:49:12.30, start: 0.023220, bitrate: 383 kb/s
  Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
768x432 [SAR 1:1 DAR 16:9], 245 kb/s, 30 fps, 30 tbr, 15360 tbn, 60
tbc (default)
 Metadata:
  handler_name    : VideoHandler

--------  Command using nvenv codec:
ffmpeg -i large.mp4 -loglevel quiet -c:a aac -c:v nvenc -pix_fmt
yuv420p -movflags +faststart out.mp4

Size of output file:
646598462  bytes (640 MB)

ffprobe output on the output files are as follows:

  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
  Metadata:
   encoder         : Lavf57.25.100
   Duration: 01:49:12.30, start: 0.023220, bitrate: 789 kb/s
   Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661),
yuv420p(tv), 768x432 [SAR 1:1 DAR 16:9], 654 kb/s, 30 fps, 30 tbr,
15360 tbn, 60 tbc (default)
  Metadata:
   handler_name    : VideoHandler

So the differences between the two appear to be:

(1) pixel format :  yuv420p(tv) with nvidia whereas it is yuv420p with libx264
(2) h264 (Main)  with nvidia whereas it is Video: h264 (High)
(3) bitrate: 789 kb/s with nvidia whereas it is  383 kb/s with lib264.

What is causing nvidia codec to double the bitrate? As can be seen, I
am not specifying any bitrate to use. So I expect ffmpeg to retain the
same bitrate.

I have also tried setting lower bitrates. The resulting video has
"blocks" effects when fast video is played. This artifact does not
disappear until the bitrate becomes almost double of the original.

I would like to retain the same bitrate and it would be good if the
file size if not so large.

Any help appreciated, since we are planning to deploy the GPU based
transcoding  soon.

thanks,
Sreenath


More information about the ffmpeg-user mailing list