Personal View site logo
Make sure to join PV on Telegram or Facebook! Perfect to keep up with community on your smartphone.
4K Downscaling progress topic
  • I couldn't find anything dedicated (and I may have missed something important) so: This is a topic dedicated solely for any kind of progress updates on software, code and methods to downscale 4k with best possible results to help people establish a workflow for converting 4k footage. Meanwhile, it may be a good idea to also map the best downscaling methods that already exist.

  • 99 Replies sorted by
  • I just want to add to my comment I made last year. I tried again doing the downsampling to 10 bit 1080p from 420 4k and I think I found where I went wrong.

    Basically I was getting blown out highlights which was what I was hoping to preserve. On linux the problem is if you display 10 bit video without any care (8 bit monitor) then the gamma preserved as if 8 bit and not adjusted and the highlights are just cut off. I redid my tests using the gpu output of mpv and it appears to take care of this problem.

  • Wonder if someone here can guide me or point me in the right direction of downscaling from 4k to 1080p 10bit in ffmpeg using a colour channel such as green into one of the 10bit formats in grayscale such as gray10le? As a side not in my experiments with ffmpeg I get nearly the same file sizes as in colour such as prores and yuv444. I was hoping using only one channel in grayscale would have some benefit in filesizes for editing.. Thank you in advance for any replies

  • @speedyrazor why are you changing the aspect ratio ? Try to resize to 720P first.

  • I have read this thread with great interest, as I have been trying endlessly to downscale HD to SD (1920x1080 to 720x576). I have achieved great results in every aspect accept in the gamma / chroma / color shift area, in which I either get a color shift or very small green blotches. This is what I am currently using, which is producing very small green blotches.

    ffmpeg -i /Users/myself/MOVS/source22.mov \ -map 0:v -vf colormatrix=bt709:bt601,scale=720:576:flags=lanczos \ -map 0:1 \ -map 0:2 \ -map 0:3 \ -map 0:4 \ -map 0:5 \ -map 0:6 \ -map 0:7 \ -map_channel 0.1.0:0.1 \ -map_channel 0.2.0:0.1 \ -map_channel 0.3.0:0.1 \ -map_channel 0.4.0:0.1 \ -map_channel 0.5.0:0.1 \ -map_channel 0.6.0:0.1 \ -vcodec prores_ks -profile:v 3 -vtag apcn -f mov -c:a pcm_s16le /Users/myself/MOVS/source22_Done.mov

  • An update to my posting above on realtime downscaling with mpv: If you use an mpv version newer than this change there is no more "cscale-down" option. Since cscale-down wasn't really important for the quality with yuv 4:2:0 source material, here's the modified option without it that works with both old and newer mpv versions:

    -vo=opengl:lscale-down=mitchell:lparam1=0.3:lparam2=0.3:scaler-resizes-only:fancy-downscaling:dither-depth=auto:fbo-format=rgba16
    
  • @LPowell: To top it off, when you try to register an account on the Infognition user support forum, it trolls you with an unintelligible verification image:

    http://forum.infognition.com/index.php?action=register

    If you are still interested, the answer is quite simple: if you step through that very complicated formula (no need to solve it, nor did I bother) you only see 4 digits, so there's your answer: 4.

    I've just registered.

  • Not realtime in pp2014.

  • Doh! It was actual 7z data in the .zip named file. :[ Reuploaded now, sorry.

  • WinZip can't open the downloaded GPUResize zip file...

  • Just checked - it's all there. Well, this zip was downloaded and used several times already =) Zip file contains plugin_mac and plugin_windows folders with plugin binaries for osx/win, you're expected to manually copy content into Ae/Pr (described in readme.txt file and pdf).

  • Your demo zip file is empty

  • Hi! I've read thru this topic and just thought to invite everyone to try our plugin for ae and premiere called GPUResize.

    You might consider it useful - it's really fast and it does gpu accelerated downscaling and upscaling using almost all actual algorithms, from nearest to convolution stuff like lanczos/kaiser. (I really hope that's ok to post such things here, Vitaliy?) Comments and suggestions are very welcome!

  • Wow @karl, great stuff!

  • You've seen my scripts for "offline" downscaling using ffmpeg earlier in this thread.

    Now today I've experimented quite a lot on how to achieve "live"/realtime downscaling while replaying 4k video on a 2k screen with very good quality. Using a software-scaler from ffmpeg is not an option for this use case, as it would simply be too slow.

    Configuring hardware scalers, as available in all current GPUs, is not quite as trivial as it may seem, because down-scaling a crisp 4k picture to 2k can easily cause visible aliasing/ringing artifacts in moving pictures. After many experiments, I found that the following setting, when used with an Intel GPU and the OpenGL driver, as available from the marvellous mpv player, provides for the best visible quality - crispy sharp pictures reasonably free of artifacts:

    -vo=opengl:lscale-down=mitchell:lparam1=0.3:lparam2=0.3:cscale-down=mitchell:cparam1=0.3:cparam2=0.3:scaler-resizes-only:fancy-downscaling:dither-depth=auto:fbo-format=rgba16
    

    What I do with these options in prose is telling the OpenGL driver to (only when down-scaling) use Mitchell-Netravali filtering with a balanced parametrization on both luma and chroma pixels, and with a destination pixel format that will retain as much information as possible. (The Alpha channel in the output is not strictly needed, but it seems that more drivers support RGB with Alpha channel than without.)

    Notice how above options are very different from the default options activated by choosing "-vo opengl-hq", which really don't look good when down-scaling 4k to 2k.

    Luckily, one can use the above options while still using hardware h.264 decoding and the scaling stuff is done by the GPU, so I end up with only ~5% CPU consumption when replaying a 4k video on the 2k screen of my laptop.

    (For more on the video output and scaler options available in mpv read on here.)

  • Just a Q&D "neutral" grade - no sharpening no nuthin' only @karl 's downscale script - of one shot in Paul Rean's video.
    Humble with the grade, the image could have stood some beating; where I came from that's called DR a tutti pleni folkios

  • Even when downscaling "only" from 1080 to 720p @karl script makes files hold on well while heavy grading... but to be completely honest couldn't notice much difference when downscaling after grading; visually looked same quality. It might also be the previous added tweaking to the workflow, je je. Anyway as much as I tried I couldn't make a service script inside automator to apply karl's ffmpeg settings from the finder contextual menu and batch folders. If anyone around knows how to batch in ffmpeg from a (mac) terminal and has a bit of patience, I'm tired of reading and just feel too dumb :P

    A little poopooza for closing =)

  • Still get error on windows ffmpeg (ffmpeg-20140808-git-d34ec64-win64-static)

    with output prores:

    [Parsed_mergeplanes_3 @ 0000000004a79a00] output plane 1 width 1920 does not mat ch input 1 plane 0 width 3840

    [Parsed_mergeplanes_3 @ 0000000004a79a00] Failed to configure output pad on Pars ed_mergeplanes_3

    with output dpx:

    Data stream not supported yet [only streamcopy]

  • @paglez i made the experience that GUI is not good here. And by the way (no offence): real men don't click! ;)

  • @hellrazor Thanks a lot. I wil try it, but...It's sound very complex.

  • @paglez Sorry. I am running a homebrew ffmpeg compile in OSX. 1. You need to find/compile ffmpeg with frei0r plugin enabled 2. You need to find the part in the GUI where you can put in the complex filter chain (-filter_complex) 3. set your output codec for video stream and tell ffmpeg through the GUI to copy audio and metadata stream

  • I only know to use ffmpeg with Avanti Gui. Please Hellrazor, could you explain me how to Add this script to ffmpeg vía Avanti Gui? Thank you so much

  • In case anyone is interested... Here is a script to defish, denoise and scale a 7,5mm Samyang Lens on GH4 UHD:

    ffmpeg -i "$1" \ -filter_complex 'extractplanes=y+u+v[y][u][v]; [u] scale=w=3840:h=2160:flags=print_info+neighbor+bitexact [us]; [v] scale=w=3840:h=2160:flags=print_info+neighbor+bitexact [vs]; [y][us][vs]mergeplanes=0x001020:yuv444p,format=pix_fmts=yuv444p10le,hqdn3d=3:3:5:5,frei0r=lenscorrection:0.5:0.5:0.16:0.6,scale=w=1920:h=1080:flags=print_info+bicubic+full_chroma_inp+full_chroma_int' \ -sws_dither none \ -q 0 -quant_mat hq \ -c:v prores_ks \ -profile:v 4 \ -c:a copy \ -c:s copy \ -c:d copy \ -map 0 \ "$2/$1"
  • @Karl thanks again for the help Karl! But i get an error message :Data strea enciding not supported (only stream copy) any idea? thanks

  • @karl @Lpowell Could you make a template to be able to load it into GUI ffmpeg as AVANTI?. Scripts language and similars its not friendly for newbies as me. Thanks a lot

  • @schprox: I think the differences you are seeing are not actually caused by ffmpeg and Thomas' software doing anything different with regards to averaging each 4 adjacent luma pixels - if that was the case, we should expect to see most differences in mid-tones, not in the highlights of the image.

    I think what you see is the difference of using (logarithmic) DPX as an output format versus using ProRes.

    If you want more comparable results, instruct ffmpeg to also output to individual DPX images:

    ffmpeg -i "input.mp4" -filter_complex "extractplanes=y+u+v[y][u][v]; [u] scale=w=3840:h=2160:flags=print_info+neighbor+bitexact [us]; [v] scale=w=3840:h=2160:flags=print_info+neighbor+bitexact [vs]; [y][us][vs]mergeplanes=0x001020:yuv444p,format=pix_fmts=yuv444p10le,scale=w=1920:h=1080:flags=print_info+bicubic+full_chroma_inp+full_chroma_int" -sws_dither none  -q 0 -map 0 "output%05d.dpx"
    

    (Notice the pattern "%05d" in the output name is relevant as ffmpeg will need to write one output image file per frame.)