Issue in video compression

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue in video compression

FFmpeg-users mailing list
Hi Team,

I am currently working with ffmpeg 4.2.2 for video transcoding. My objective is to transcode a particular .mov file to .mp4 file and compress to a significant amount.
I am using the following command:-


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

But the output .mp4 file is not getting compressed. For example:- if the size of .mov file is of 563.2 MB, then the size of the output .mp4 file is becoming 560.1 MB

My further development work is stuck due to this. So, requesting you to kindly assist in this and help me with some solutions.



Thanks & Regards


Rakesh Chakraborty

Mail to: [hidden email]

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.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Issue in video compression

kumowoon1025
Hi,

> The description of preset file that has been used is as follows:-
>
> vcodec=libx264
> vprofile=main
> level=30
> b:v=800000
> bufsize=800000
>
> But the output .mp4 file is not getting compressed.

My first thought is that the b:v=800000 in the preset file is leading to a constant bit-rate encode. Is the file in question about an hour and 2 minutes long? If it’s close, then I would say that is what’s happening. If there is a file size constraint, you should encode using multiple passes, or if it is just the case that you would like a somewhat smaller file to work with, you can use constant quality (vs. constant bitrate) encoding settings, using -crf to control the output filesize by trial and error, instead of explicitly specifying the video bitrate

Regards,
Ted Park
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Issue in video compression

Carl Zwanzig
In reply to this post by FFmpeg-users mailing list
Perhaps I'm missing something, but...

On 6/11/2020 8:27 AM, Chakraborty, Rakesh via ffmpeg-user wrote:
> ffmpeg -i Input0.mov -y -fpre ./preset/mp4_Projector.ffpreset -astrict -2 -vsync vfr -acodec copy -vcodec copy -s 1280x720 Output0.mp4

(where's the command output? _always_ post the command output)

Looks like you're simply copying/repackaging the streams. Unless the mov
container has a lot of overhead, I wouldn't expect much difference in
container sizes. Without the command output, everyone is guessing.

If you expect the streams to be re-encoded, remove the copy options. Also,
while it probably won't make any difference at all, get the latest ffmpeg
and use that.

z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Issue in video compression

FFmpeg-users mailing list
In reply to this post by kumowoon1025
Hi Team,

I am extremely sorry that I forgot to attach the command output. Here's the output for the command that I previously used and my video file is not getting compressed. I used the following command:-


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!



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: [hidden email]

________________________________
From: ffmpeg-user <[hidden email]> on behalf of Ted Park <[hidden email]>
Sent: 11 June 2020 21:04
To: FFmpeg user questions <[hidden email]>
Subject: Re: [FFmpeg-user] Issue in video compression

*** EXTERNAL EMAIL: If sender is unknown, use caution when opening. ***


Hi,

> The description of preset file that has been used is as follows:-
>
> vcodec=libx264
> vprofile=main
> level=30
> b:v=800000
> bufsize=800000
>
> But the output .mp4 file is not getting compressed.

My first thought is that the b:v=800000 in the preset file is leading to a constant bit-rate encode. Is the file in question about an hour and 2 minutes long? If it’s close, then I would say that is what’s happening. If there is a file size constraint, you should encode using multiple passes, or if it is just the case that you would like a somewhat smaller file to work with, you can use constant quality (vs. constant bitrate) encoding settings, using -crf to control the output filesize by trial and error, instead of explicitly specifying the video bitrate

Regards,
Ted Park
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fffmpeg.org%2Fmailman%2Flistinfo%2Fffmpeg-user&amp;data=01%7C01%7Crakesh.chakraborty%40mheducation.com%7C2d289a1f59934fedb0c508d80e1cf0a6%7Cf919b1efc0c347358fca0928ec39d8d5%7C0&amp;sdata=p5LybFAkO9BXaMiKrTl4vgn97E8oTiJZsPavqHCq2bg%3D&amp;reserved=0

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
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.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".