[FFmpeg-user] Compression issue using ffmpeg

Chakraborty, Rakesh Rakesh.Chakraborty at mheducation.com
Fri Jun 12 19:46:30 EEST 2020


Hi Team,

Requesting you to read the entire email and kindly help me in solving this. I'm in urgent need of this fix.

I used the following command to convert a .mov file to .mp4 file. Though it's getting converted but it's not getting compressed.


ffmpeg -i Input0.mov -y -fpre ./preset/mp4_Projector.ffpreset -astrict -2 -vsync vfr -acodec copy -vcodec copy -s 1280x720 Output0.mp4

The description of preset file that has been used is as follows:-

vcodec=libx264
vprofile=main
level=30
b:v=800000
bufsize=800000

Command Output:-


ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers

  built with Apple clang version 11.0.0 (clang-1100.0.33.8)

  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox

  libavutil      56. 31.100 / 56. 31.100

  libavcodec     58. 54.100 / 58. 54.100

  libavformat    58. 29.100 / 58. 29.100

  libavdevice    58.  8.100 / 58.  8.100

  libavfilter     7. 57.100 /  7. 57.100

  libswscale      5.  5.100 /  5.  5.100

  libswresample   3.  5.100 /  3.  5.100

  libpostproc    55.  5.100 / 55.  5.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Input0.mov':

  Metadata:

    major_brand     : qt

    minor_version   : 0

    compatible_brands: qt

    creation_time   : 2020-04-18T00:26:03.000000Z

  Duration: 00:30:59.09, start: 0.000000, bitrate: 675 kb/s

    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 63 kb/s (default)

    Metadata:

      creation_time   : 2020-04-18T00:26:03.000000Z

      handler_name    : Core Media Audio

    Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 607 kb/s, 10 fps, 10 tbr, 600 tbn, 1200 tbc (default)

    Metadata:

      creation_time   : 2020-04-18T00:26:03.000000Z

      handler_name    : Core Media Video

      encoder         : H.264

Output #0, mp4, to 'Output0.mp4':

  Metadata:

    major_brand     : qt

    minor_version   : 0

    compatible_brands: qt

    encoder         : Lavf58.29.100

    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 800 kb/s, 10 fps, 10 tbr, 19200 tbn, 600 tbc (default)

    Metadata:

      creation_time   : 2020-04-18T00:26:03.000000Z

      handler_name    : Core Media Video

      encoder         : H.264

    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 63 kb/s (default)

    Metadata:

      creation_time   : 2020-04-18T00:26:03.000000Z

      handler_name    : Core Media Audio

Stream mapping:

  Stream #0:1 -> #0:0 (copy)

  Stream #0:0 -> #0:1 (copy)

Press [q] to stop, [?] for help

frame=18590 fps=9689 q=-1.0 Lsize=  152908kB time=00:30:59.07 bitrate= 673.8kbits/s speed= 969x

video:137828kB audio:14382kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.458677%


But the above output file was not compressed.

Normally the duration of the .mov file varies. It may sometimes be 15-30 minutes or 1 hour or even more than 2 hours.

As suggested by one of your expertise, I removed the b:v=800000 from the description of preset file and used the following command adding -crf as suggested by you:-


ffmpeg -i ./recent/Input0.mov -y -crf 24 -b:v 512k -fpre ./preset/mp4_Projector1.ffpreset -astrict -2 -vsync vfr -s 640x480 ./recent/Output0.mp4

One of the .mov files whose size was 405 MB, it got successfully transcoded to .mp4 file and compressed to 83.9 MB

Command Output:-


ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers

  built with Apple clang version 11.0.0 (clang-1100.0.33.8)

  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox

  libavutil      56. 31.100 / 56. 31.100

  libavcodec     58. 54.100 / 58. 54.100

  libavformat    58. 29.100 / 58. 29.100

  libavdevice    58.  8.100 / 58.  8.100

  libavfilter     7. 57.100 /  7. 57.100

  libswscale      5.  5.100 /  5.  5.100

  libswresample   3.  5.100 /  3.  5.100

  libpostproc    55.  5.100 / 55.  5.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './recent/Input0.mov':

  Metadata:

    major_brand     : qt

    minor_version   : 0

    compatible_brands: qt

    creation_time   : 2020-06-02T06:49:22.000000Z

    com.apple.quicktime.make: Apple

    com.apple.quicktime.model: MacBookAir8,1

    com.apple.quicktime.software: Mac OS X 10.15.4 (19E287)

    com.apple.quicktime.creationdate: 2020-06-01T20:49:20-1000

  Duration: 00:14:52.17, start: 0.000000, bitrate: 3631 kb/s

    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt709/bt709, progressive), 640x480 [SAR 1:1 DAR 4:3], 3500 kb/s, 29.01 fps, 29.01 tbr, 30k tbn, 60k tbc (default)

    Metadata:

      creation_time   : 2020-06-02T06:49:22.000000Z

      handler_name    : Core Media Video

      encoder         : H.264

    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 63 kb/s (default)

    Metadata:

      creation_time   : 2020-06-02T06:49:22.000000Z

      handler_name    : Core Media Audio

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

[libx264 @ 0x7fc02f03da00] VBV bufsize set but maxrate unspecified, ignored

[libx264 @ 0x7fc02f03da00] using SAR=1/1

