[FFmpeg-user] Problem converting to mp4 with exact video bit rate

Vikram Arora vikram.arora1985 at gmail.com
Tue Feb 13 11:16:31 EET 2018


Hi,

I am trying to convert a mp4 video file to 512k amd 1024k video bitrate,
but the converted file is only about 350k.

The command used is :

ffmpeg -i src_file.mp4 -y -ab "512k" -ac "2" -c:a "libfdk_aac" -ar "44100"
-c:v "libx264" -r "29.97" -b:v "512k" -minrate "512k" -maxrate "512k"
-bufsize "512k" -crf "23" -threads 1 dest_file.mp4

*Orig file specs are as under :*

Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 69.7 MiB
Duration                                 : 4 min 54 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 986 kb/s

Writing application                      : Lavf51.12.1

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Baseline at L2.2
Format settings, CABAC                   : No
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=12
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 4 min 54 s
Bit rate                                 : 1 872 kb/s
Width                                    : 640 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 15.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.406
Stream size                              : 65.7 MiB (94%)
Language                                 : English

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 4 min 54 s
Bit rate mode                            : Variable
Bit rate                                 : 111 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 spf)
Compression mode                         : Lossy
Stream size                              : 3.91 MiB (6%)

*Console Output is as under:*

ffmpeg version N-89723-g2ca65fc Copyright (c) 2000-2018 the FFmpeg
developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
  configuration: --prefix=/home/ffmpeg_build --pkg-config-flags=--static
--extra-cflags=-I/home/ffmpeg_build/include
--extra-ldflags=-L/home/ffmpeg_build/lib --extra-libs=-lpthread
--extra-libs=-lm --bindir=/home/ffmpeg_bin --enable-gpl --enable-libfdk_aac
--enable-libfreetype --enable-libmp3lame --enable-libopus
--enable-libvorbis --enable-libopencore-amrnb --enable-libx264
--enable-nonfree --enable-version3
  libavutil      56.  7.100 / 56.  7.100
  libavcodec     58.  9.100 / 58.  9.100
  libavformat    58.  3.100 / 58.  3.100
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7. 11.101 /  7. 11.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'NPVD0010.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2018-01-10T13:13:52.000000Z
    encoder         : Lavf51.12.1
  Duration: 00:04:54.48, start: 0.000000, bitrate: 1986 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 1871 kb/s, 15 fps, 15 tbr,
15 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2018-01-10T13:15:03.000000Z
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 111 kb/s (default)
    Metadata:
      creation_time   : 2018-01-10T13:15:03.000000Z
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[libx264 @ 0x2d1b340] using SAR=1/1
[libx264 @ 0x2d1b340] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x2d1b340] profile High, level 3.0
[libx264 @ 0x2d1b340] 264 - core 155 - H.264/MPEG-4 AVC codec - Copyleft
2003-2018 - 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=6 lookahead_threads=1
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 vbv_maxrate=512 vbv_bufsize=512 crf_max=0.0 nal_hrd=none
filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'NPVD0010.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.3.100
    Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
640x480 [SAR 1:1 DAR 4:3], q=-1--1, 512 kb/s, 29.97 fps, 11988 tbn, 29.97
tbc (default)
    Metadata:
      creation_time   : 2018-01-10T13:15:03.000000Z
      handler_name    : VideoHandler
      encoder         : Lavc58.9.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 512000/0/512000 buffer size: 512000
vbv_delay: -1
    Stream #0:1(eng): Audio: aac (libfdk_aac) (mp4a / 0x6134706D), 44100
Hz, stereo, s16, 64 kb/s (default)
    Metadata:
      creation_time   : 2018-01-10T13:15:03.000000Z
      handler_name    : SoundHandler
      encoder         : Lavc58.9.100 libfdk_aac
More than 1000 frames duplicated    3072kB time=00:01:04.06 bitrate=
392.8kbits/s dup=952 drop=0 speed=5.93x
frame= 8821 fps=174 q=-1.0 Lsize=   14126kB time=00:04:54.47 bitrate=
393.0kbits/s dup=4406 drop=0 speed= 5.8x
video:11512kB audio:2302kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 2.261231%
[libx264 @ 0x2d1b340] frame I:41    Avg QP:18.87  size: 20791
[libx264 @ 0x2d1b340] frame P:2755  Avg QP:22.05  size:  3511
[libx264 @ 0x2d1b340] frame B:6025  Avg QP:20.54  size:   210
[libx264 @ 0x2d1b340] consecutive B-frames:  0.6% 23.1%  5.3% 71.0%
[libx264 @ 0x2d1b340] mb I  I16..4: 30.0% 27.5% 42.5%
[libx264 @ 0x2d1b340] mb P  I16..4:  5.8%  4.5%  2.0%  P16..4: 21.1%  3.3%
2.1%  0.0%  0.0%    skip:61.3%
[libx264 @ 0x2d1b340] mb B  I16..4:  0.2%  0.2%  0.0%  B16..8: 10.5%  0.2%
0.0%  direct: 0.3%  skip:88.6%  L0:28.5% L1:70.6% BI: 1.0%
[libx264 @ 0x2d1b340] 8x8 transform intra:35.8% inter:47.0%
[libx264 @ 0x2d1b340] coded y,uvDC,uvAC intra: 33.5% 45.6% 17.7% inter:
3.6% 5.8% 1.1%
[libx264 @ 0x2d1b340] i16 v,h,dc,p: 29% 47% 11% 13%
[libx264 @ 0x2d1b340] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 32% 28%  2%  1%
1%  1%  2%  3%
[libx264 @ 0x2d1b340] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 28% 16%  4%  4%
4%  4%  4%  4%
[libx264 @ 0x2d1b340] i8c dc,h,v,p: 39% 35% 19%  7%
[libx264 @ 0x2d1b340] Weighted P-Frames: Y:3.8% UV:2.4%
[libx264 @ 0x2d1b340] ref P L0: 76.9% 11.3%  9.4%  2.2%  0.1%
[libx264 @ 0x2d1b340] ref B L0: 83.6% 13.8%  2.7%
[libx264 @ 0x2d1b340] ref B L1: 95.2%  4.8%
[libx264 @ 0x2d1b340] kb/s:320.40

Please help to get the converted files with exact bit rates.

*Thanks,*
*Vikram*


More information about the ffmpeg-user mailing list