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

Sreenath BH bhsreenath at gmail.com
Mon Mar 7 17:58:32 CET 2016


On 3/7/16, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Sreenath BH <bhsreenath <at> gmail.com> writes:
>
>> Should I rerun the ffmprg command without the "loglevel quiet"
>> and report the output?
>
> Yes, please.
>
>> Please suggest. The input file is rather large, and ffmpeg
> < console output is likely to be very long.
>
> Then cut the repeating lines in the middle of the console
> output (if you cannot increase your console window size
> which would likely make the output much smaller).
>
> Please do not top-post here!
>
> Carl Eugen
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>

Hi,

I hope I have got it right this time.

Here is the output from ffmpeg as well as ffprobe.

Input file:

[ec2-user at ip-172-21-13-223 tmp]$ ll /tmp/large.mp4
-rw-r----- 1 ec2-user ec2-user 320677736 Mar  2 23:29 /tmp/large.mp4


ffprobe output on  input file:
[ec2-user at ip-172-21-13-223 tmp]$ ffprobe /tmp/large.mp4
ffprobe version 3.0.git Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
  configuration: --prefix=/opt/mediaserver/build/ffmpeg_build
--extra-cflags=-I/opt/mediaserver/build/ffmpeg_build/include
--extra-ldflags=-L/opt/mediaserver/build/ffmpeg_build/lib
--bindir=/usrdata/mediaserver/bin --extra-libs=-ldl --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libx264 --enable-libvorbis --enable-libvpx --enable-nvenc
--extra-cflags=-I../cudautils --extra-ldflags=-L../cudautils
--enable-nonfree
  libavutil      55. 18.100 / 55. 18.100
  libavcodec     57. 24.103 / 57. 24.103
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 32.100 /  6. 32.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/large.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42mp41
    creation_time   : 2013-11-15 18:04:27
  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
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2013-11-15 18:04:27
      handler_name    : Apple Sound Media Handler
----------

Running ffmpeg with libx264 codec

root at ip-172-21-13-223:/tmp/legacy# ffmpeg -i /tmp/large.mp4  -c:a aac
-c:v libx264 -pix_fmt yuv420p -movflags +faststart large-libx264.mp4
ffmpeg version 3.0.git Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
  configuration: --prefix=/opt/mediaserver/build/ffmpeg_build
--extra-cflags=-I/opt/mediaserver/build/ffmpeg_build/include
--extra-ldflags=-L/opt/mediaserver/build/ffmpeg_build/lib
--bindir=/usrdata/mediaserver/bin --extra-libs=-ldl --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libx264 --enable-libvorbis --enable-libvpx --enable-nvenc
--extra-cflags=-I../cudautils --extra-ldflags=-L../cudautils
--enable-nonfree
  libavutil      55. 18.100 / 55. 18.100
  libavcodec     57. 24.103 / 57. 24.103
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 32.100 /  6. 32.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/large.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42mp41
    creation_time   : 2013-11-15 18:04:27
  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
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2013-11-15 18:04:27
      handler_name    : Apple Sound Media Handler
[libx264 @ 0x3aee420] using SAR=1/1
[libx264 @ 0x3aee420] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x3aee420] profile High, level 3.0
[libx264 @ 0x3aee420] 264 - core 148 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2016 - http://www.videolan.org/x264.html - options:
cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2
b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
Output #0, mp4, to 'large-libx264.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42mp41
    encoder         : Lavf57.25.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p, 768x432 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30
tbc (default)
    Metadata:
      creation_time   : 2013-11-15 18:04:27
      handler_name    : Apple Video Media Handler
      encoder         : Lavc57.24.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100
Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2013-11-15 18:04:27
      handler_name    : Apple Sound Media Handler
      encoder         : Lavc57.24.103 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[mp4 @ 0x3aed940] Starting second pass: moving the moov atom to the
beginning of the file6.18x
frame=196569 fps=185 q=-1.0 Lsize=  306464kB time=01:49:12.27 bitrate=
383.2kbits/s speed=6.17x
video:196755kB audio:102776kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 2.314734%
[libx264 @ 0x3aee420] frame I:816   Avg QP:17.45  size: 49086
[libx264 @ 0x3aee420] frame P:53227 Avg QP:21.86  size:  2446
[libx264 @ 0x3aee420] frame B:142526 Avg QP:29.28  size:   219
[libx264 @ 0x3aee420] consecutive B-frames:  3.1%  0.4%  0.6% 95.9%
[libx264 @ 0x3aee420] mb I  I16..4: 19.3% 37.1% 43.6%
[libx264 @ 0x3aee420] mb P  I16..4:  0.5%  0.9%  0.2%  P16..4: 17.2%
5.6%  3.6%  0.0%  0.0%    skip:72.0%
[libx264 @ 0x3aee420] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 10.8%
0.3%  0.1%  direct: 0.2%  skip:88.6%  L0:44.8% L1:53.3% BI: 1.9%
[libx264 @ 0x3aee420] 8x8 transform intra:47.2% inter:69.1%
[libx264 @ 0x3aee420] coded y,uvDC,uvAC intra: 53.1% 68.9% 40.4%
inter: 2.6% 4.4% 0.1%
[libx264 @ 0x3aee420] i16 v,h,dc,p: 38% 33%  6% 23%
[libx264 @ 0x3aee420] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 19% 21%  3%
4%  5%  4%  5%  4%
[libx264 @ 0x3aee420] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 32% 11%  4%
5%  5%  6%  4%  7%
[libx264 @ 0x3aee420] i8c dc,h,v,p: 47% 25% 22%  7%
[libx264 @ 0x3aee420] Weighted P-Frames: Y:0.6% UV:0.4%
[libx264 @ 0x3aee420] ref P L0: 68.4% 11.4% 15.5%  4.6%  0.0%
[libx264 @ 0x3aee420] ref B L0: 92.9%  6.4%  0.7%
[libx264 @ 0x3aee420] ref B L1: 96.3%  3.7%
[libx264 @ 0x3aee420] kb/s:245.99
[aac @ 0x3ad8200] Qavg: 667.655