[libx264 @ 0x7fc02f03da00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2

[libx264 @ 0x7fc02f03da00] profile Main, level 3.0, 4:2:0, 8-bit

[libx264 @ 0x7fc02f03da00] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=15 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=24.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

Output #0, mp4, to './recent/Output0.mp4':

  Metadata:

    major_brand     : qt

    minor_version   : 0

    compatible_brands: qt

    com.apple.quicktime.creationdate: 2020-06-01T20:49:20-1000

    com.apple.quicktime.make: Apple

    com.apple.quicktime.model: MacBookAir8,1

    com.apple.quicktime.software: Mac OS X 10.15.4 (19E287)

    encoder         : Lavf58.29.100

    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 512 kb/s, 29.01 fps, 15k tbn, 29.01 tbc (default)

    Metadata:

      creation_time   : 2020-06-02T06:49:22.000000Z

      handler_name    : Core Media Video

      encoder         : Lavc58.54.100 libx264

    Side data:

      cpb: bitrate max/min/avg: 0/0/512000 buffer size: 800000 vbv_delay: -1

    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s (default)

    Metadata:

      creation_time   : 2020-06-02T06:49:22.000000Z

      handler_name    : Core Media Audio

      encoder         : Lavc58.54.100 aac

frame=25881 fps=291 q=-1.0 Lsize=   81901kB time=00:14:52.18 bitrate= 752.0kbits/s speed=  10x

video:73436kB audio:7562kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.114691%

[libx264 @ 0x7fc02f03da00] frame I:105   Avg QP:23.03  size: 21171

[libx264 @ 0x7fc02f03da00] frame P:6524  Avg QP:25.88  size:  5467

[libx264 @ 0x7fc02f03da00] frame B:19252 Avg QP:27.38  size:  1938

[libx264 @ 0x7fc02f03da00] consecutive B-frames:  0.8%  0.0%  0.0% 99.1%

[libx264 @ 0x7fc02f03da00] mb I  I16..4: 27.0%  0.0% 73.0%

[libx264 @ 0x7fc02f03da00] mb P  I16..4:  1.8%  0.0%  1.1%  P16..4: 65.6% 14.3%  9.2%  0.0%  0.0%    skip: 8.1%

[libx264 @ 0x7fc02f03da00] mb B  I16..4:  0.3%  0.0%  0.1%  B16..8: 46.2%  3.3%  0.2%  direct: 5.1%  skip:44.8%  L0:49.2% L1:49.2% BI: 1.6%

[libx264 @ 0x7fc02f03da00] coded y,uvDC,uvAC intra: 70.3% 75.9% 10.7% inter: 13.7% 37.6% 0.0%

[libx264 @ 0x7fc02f03da00] i16 v,h,dc,p: 11% 15% 22% 53%

[libx264 @ 0x7fc02f03da00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 16% 27%  7%  7%  6%  6%  6%  5%

[libx264 @ 0x7fc02f03da00] i8c dc,h,v,p: 63% 20% 11%  6%

[libx264 @ 0x7fc02f03da00] Weighted P-Frames: Y:3.6% UV:1.9%

[libx264 @ 0x7fc02f03da00] ref P L0: 40.1% 10.7% 36.1% 13.0%  0.2%

[libx264 @ 0x7fc02f03da00] ref B L0: 63.6% 22.0% 14.5%

[libx264 @ 0x7fc02f03da00] ref B L1: 83.9% 16.1%

[libx264 @ 0x7fc02f03da00] kb/s:674.29

[aac @ 0x7fc02f03f200] Qavg: 119.931


But, while trying the same command on another .mov file whose size was 562.2 MB and duration was 2h 10m 32s, it is giving error. I used the following command:-


ffmpeg -i ./recent/Input01.mov -y -crf 24 -b:v 512k -fpre ./preset/mp4_Projector1.ffpreset -astrict -2 -vsync vfr -s 1280x720 ./recent/Output01.mp4

Command output:-


ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers

  built with Apple clang version 11.0.0 (clang-1100.0.33.8)

  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox

  libavutil      56. 31.100 / 56. 31.100

  libavcodec     58. 54.100 / 58. 54.100

  libavformat    58. 29.100 / 58. 29.100

  libavdevice    58.  8.100 / 58.  8.100

  libavfilter     7. 57.100 /  7. 57.100

  libswscale      5.  5.100 /  5.  5.100

  libswresample   3.  5.100 /  3.  5.100

  libpostproc    55.  5.100 / 55.  5.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './recent/Input01.mov':

  Metadata:

    major_brand     : qt

    minor_version   : 0

    compatible_brands: qt

    creation_time   : 2020-05-18T22:11:48.000000Z

  Duration: 02:10:32.15, start: 0.000000, bitrate: 574 kb/s

    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 102 kb/s (default)

    Metadata:

      creation_time   : 2020-05-18T22:11:48.000000Z

      handler_name    : Core Media Audio

    Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 466 kb/s, 10 fps, 10 tbr, 600 tbn, 50 tbc (default)

    Metadata:

      creation_time   : 2020-05-18T22:11:49.000000Z

      handler_name    : Core Media Video

      encoder         : H.264

Stream mapping:

  Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))

  Stream #0:0 -> #0:1 (aac (native) -> aac (native))

Press [q] to stop, [?] for help

Too many packets buffered for output stream 0:1.

[aac @ 0x7fdcc4032600] Qavg: 33517.414

[aac @ 0x7fdcc4032600] 2 frames left in the queue on closing

Conversion failed!

I even tried the same with the new ffmpeg 4.2.3 but getting the same error.


Kindly help me in solving this with a proper command because I am confused with this weird behaviour for two different files using the same command.



Thanks & Regards


Rakesh Chakraborty

Mail to: rakesh.chakraborty at mheducation.com

The information contained in this message may be confidential and/or constitute a privileged attorney-client document.  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify McGraw-Hill immediately by replying to the message and deleting it from your computer.  Thank you.


More information about the ffmpeg-user mailing list