VideoHelp Forum
+ Reply to Thread
Results 1 to 21 of 21
Thread
  1. Hello, I encoded 4k video with ffmpeg like this:
    Code:
    ffmpeg -i orig.mp4 -preset placebo -c:a copy -c:v libx264 -crf 30 final.mkv
    but when I trying play this video I see random artifacts.
    Image
    [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!
    Last edited by olodar; 5th Sep 2023 at 13:35.
    Quote Quote  
  2. 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
    Quote Quote  
  3. Originally Posted by jagabo View Post
    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:
    Image
    [Attachment 73664 - Click to enlarge]
    Quote Quote  
  4. Originally Posted by olodar View Post
    ...but if I play with software decoding, everything plays ok without any artifacts.
    That means your problem isn't an encoding problem, but a playing problem.
    Forget hardware acceleration for 4k videos on your PC.
    Quote Quote  
  5. Originally Posted by olodar View Post
    Originally Posted by jagabo View Post
    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:
    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
    Or just use the veryslow preset. You won't see any difference anyway.
    Quote Quote  
  6. Originally Posted by ProWo View Post
    Originally Posted by olodar View Post
    ...but if I play with software decoding, everything plays ok without any artifacts.
    That means your problem isn't an encoding problem, but a playing problem.
    Forget hardware acceleration for 4k videos on your PC.
    I tried on different devices - smartphone, laptop, PC - everywhere with hardware decoding artifacts appears. Besides, there's no artifacts with any other preset, this problem only with placebo preset.
    Quote Quote  
  7. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Can you attach the problematic fragment?
    Quote Quote  
  8. Originally Posted by rgr View Post
    Can you attach the problematic fragment?
    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.
    Quote Quote  
  9. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Originally Posted by olodar View Post
    Originally Posted by rgr View Post
    Can you attach the problematic fragment?
    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."
    Quote Quote  
  10. Originally Posted by olodar View Post
    I was a little wrong, in fact, "placebo" and "veryslow" gives artifacts too. "slower" already encodes good.
    In that case try setting bframes=3 and ref=8.
    Quote Quote  
  11. Originally Posted by rgr View Post
    Originally Posted by olodar View Post
    Originally Posted by rgr View Post
    Can you attach the problematic fragment?
    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

    Originally Posted by jagabo View Post
    Originally Posted by olodar View Post
    I was a little wrong, in fact, "placebo" and "veryslow" gives artifacts too. "slower" already encodes good.
    In that case try setting bframes=3 and ref=8.
    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.".
    Quote Quote  
  12. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Originally Posted by olodar View Post
    Originally Posted by rgr View Post
    Originally Posted by olodar View Post
    Originally Posted by rgr View Post
    Can you attach the problematic fragment?
    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
    Download doesn't work -- just nothing happens...
    Quote Quote  
  13. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    I was able download it on my phone using Firefox/uBlock origin
    Quote Quote  
  14. Originally Posted by rgr View Post
    Originally Posted by olodar View Post
    Originally Posted by rgr View Post
    Originally Posted by olodar View Post
    Originally Posted by rgr View Post
    Can you attach the problematic fragment?
    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
    Download doesn't work -- just nothing happens...
    Try direct link then - https://kazakhcloud.gsgt.ru/index.php/s/pFJCGdzgWp4gk98/download/SGCAM_20230827_035840892.mp4
    Quote Quote  
  15. 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
    real 36m40.473s
    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
    real 198m33.424s
    user 2307m57.016s
    sys 0m10.698s

    Diff in sizes:
    84M x264.mkv
    33M x265.mkv
    Quote Quote  
  16. Originally Posted by olodar View Post
    I was a little wrong, in fact, "placebo" and "veryslow" gives artifacts too. "slower" already encodes good.
    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.
    Quote Quote  
  17. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    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
    Image Attached Files
    Quote Quote  
  18. 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
    Quote Quote  
  19. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Yes indeed. I thought MPC-HC did hardware decoding. Why so? However, it does not load the CPU much, I see that VLC loads the graphics processor more.
    Quote Quote  
  20. Originally Posted by jagabo View Post
    Originally Posted by olodar View Post
    I was a little wrong, in fact, "placebo" and "veryslow" gives artifacts too. "slower" already encodes good.
    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
    Yes, I tried to play with those parameters, didn't found what exactly affects.

    Originally Posted by rgr View Post
    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
    Image
    [Attachment 79535 - Click to enlarge]


    Originally Posted by Selur View Post
    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)
    Yes, for some reason hardware decoders produces artifacts, while software decoders plays well.
    Quote Quote  
  21. 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
    Leaving any one of those modifiers out leads to playback errors, especially trellis. By the way the default values when using preset placebo are ref=16, trellis=2, and subme=11.
    Image Attached Files
    Last edited by jagabo; 31st May 2024 at 23:37.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!