ffprobe large-libx264.mp4
-------------
root at ip-172-21-13-223:/tmp/legacy# ffprobe large-libx264.mp4
ffprobe version 3.0.git Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
  configuration: --prefix=/opt/mediaserver/build/ffmpeg_build
--extra-cflags=-I/opt/mediaserver/build/ffmpeg_build/include
--extra-ldflags=-L/opt/mediaserver/build/ffmpeg_build/lib
--bindir=/usrdata/mediaserver/bin --extra-libs=-ldl --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libx264 --enable-libvorbis --enable-libvpx --enable-nvenc
--extra-cflags=-I../cudautils --extra-ldflags=-L../cudautils
--enable-nonfree
  libavutil      55. 18.100 / 55. 18.100
  libavcodec     57. 24.103 / 57. 24.103
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 32.100 /  6. 32.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'large-libx264.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    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
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler


file size : -rw-r--r-- 1 root root 313818971 Mar  7 16:29 large-libx264.mp4
-------------------

running ffmpeg using nvenc codec:
root at ip-172-21-13-223:/tmp/nvidia# ffmpeg -i /tmp/large.mp4  -c:a aac
-c:v nvenc_h264 -pix_fmt yuv420p -movflags +faststart
large-nvidia.mp4
ffmpeg version 3.0.git Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
  configuration: --prefix=/opt/mediaserver/build/ffmpeg_build
--extra-cflags=-I/opt/mediaserver/build/ffmpeg_build/include
--extra-ldflags=-L/opt/mediaserver/build/ffmpeg_build/lib
--bindir=/usrdata/mediaserver/bin --extra-libs=-ldl --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libx264 --enable-libvorbis --enable-libvpx --enable-nvenc
--extra-cflags=-I../cudautils --extra-ldflags=-L../cudautils
--enable-nonfree
  libavutil      55. 18.100 / 55. 18.100
  libavcodec     57. 24.103 / 57. 24.103
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 32.100 /  6. 32.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/large.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42mp41
    creation_time   : 2013-11-15 18:04:27
  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
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2013-11-15 18:04:27
      handler_name    : Apple Sound Media Handler
Output #0, mp4, to 'large-nvidia.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42mp41
    encoder         : Lavf57.25.100
    Stream #0:0(eng): Video: h264 (nvenc_h264) (Main) ([33][0][0][0] /
0x0021), yuv420p, 768x432 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 30
fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2013-11-15 18:04:27
      handler_name    : Apple Video Media Handler
      encoder         : Lavc57.24.103 nvenc_h264
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100
Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2013-11-15 18:04:27
      handler_name    : Apple Sound Media Handler
      encoder         : Lavc57.24.103 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (nvenc_h264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[mp4 @ 0x2f03940] Starting second pass: moving the moov atom to the
beginning of the file10.2x
frame=196569 fps=304 q=-0.0 Lsize=  631444kB time=01:49:12.30 bitrate=
789.5kbits/s speed=10.1x
video:523251kB audio:102776kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.865260%
[aac @ 0x2eee080] Qavg: 667.655


ffprobe output on lage-nvidia.mp4

[ec2-user at ip-172-21-13-223 nvidia]$ ffprobe large-nvidia.mp4
ffprobe version 3.0.git Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
  configuration: --prefix=/opt/mediaserver/build/ffmpeg_build
--extra-cflags=-I/opt/mediaserver/build/ffmpeg_build/include
--extra-ldflags=-L/opt/mediaserver/build/ffmpeg_build/lib
--bindir=/usrdata/mediaserver/bin --extra-libs=-ldl --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libx264 --enable-libvorbis --enable-libvpx --enable-nvenc
--extra-cflags=-I../cudautils --extra-ldflags=-L../cudautils
--enable-nonfree
  libavutil      55. 18.100 / 55. 18.100
  libavcodec     57. 24.103 / 57. 24.103
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 32.100 /  6. 32.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'large-nvidia.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    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
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

File size : -rw-r--r-- 1 root root 646598462 Mar  7 16:49 large-nvidia.mp4
-----------------------

As can be seen the two outputs differ in the H264 profile(High vs
Main), bitrate, the pixel format and of course the file sizes.

Any help is greatly appreciated,

Thanks,
Sreenath


More information about the ffmpeg-user mailing list