ScreenRecorder icon indicating copy to clipboard operation
ScreenRecorder copied to clipboard

[Feature Request]Use 4:4:4 chroma sampling whenever possible.

Open sebma opened this issue 2 years ago • 0 comments

Hi,

When doing screen recording with ffmpeg on my PC with the x11grab input device, ffmpeg automatically selects the following x264 options, these maybe more appropriate when it comes to screen recording :

$ set -x;screenRecordNoAudio dummy.mp4 -y;set +x
++ xrandr
++ awk '/\*/{print$1}'
+ /usr/local/bin/ffmpeg -hide_banner -video_size 1600x900 -framerate 15 -f x11grab -i :0.0 dummy.mp4 -y
[x11grab @ 0x6257d80] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1637887331.468317, bitrate: 691200 kb/s
  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1600x900, 691200 kb/s, 15 fps, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x62661c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX BMI1 SlowPshufb
[libx264 @ 0x62661c0] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit
[libx264 @ 0x62661c0] 264 - core 164 r3075 66a5bc1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - 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=4 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=15 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 'dummy.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv444p(tv, progressive), 1600x900, q=2-31, 15 fps, 15360 tbn
    Metadata:
      encoder         : Lavc58.134.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=  723 fps= 14 q=-1.0 Lsize=    3951kB time=00:00:48.00 bitrate= 674.3kbits/s dup=640 drop=3 speed=0.939x    
video:3942kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.235951%
[libx264 @ 0x62661c0] frame I:6     Avg QP:13.98  size:195808
[libx264 @ 0x62661c0] frame P:189   Avg QP:18.65  size: 14786
[libx264 @ 0x62661c0] frame B:528   Avg QP:30.47  size:   126
[libx264 @ 0x62661c0] consecutive B-frames:  2.5%  0.3%  0.4% 96.8%
[libx264 @ 0x62661c0] mb I  I16..4: 29.7% 41.6% 28.8%
[libx264 @ 0x62661c0] mb P  I16..4:  0.2%  1.4%  1.0%  P16..4:  5.0%  0.5%  0.6%  0.0%  0.0%    skip:91.3%
[libx264 @ 0x62661c0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  1.7%  0.0%  0.0%  direct: 0.0%  skip:98.2%  L0:21.1% L1:78.5% BI: 0.4%
[libx264 @ 0x62661c0] 8x8 transform intra:47.3% inter:69.7%
[libx264 @ 0x62661c0] coded y,u,v intra: 49.5% 39.0% 37.2% inter: 0.9% 0.6% 0.6%
[libx264 @ 0x62661c0] i16 v,h,dc,p: 70% 23%  4%  2%
[libx264 @ 0x62661c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 27% 13%  3%  3%  3%  4%  3%  5%
[libx264 @ 0x62661c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 28% 11%  5%  7%  6%  8%  6%  9%
[libx264 @ 0x62661c0] Weighted P-Frames: Y:1.1% UV:1.1%
[libx264 @ 0x62661c0] ref P L0: 60.6%  7.4% 24.9%  7.0%  0.1%
[libx264 @ 0x62661c0] ref B L0: 85.3% 13.6%  1.1%
[libx264 @ 0x62661c0] ref B L1: 81.9% 18.1%
[libx264 @ 0x62661c0] kb/s:669.83

real	0m51.313s
user	1m48.130s
sys	0m3.104s
+ set +x
$ mediainfo dummy.mp4
General
Complete name                            : dummy.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 3.86 MiB
Duration                                 : 48 s 200 ms
Overall bit rate                         : 672 kb/s
Writing application                      : Lavf58.76.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High 4:4:4 Predictive@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 48 s 200 ms
Bit rate                                 : 670 kb/s
Width                                    : 1 600 pixels
Height                                   : 900 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 15.000 FPS
Chroma subsampling                       : 4:4:4
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.031
Stream size                              : 3.85 MiB (100%)
Writing library                          : x264 core 164 r3075 66a5bc1
Encoding settings                        : 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=4 / 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=15 / 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
Codec configuration box                  : avcC

$ mediainfo dummy.mp4 | egrep "profile|Chroma|Encoding.settings"
Format profile                           : Base Media
Format profile                           : High 4:4:4 Predictive@L4
Chroma subsampling                       : 4:4:4
Encoding settings                        : 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=4 / 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=15 / 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
$

sebma avatar Nov 26 '21 00:11 sebma