-preset veryfast produces smallest file, weird
Hi, by accident I transcoded a video with -preset veryfast (it took 1 h). So I had to run it again with -preset veryslow (it took 12 h). Now I'm wondering about the file sizes. How can that be? $ ls -l König_it* -rwxrwxrwx 1 ich ich 1058092584 Okt 13 02:16 König_it_veryfast.mkv -rwxrwxrwx 1 ich ich 1102865774 Okt 13 14:24 König_it_veryslow.mkv -rwxrwxrwx 1 ich ich 1238931498 Okt 13 20:21 König_it_medium.mkv Only for "veryslow" profile High, level 5 was automatically used by libx264, otherwise level 3.1 Visually I can't recognize a quality difference between the 3 videos. The source video is a screen grab, taken with "-crf 13 -preset ultrafast", so it is 10 times bigger. ======================================================= Ulf Zischt, [14.10.23 01:01] $ ffmpeg -ss 4.04 -t 2:06:33.12 -i roh_13-uf_it.mkv -ss 2:06:38.36 -t 91.28 -i roh_13-uf_de+Abspann.mkv -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -preset veryfast König_it.mkv ffmpeg version 5.1.1-1ubuntu2.1 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12 (Ubuntu 12.2.0-3ubuntu1) configuration: --prefix=/usr --extra-version=1ubuntu2.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-shared libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 Guessed Channel Layout for Input Stream #0.1 : stereo Input #0, matroska,webm, from 'roh_13-uf_it.mkv': Metadata: ENCODER : Lavf59.27.100 Duration: 02:14:57.86, start: 0.000000, bitrate: 13735 kb/s Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(tv, bt709, progressive), 1280x688 [SAR 1:1 DAR 80:43], 24.42 fps, 24 tbr, 1k tbn Metadata: DURATION : 02:14:57,792000000 Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Metadata: DURATION : 02:14:57,856000000 Guessed Channel Layout for Input Stream #1.1 : stereo Input #1, matroska,webm, from 'roh_13-uf_de+Abspann.mkv': Metadata: ENCODER : Lavf59.27.100 Duration: 02:14:57.49, start: 0.000000, bitrate: 13437 kb/s Stream #1:0: Video: h264 (Constrained Baseline), yuv420p(tv, bt709, progressive), 1280x688 [SAR 1:1 DAR 80:43], 24.42 fps, 24 tbr, 1k tbn Metadata: DURATION : 02:14:57,417000000 Stream #1:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Metadata: DURATION : 02:14:57,493000000 Stream mapping: Stream #0:0 (h264) -> concat Stream #0:1 (pcm_s16le) -> concat Stream #1:0 (h264) -> concat Stream #1:1 (pcm_s16le) -> concat concat -> Stream #0:0 (libx264) concat -> Stream #0:1 (libvorbis) Press [q] to stop, [?] for help [libx264 @ 0x56346dd4f240] using SAR=1/1 [libx264 @ 0x56346dd4f240] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64 [libx264 @ 0x56346dd4f240] profile High, level 3.1, 4:2:0, 8-bit [libx264 @ 0x56346dd4f240] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 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=1 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=10 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, matroska, to 'König_it.mkv': Metadata: encoder : Lavf59.27.100 Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p(tv, bt709, progressive), 1280x688 [SAR 1:1 DAR 80:43], q=2-31, 24 fps, 1k tbn Metadata: encoder : Lavc59.37.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1: Audio: vorbis (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp Metadata: encoder : Lavc59.37.100 libvorbis frame=184426 fps= 28 q=-1.0 Lsize= 1033294kB time=02:08:04.38 bitrate=1101.6kbits/s speed=1.18x video:947784kB audio:81226kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 0.416226% [libx264 @ 0x56346dd4f240] frame I:1824 Avg QP:16.97 size: 51298 [libx264 @ 0x56346dd4f240] frame P:58906 Avg QP:22.31 size: 10003 [libx264 @ 0x56346dd4f240] frame B:123696 Avg QP:24.33 size: 2326 [libx264 @ 0x56346dd4f240] consecutive B-frames: 9.1% 3.0% 4.6% 83.3% [libx264 @ 0x56346dd4f240] mb I I16..4: 37.7% 30.4% 32.0% [libx264 @ 0x56346dd4f240] mb P I16..4: 6.2% 8.0% 1.2% P16..4: 19.6% 7.1% 3.4% 0.0% 0.0% skip:54.7% [libx264 @ 0x56346dd4f240] mb B I16..4: 1.2% 1.3% 0.1% B16..8: 8.2% 2.1% 0.2% direct: 3.4% skip:83.5% L0:45.5% L1:41.1% BI:13.3% [libx264 @ 0x56346dd4f240] 8x8 transform intra:49.2% inter:44.6% [libx264 @ 0x56346dd4f240] coded y,uvDC,uvAC intra: 46.0% 51.1% 16.2% inter: 4.4% 6.5% 0.3% [libx264 @ 0x56346dd4f240] i16 v,h,dc,p: 48% 27% 16% 9% [libx264 @ 0x56346dd4f240] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 28% 20% 4% 5% 5% 5% 4% 5% [libx264 @ 0x56346dd4f240] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 26% 13% 5% 6% 7% 7% 6% 6% [libx264 @ 0x56346dd4f240] i8c dc,h,v,p: 53% 22% 19% 6% [libx264 @ 0x56346dd4f240] Weighted P-Frames: Y:3.0% UV:0.9% [libx264 @ 0x56346dd4f240] kb/s:1010.39 Ulf Zischt, [14.10.23 01:02] $ ffmpeg -ss 4.04 -t 2:06:33.12 -i roh_13-uf_it.mkv -ss 2:06:38.36 -t 91.28 -i roh_13-uf_de+Abspann.mkv -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -preset medium König_it_medium.mkv ffmpeg version 5.1.1-1ubuntu2.1 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12 (Ubuntu 12.2.0-3ubuntu1) configuration: --prefix=/usr --extra-version=1ubuntu2.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-shared libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 Guessed Channel Layout for Input Stream #0.1 : stereo Input #0, matroska,webm, from 'roh_13-uf_it.mkv': Metadata: ENCODER : Lavf59.27.100 Duration: 02:14:57.86, start: 0.000000, bitrate: 13735 kb/s Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(tv, bt709, progressive), 1280x688 [SAR 1:1 DAR 80:43], 24.42 fps, 24 tbr, 1k tbn Metadata: DURATION : 02:14:57,792000000 Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Metadata: DURATION : 02:14:57,856000000 Guessed Channel Layout for Input Stream #1.1 : stereo Input #1, matroska,webm, from 'roh_13-uf_de+Abspann.mkv': Metadata: ENCODER : Lavf59.27.100 Duration: 02:14:57.49, start: 0.000000, bitrate: 13437 kb/s Stream #1:0: Video: h264 (Constrained Baseline), yuv420p(tv, bt709, progressive), 1280x688 [SAR 1:1 DAR 80:43], 24.42 fps, 24 tbr, 1k tbn Metadata: DURATION : 02:14:57,417000000 Stream #1:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Metadata: DURATION : 02:14:57,493000000 File 'König_it_medium.mkv' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 (h264) -> concat Stream #0:1 (pcm_s16le) -> concat Stream #1:0 (h264) -> concat Stream #1:1 (pcm_s16le) -> concat concat -> Stream #0:0 (libx264) concat -> Stream #0:1 (libvorbis) Press [q] to stop, [?] for help [libx264 @ 0x556457227240] using SAR=1/1 [libx264 @ 0x556457227240] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64 [libx264 @ 0x556457227240] profile High, level 3.1, 4:2:0, 8-bit [libx264 @ 0x556457227240] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - 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=3 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=24 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, matroska, to 'König_it_medium.mkv': Metadata: encoder : Lavf59.27.100 Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p(tv, bt709, progressive), 1280x688 [SAR 1:1 DAR 80:43], q=2-31, 24 fps, 1k tbn Metadata: encoder : Lavc59.37.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1: Audio: vorbis (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp Metadata: encoder : Lavc59.37.100 libvorbis frame=184426 fps= 15 q=-1.0 Lsize= 1209894kB time=02:08:04.38 bitrate=1289.8kbits/s speed=0.646x video:1124370kB audio:81226kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 0.356514% [libx264 @ 0x556457227240] frame I:1824 Avg QP:18.39 size: 58244 [libx264 @ 0x556457227240] frame P:58915 Avg QP:21.45 size: 11731 [libx264 @ 0x556457227240] frame B:123687 Avg QP:24.96 size: 2862 [libx264 @ 0x556457227240] consecutive B-frames: 9.1% 3.0% 4.6% 83.3% [libx264 @ 0x556457227240] mb I I16..4: 26.9% 55.8% 17.3% [libx264 @ 0x556457227240] mb P I16..4: 3.1% 6.4% 0.6% P16..4: 27.6% 8.0% 4.6% 0.0% 0.0% skip:49.7% [libx264 @ 0x556457227240] mb B I16..4: 0.6% 0.8% 0.0% B16..8: 23.9% 1.8% 0.3% direct: 1.6% skip:71.1% L0:49.7% L1:46.3% BI: 4.0% [libx264 @ 0x556457227240] 8x8 transform intra:60.7% inter:80.2% [libx264 @ 0x556457227240] coded y,uvDC,uvAC intra: 45.0% 57.3% 22.7% inter: 8.2% 10.3% 0.6% [libx264 @ 0x556457227240] i16 v,h,dc,p: 33% 32% 13% 22% [libx264 @ 0x556457227240] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 22% 27% 3% 4% 5% 5% 4% 5% [libx264 @ 0x556457227240] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 26% 15% 4% 6% 6% 6% 5% 4% [libx264 @ 0x556457227240] i8c dc,h,v,p: 54% 22% 18% 6% [libx264 @ 0x556457227240] Weighted P-Frames: Y:3.3% UV:1.2% [libx264 @ 0x556457227240] ref P L0: 61.6% 14.1% 15.4% 8.6% 0.3% [libx264 @ 0x556457227240] ref B L0: 86.5% 9.8% 3.7% [libx264 @ 0x556457227240] ref B L1: 94.8% 5.2% [libx264 @ 0x556457227240] kb/s:1198.64 -Ulf
Am 15.10.23 um 15:12 schrieb Ulf Zibis:
by accident I transcoded a video with -preset veryfast (it took 1 h). So I had to run it again with -preset veryslow (it took 12 h). Now I'm wondering about the file sizes. How can that be?
why not? if you prefer fast you don't care about quality in doubt quality needs space and find a compromise between size and space - you can't have both - and well, depending on the source material fast can be small and good enough in quality
Am 15.10.23 um 15:43 schrieb Reindl Harald:
Am 15.10.23 um 15:12 schrieb Ulf Zibis:
by accident I transcoded a video with -preset veryfast (it took 1 h). So I had to run it again with -preset veryslow (it took 12 h). Now I'm wondering about the file sizes. How can that be?
why not?
if you prefer fast you don't care about quality
in doubt quality needs space and find a compromise between size and space - you can't have both - and well, depending on the source material fast can be small and good enough in quality
In my understanding quality also needs CPU time. See: https://trac.ffmpeg.org/wiki/Encode/H.264 There I can read: "for constant quality encoding, you will simply save bitrate by choosing a slower preset." As I used the same -crf value for all 3 runs, I'm still wondering, that I experienced the opposite. -Ulf
Am 15.10.23 um 16:43 schrieb Ulf Zibis:
Am 15.10.23 um 15:43 schrieb Reindl Harald:
Am 15.10.23 um 15:12 schrieb Ulf Zibis:
by accident I transcoded a video with -preset veryfast (it took 1 h). So I had to run it again with -preset veryslow (it took 12 h). Now I'm wondering about the file sizes. How can that be?
why not?
if you prefer fast you don't care about quality
in doubt quality needs space and find a compromise between size and space - you can't have both - and well, depending on the source material fast can be small and good enough in quality
In my understanding quality also needs CPU time
but with "veryfast" you statet "i do not care about quality" and losing details by not care about quality *can save* space - common sense
Am 15.10.23 um 16:52 schrieb Reindl Harald:
Am 15.10.23 um 16:43 schrieb Ulf Zibis:
Am 15.10.23 um 15:43 schrieb Reindl Harald:
if you prefer fast you don't care about quality
in doubt quality needs space and find a compromise between size and space - you can't have both - and well, depending on the source material fast can be small and good enough in quality
In my understanding quality also needs CPU time
but with "veryfast" you statet "i do not care about quality" and losing details by not care about quality *can save* space - common sense
Then the info in the Wiki must be wrong. With "veryfast" I stated to "not care about *space*", but with "-crf 23" I always stated "care about same quality". Interestingly with "veryfast" I needed less space than with "medium" or "veryslow". -Ulf
Am 15.10.23 um 17:20 schrieb Ulf Zibis:
Am 15.10.23 um 16:52 schrieb Reindl Harald:
Am 15.10.23 um 16:43 schrieb Ulf Zibis:
Am 15.10.23 um 15:43 schrieb Reindl Harald:
if you prefer fast you don't care about quality
in doubt quality needs space and find a compromise between size and space - you can't have both - and well, depending on the source material fast can be small and good enough in quality
In my understanding quality also needs CPU time
but with "veryfast" you statet "i do not care about quality" and losing details by not care about quality *can save* space - common sense
Then the info in the Wiki must be wrong
no
With "veryfast" I stated to "not care about *space*", but with "-crf 23" I always stated "care about same quality".
you statet "i don't care about anything but speed" you didn't state more or less is it really that hard to understand that depending on the input results differ *dramatically*? when you have a video with nearly no motion compression works far better it all depends on the input and what quality loss is acceptable and "verfyfast" simply don't care much about details - if the missing details make no visible difference for a specific input it saves space with a different input the saving may be less but more visible i really don't get why common sense won't lead to THE DIFFERNECE IS THE INPUT and what is acceptable as output break the same down to zip: use it for a video or a html-file guess what is more compressable
Interestingly with "veryfast" I needed less space than with "medium" or "veryslow" and with different input it may look the opposite
Am 15.10.23 um 17:51 schrieb Reindl Harald:
Am 15.10.23 um 17:20 schrieb Ulf Zibis:
With "veryfast" I stated to "not care about *space*", but with "-crf 23" I always stated "care about same quality".
you statet "i don't care about anything but speed" you didn't state more or less
Correct, but more speed requires to accept more space for the same video quality, in counterpart to "for constant quality encoding, you will simply save bitrate by choosing a slower preset". ..... which means "don't care about space".
is it really that hard to understand that depending on the input results differ *dramatically*? when you have a video with nearly no motion compression works far better
No problem to understand in case of different input, but in my case the input was identical the same for the 3 outputs, so I expect to "save bitrate by choosing a slower preset". This wasn't the case with the exactly identical input. I oppositely had more bitrate with a slower preset.
it all depends on the input and what quality loss is acceptable The quality loss was precisely stated by "-crf 23" for all 3 runs.
and "verfyfast" simply don't care much about details ... ... even if stating the level of details constantly by i.e. "-crf 23" ???
break the same down to zip: use it for a video or a html-file guess what is more compressable
I guess we better would compare zip with i.e. xz. For the same quality (here lossless) zip compresses faster than xz, but needs more space than xz. -Ulf
Am 15.10.23 um 22:56 schrieb Ulf Zibis:
Am 15.10.23 um 17:51 schrieb Reindl Harald:
is it really that hard to understand that depending on the input results differ *dramatically*? when you have a video with nearly no motion compression works far better
No problem to understand in case of different input, but in my case the input was identical the same for the 3 outputs
so the input was always the same - jesus christ *your damned inout video* could be an exception for whatever reason
Am 16.10.23 um 08:28 schrieb Reindl Harald:
so the input was always the same - jesus christ
So ok, you didn't see this because of the exhaustive cutting and concatenation, which was identical in all 3 cases.. My guess was, that this maybe irritates the correct processing of the codec. I.e. the libx264 level was 5 for the "veryslow" case, but 3.1 for the others, why? Is there a rule to choose different levels for different presets?
*your damned inout video* could be an exception for whatever reason
That clever is was already before ;-) -Ulf
participants (2)
-
Reindl Harald -
Ulf Zibis