Hello, I encoded 4k video with ffmpeg like this:
but when I trying play this video I see random artifacts.Code:ffmpeg -i orig.mp4 -preset placebo -c:a copy -c:v libx264 -crf 30 final.mkv
[Attachment 73653 - Click to enlarge]
Also I noticed this problem appears only on 4k videos (FullHD is okay) AND if playing with hardware acceleration (when stream decoding by Video Decode gpu block) AND only with placebo preset (veryslow and any another preset doesn't "produce" this artifacts), but if I play with software decoding, everything plays ok without any artifacts.
Thanks!
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 21 of 21
Thread
-
Last edited by olodar; 5th Sep 2023 at 13:35.
-
Try reducing b-frames to 8.
Code:ffmpeg -i orig.mp4 -preset placebo -c:a copy -c:v libx264 -crf 30 -x264opts bframes=8 final.mkv
-
Thanks for your answer! Unfortunately it's not help:
[Attachment 73664 - Click to enlarge] -
-
I thought that would be it. There are a few more differences between veryslow and placebo you can try changing:
Code:veryslow: cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 placebo: cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=tesa / subme=11 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=16 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
-
-
Sure - https://kazakhcloud.gsgt.ru/index.php/s/zs77fEqbqZM8K5T
Also, I was a little wrong, in fact, "placebo" and "veryslow" gives artifacts too. "slower" already encodes good. -
"Internal Server Error
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log." -
Excuse me, reup: https://kazakhcloud.gsgt.ru/index.php/s/pFJCGdzgWp4gk98
No, some artifacts are still appears. BTW, "x264opts" is deprecated, need use "x264-params" instead - https://trac.ffmpeg.org/wiki/Encode/H.264 "Warning: Do not use the option x264opts, as it will eventually be removed. Use x264-params instead.". -
-
I still haven't found solution. Those glitches (artifacts) appears with placebo > veryslow > slower presets. Slow and higher already ok. So, only workaround I have found is use x265 codec for 4k videos. For example, parameters -c:v libx265 -crf 36 -preset placebo offers very good quality (in my opinion). For FullHD videos x264 is still my favorite. However, x265 compression time much higher than x264:
Code:time ffmpeg -i VID_20220129_113412338.mp4 -preset placebo -crf 25 -c:a copy -c:v libx264 x264.mkv
user 424m23.824s
sys 0m15.119s
Code:time ffmpeg -i VID_20220129_113412338.mp4 -preset placebo -crf 30 -c:a copy -c:v libx265 x265.mkv
user 2307m57.016s
sys 0m10.698s
Diff in sizes:
84M x264.mkv
33M x265.mkv -
Then try reducing b-fframes to 3 and/or ref to 8. Other difference can be seen here:
Code:REM slower cabac=1 / ref=8 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 REM veryslow: cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 REM placebo: cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=tesa / subme=11 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=16 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Last edited by jagabo; 31st May 2024 at 11:54.
-
I don't have any artifacts.
Code:ffmpeg -i SGCAM_20230827_035840892.mp4 -preset placebo -crf 25 -c:a copy -c:v libx264 x264.mkv
-
Decoding the clip from rgr I see artifacts when cuda hardware decoding is used.
https://imgsli.com/MjY4NzE0
(side note: MPC HC switches to software coding for the clip)users currently on my ignore list: deadrats, Stears555 -
Yes, I tried to play with those parameters, didn't found what exactly affects.
[Attachment 79535 - Click to enlarge]
Yes, for some reason hardware decoders produces artifacts, while software decoders plays well. -
Hardware decoders don't support all possible h.264 parameters.
So far I've found that ffmpeg x264lib with preset=placebo, ref=5, trellis=1, and subme=8 plays properly with the SGCAM source in post #14 on my Nvidia RTX 4060 with VLC and hardware decoding.
Code:ffmpeg -i SGCAM_20230827_035840892.mp4 -c:a copy -c:v libx264 -preset placebo -x264opts ref=5:trellis=1:subme=8 x264.placebo+ref=5+trellis=1+subme=8.mp4
Last edited by jagabo; 31st May 2024 at 23:37.
Similar Threads
-
HEVC+ffmpeg = files with slower preset larger than media preset.
By rgr in forum Video ConversionReplies: 3Last Post: 17th Jun 2022, 13:24 -
Can I get preset info of encoded video?
By Anonymous543 in forum Newbie / General discussionsReplies: 1Last Post: 17th Jan 2022, 09:50 -
Does setting the ffmpeg -preset affect quality? Does Handbrake preset?
By LaserBones in forum Newbie / General discussionsReplies: 7Last Post: 15th Jul 2020, 12:01 -
Is the placebo preset necessary for good quality?
By SomeoneNeutral in forum RestorationReplies: 4Last Post: 24th Aug 2019, 14:00 -
Why x264 "placebo" preset produce bigger file than "very slow"?
By aleaksunder in forum Video ConversionReplies: 21Last Post: 2nd Mar 2019, 07:25