[FFmpeg-user] Text and icons in video appears blurry after converting from rgb to yuv420p
Bolik Bom
bolikbom at mail.com
Thu Jun 21 23:26:43 EEST 2018
Hello everyone,
I have recorded my screen with some recording software, and encoded the video as lossless h.264, rgb.
I've saved the file as "source_lossless_rgb.mp4", and then lossy encoded it:
ffmpeg -i source_lossless_rgb.mp4 -c:v libx264rgb rgb.mp4
And I've created another lossy version, in yuv420p format:
ffmpeg -i source_lossless_rgb.mp4 -c:v libx264 -pix_fmt yuv420p yuv420p.mp4
When playing the two videos using Media Player Classic / VLC,
text and icons in the yuv420 video are a little blurry.
Is it possible to create an exact translation from rgb to yuv420,
so no blur will be introduced?
Here is the link for the videos. The video is 3 seconds long, and has very small frame,
the total size of the three videos is 50k:
https://www.dropbox.com/s/8x6k1eeq0g16g0h/videos.zip?dl=0
(at the top right corner of the screen, click on 'download')
You have to play them in their actual size in order to see that the rgb video is sharp,
so you can compare it to the yuv video.
Linked files:
1. source_lossless_rgb.mp4 - The source file to be encoded.
2. rgb.mp4 - A lossy encoding (crf=23) of the source file, keeping the RGB color space.
3. yuv420p.mp4 - A lossy encoding (crf=23) of the source file, converting the color space to yuv420p.
And here are the logs:
Log for the rgb video: ----------------------------------------------------------------
ffmpeg -i source_lossless_rgb.mp4 -c:v libx264rgb rgb.mp4
ffmpeg version N-91314-gbd47cca6a7 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 20.102 / 58. 20.102
libavformat 58. 17.100 / 58. 17.100
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 25.100 / 7. 25.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'source_lossless_rgb.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.17.100
Duration: 00:00:03.03, start: 0.000000, bitrate: 58 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, gbr/unknown/unknown), 452x176, 55 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264rgb))
Press [q] to stop, [?] for help
[libx264rgb @ 0000020894f4bd80] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
[libx264rgb @ 0000020894f4bd80] profile High 4:4:4 Predictive, level 1.3, 4:4:4 8-bit
[libx264rgb @ 0000020894f4bd80] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html[https://deref-mail.com/mail/client/vn9SOCO7rZg/dereferrer/?redirectUrl=http%3A%2F%2Fwww.videolan.org%2Fx264.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=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=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 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'rgb.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.17.100
Stream #0:0(und): Video: h264 (libx264rgb) (avc1 / 0x31637661), rgb24, 452x176, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.20.102 libx264rgb
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 91 fps=0.0 q=-1.0 Lsize= 15kB time=00:00:02.93 bitrate= 41.5kbits/s speed=8.18x
video:13kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 14.538473%
[libx264rgb @ 0000020894f4bd80] frame I:1 Avg QP:19.88 size: 10907
[libx264rgb @ 0000020894f4bd80] frame P:23 Avg QP:26.18 size: 33
[libx264rgb @ 0000020894f4bd80] frame B:67 Avg QP:29.67 size: 14
[libx264rgb @ 0000020894f4bd80] consecutive B-frames: 1.1% 2.2% 0.0% 96.7%
[libx264rgb @ 0000020894f4bd80] mb I I16..4: 63.0% 0.0% 37.0%
[libx264rgb @ 0000020894f4bd80] mb P I16..4: 0.1% 0.0% 0.0% P16..4: 0.6% 0.0% 0.0% 0.0% 0.0% skip:99.2%
[libx264rgb @ 0000020894f4bd80] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.2% 0.0% 0.0% direct: 0.0% skip:99.8% L0: 2.4% L1:97.6% BI: 0.0%
[libx264rgb @ 0000020894f4bd80] coded y,u,v intra: 18.4% 18.8% 22.1% inter: 0.0% 0.0% 0.0%
[libx264rgb @ 0000020894f4bd80] i16 v,h,dc,p: 42% 58% 0% 0%
[libx264rgb @ 0000020894f4bd80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 40% 9% 2% 2% 3% 2% 3% 2%
[libx264rgb @ 0000020894f4bd80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264rgb @ 0000020894f4bd80] ref P L0: 55.3% 6.4% 36.2% 2.1%
[libx264rgb @ 0000020894f4bd80] ref B L0: 0.0% 100.0%
[libx264rgb @ 0000020894f4bd80] ref B L1: 90.2% 9.8%
[libx264rgb @ 0000020894f4bd80] kb/s:33.21
Log for the yuv420 video: -----------------------------------------------------------
ffmpeg -i source_lossless_rgb.mp4 -c:v libx264 -pix_fmt yuv420p yuv420p.mp4
ffmpeg version N-91314-gbd47cca6a7 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 20.102 / 58. 20.102
libavformat 58. 17.100 / 58. 17.100
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 25.100 / 7. 25.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'source_lossless_rgb.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.17.100
Duration: 00:00:03.03, start: 0.000000, bitrate: 58 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, gbr/unknown/unknown), 452x176, 55 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 000002e4bb74bd40] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
[libx264 @ 000002e4bb74bd40] profile High, level 1.3
[libx264 @ 000002e4bb74bd40] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html[https://deref-mail.com/mail/client/vn9SOCO7rZg/dereferrer/?redirectUrl=http%3A%2F%2Fwww.videolan.org%2Fx264.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=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 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'yuv420p.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.17.100
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 452x176, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.20.102 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 91 fps=0.0 q=-1.0 Lsize= 9kB time=00:00:02.93 bitrate= 26.0kbits/s speed=9.21x
video:7kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 25.401844%
[libx264 @ 000002e4bb74bd40] frame I:1 Avg QP:18.41 size: 5334
[libx264 @ 000002e4bb74bd40] frame P:23 Avg QP:23.47 size: 24
[libx264 @ 000002e4bb74bd40] frame B:67 Avg QP:27.67 size: 15
[libx264 @ 000002e4bb74bd40] consecutive B-frames: 1.1% 2.2% 0.0% 96.7%
[libx264 @ 000002e4bb74bd40] mb I I16..4: 64.3% 5.6% 30.1%
[libx264 @ 000002e4bb74bd40] mb P I16..4: 0.0% 0.1% 0.0% P16..4: 0.1% 0.0% 0.0% 0.0% 0.0% skip:99.8%
[libx264 @ 000002e4bb74bd40] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.3% 0.0% 0.0% direct: 0.0% skip:99.7% L0:67.1% L1:32.9% BI: 0.0%
[libx264 @ 000002e4bb74bd40] 8x8 transform intra:7.4% inter:50.0%
[libx264 @ 000002e4bb74bd40] coded y,uvDC,uvAC intra: 21.9% 24.0% 23.7% inter: 0.0% 0.0% 0.0%
[libx264 @ 000002e4bb74bd40] i16 v,h,dc,p: 24% 76% 0% 0%
[libx264 @ 000002e4bb74bd40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 66% 6% 25% 0% 2% 0% 1% 0% 0%
[libx264 @ 000002e4bb74bd40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 29% 12% 2% 2% 4% 3% 4% 3%
[libx264 @ 000002e4bb74bd40] i8c dc,h,v,p: 53% 34% 12% 1%
[libx264 @ 000002e4bb74bd40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000002e4bb74bd40] ref P L0: 83.3% 8.3% 8.3%
[libx264 @ 000002e4bb74bd40] ref B L0: 6.4% 93.6%
[libx264 @ 000002e4bb74bd40] ref B L1: 91.3% 8.7%
[libx264 @ 000002e4bb74bd40] kb/s:18.20
-------------------------------------------------------------------------------------------------
Thanks for any help.
More information about the ffmpeg-user
mailing list