Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ========================================================================================================
- ========================================================================================================
- Encoder ffvhuff [Huffyuv FFmpeg variant]:
- General capabilities: threads
- Threading capabilities: frame
- Supported pixel formats:
- yuv420p yuv422p yuv444p
- (implied 8-bit video; YV12/YV16*/YV24 planars)
- (* avoid ever using YUY2. Avisynth updated for YV16 in place of YUY2; as YUY2 requires resampling))
- yuv411p yuv410p yuv440p
- gbrp gbrp9le gbrp10le gbrp12le gbrp14le
- gray gray16le
- yuva420p yuva422p yuva444p
- gbrap
- ya8
- (rarely needed colorspaces; maybe just grayscale videos)
- ("le" is "Little Endian")
- (9-bit through 16-bit video; YV12/YV16*/YV24 planars)
- (* avoid ever using YUY2. Avisynth updated for YV16 in place of YUY2; as YUY2 requires resampling)
- yuv420p9le yuv420p10le yuv420p12le yuv420p14le yuv420p16le
- yuv422p9le yuv422p10le yuv422p12le yuv422p14le yuv422p16le
- yuv444p9le yuv444p10le yuv444p12le yuv444p14le yuv444p16le
- (Avisynth/L-SmashWorks works best with 10le or 16le if greater than 8-bit. Import xyz12le (12-bit) as 16-bit; does not increase quality, just maintains precision)
- yuva420p9le yuva420p10le yuva420p16le
- yuva422p9le yuva422p10le yuva422p16le
- yuva444p9le yuva444p10le yuva444p16le
- (alpha variants rarely needed)
- rgb24 bgra
- (bgra rarely needed)
- ffvhuff AVOptions:
- -non_deterministic <boolean> E..V.... Allow multithreading for e.g. context=1 at the expense of determinism (default true)
- -pred <int> E..V.... Prediction method (from 0 to 2) (default left)
- left E..V....
- plane E..V....
- median E..V....
- -context <int> E..V.... Set per-frame huffman tables (from 0 to 1) (default 0)
- ========================================================================================================
- ========================================================================================================
- FFMPEG usage example:
- "C:\Apps\VidEnc\ffmpeg_64\ffmpeg.exe" -stats -report -i "VIDEO.mxf" -map 0:0 -map_metadata -1 -pix_fmt yuv444p16le -vcodec ffvhuff "OUTPUT-ffvhuff-yuv444p16le.avi"
- ========================================================================================================
- FFProbe info on VIDEO.mxf (2K DCP)
- Stream #0:0: Video: jpeg2000 (JPEG 2000 digital cinema 2K), xyz12le, 1998x1080, SAR 1:1 DAR 37:20, 24 tbr, 24 tbn, 24 tbc
- xyz colorspace, 12-bit video, little endian
- ========================================================================================================
- ========================================================================================================
- FFMPEG correctly converts colorspace from XYZ to RGB or YUV planars.
- Stand-alone hardware players, YUV is most compatible, so use a YUV planar colorspace.
- XYZ -> RGB -> YV24
- But, YV24 is not very compatible, so YV12.
- XYZ -> RGB -> YV12
- in terms of quality...
- XYZ -> RGB -> YV24 -> YV16 -> YV12
- RGB and YV24 colorspaces would be for PC only, streaming untested.
- Resulting lossless .avi will be YV24 (4:4:4 chroma subsampling) and 16-bit video.
- Use L-SmashWorks to index and load video in Avisynth as 16-bit (set "stacked=true" to get actual high bit-depth).
- Use "Dither" package to crop and resize in (stacked, not interleaved) 16-bit processing and covnert to YV12 and dither down to 8-bit video.
- ========================================================================================================
- ========================================================================================================
- Avisynth script to load OUTPUT-ffvhuff-yuv444p16le.avi
- ========================================================================================================
- LoadPlugin ("D:\AVS\L-SMASH-Works\L-SMASH-Works-r875-20160202-32bit\AviSynth\LSMASHSource.dll")
- LWLibavVideoSource ("E:\Temp\LegoBatman\LegoBatmanMovie_TLR-ffvhuff-yuv444p16le.avi", stacked = true, format = "YUV444P16")
- #Trim(193,2184) # Frames with video data only
- Trim (191,2209) # Crop taking audio into consideration
- ### audio exceeds total number of frames with video data, black frames must be included to keep everything in sync
- Dither_Crop16 (0, 122, -0, -122)
- Dither_convert_yuv_to_rgb (lsb_in=true, matrix="709", noring=true, output="rgb48y", tv_range=false, chromak="spline36")
- ### Now it's in fancy new RGB colorspace **use just for dither package inside Avsiynth!**
- Dither_y_gamma_to_linear (tv_range_in=false, tv_range_out=false, curve="709", u=1, v=1, sigmoid=true)
- ### Now in linear light, I think Y8 colorspace. No chroma here
- #Dither_resize16nr (2048, 858, kernel="spline36", u=1, v=1) #2.387:1
- Dither_resize16nr (2048, 856, kernel="spline36", u=1, v=1) #2.393:1 ## Closest to 2.39:1 in modular 2 resize
- ### illegal resize using modular 1 to get 2028x857 for absolute 2.39:1 would require RGB conversion
- Dither_y_linear_to_gamma (tv_range_in=false, tv_range_out=false, curve="709", u=1, v=1, sigmoid=true)
- Dither_convert_rgb_to_yuv (
- \ SelectEvery (3, 0), SelectEvery (3, 1), SelectEvery (3, 2),
- \ matrix="709", noring=true, output="YV12", tv_range=false, chromak="spline36",
- \ lsb=true)
- DitherPost (mode=7)
- ========================================================================================================
- ========================================================================================================
- Before encoding with x264 [kMod - built by komisar], I saved the 8bit/YV12 to a lossless video using UtVideo Codec.
- When I go to encode the 10bit/YV24, I'll need to pipe directly from .avs script to x264.exe to transfer all data correctly.
- The extra step in making a 10-bit lossless intermediate is too much to bother with so encoding overnight for the 10-bit x264 encode from .avs is more sensible. The encoding fps rate will drop drastically. Less than .50fps for encoding.
- ========================================================================================================
- ========================================================================================================
- x264 batch script for the 8bit encode:
- "D:\AVS\avs4x26x\avs4x26x.exe" --x26x-binary "C:\Apps\VidEnc\x264_kMod\k8_64.exe" --log-file "E:\Work\Encodes\LegoBatmanMovie_TLR-8bit-YV12-2K-v2.txt" --log-file-level 2 --quiet --no-progress --demuxer raw --input-depth 8 --input-res 2048x856 --fps 24/1 --thread-input --threads 3 --crf 14 --preset placebo --profile high --level 4.1 --merange 32 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --input-csp i420 --output-csp i420 --no-dct-decimate --no-mbtree --no-mixed-refs --aq-strength 0.85 --deblock -3:-3 --aq-mode 3 -o "E:\Work\Encodes\LegoBatmanMovie_TLR-8bit-YV12-2K-v2.mkv" "D:\Temp\LegoBatmanMovie_TLR-8bit-YV12-2K.avs"
- increased crf to 14 since 2K. tried CRF=16 and there was banding
- increased merange to 32, since >1080
- added --no-dct-decimate
- added --no-mbtree (significantly reduces chances of banding during fading/dark scenes)
- added --no-mixed-refs
- removed --no-fast-pskip (as it is included in the "placebo" preset, otherwise add if less than "placebo")
- lowered default --aq-strength
- lowered default deblock
- used --aq-mode 3 (for more bias towards darker screens)
- Nearly transparent encode. Maybe tweak ip/pb ratios. Maybe try different --aq-strength values (0.6-.95; but not 1.0). Maybe increase CRF to 13.
- ========================================================================================================
- ========================================================================================================
- x264 r2556 kMod log:
- x264 [info]: 2048x856p 0:0 @ 24/1 fps (cfr)
- x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
- x264 [info]: profile High, level 4.1
- x264 [info]: cabac=1 ref=4 deblock=1:-3:-3 analyse=0x3:0x133 me=tesa subme=11 psy=1 fade_compensate=0.00 psy_rd=1.00:0.00 mixed_ref=0 me_range=32 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=0 interlaced=0 bluray_compat=0 constrained_intra=0 fgo=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=24 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=14.0000 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 pb_ratio=1.30 aq=3:0.85
- x264 [info]: frame I:20 Avg QP: 8.76 size:312321
- x264 [info]: frame P:415 Avg QP:11.32 size:181596
- x264 [info]: frame B:1584 Avg QP:12.89 size: 80600
- x264 [info]: consecutive B-frames: 3.1% 2.3% 6.7% 20.6% 14.1% 21.7% 7.6% 7.5% 4.0% 3.0% 1.1% 1.8% 1.3% 2.1% 1.5% 0.8% 0.8%
- x264 [info]: mb I I16..4: 11.2% 70.2% 18.6%
- x264 [info]: mb P I16..4: 1.4% 24.9% 3.2% P16..4: 22.0% 26.9% 11.6% 7.2% 0.8% skip: 2.0%
- x264 [info]: mb B I16..4: 0.2% 5.5% 0.3% B16..8: 27.2% 29.4% 10.9% direct:11.6% skip:14.8% L0:44.2% L1:43.2% BI:12.6%
- x264 [info]: 8x8 transform intra:85.8% inter:35.9%
- x264 [info]: direct mvs spatial:99.8% temporal:0.2%
- x264 [info]: coded y,uvDC,uvAC intra: 95.2% 97.6% 96.0% inter: 45.6% 52.8% 35.5%
- x264 [info]: i16 v,h,dc,p: 13% 9% 18% 60%
- x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 12% 16% 8% 9% 9% 9% 10% 13%
- x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 10% 8% 10% 13% 12% 12% 10% 13%
- x264 [info]: i8c dc,h,v,p: 51% 19% 14% 16%
- x264 [info]: Weighted P-Frames: Y:25.1% UV:23.9%
- x264 [info]: ref P L0: 48.0% 2.4% 26.0% 18.4% 5.0% 0.2%
- x264 [info]: ref B L0: 75.5% 19.7% 4.8%
- x264 [info]: ref B L1: 84.4% 15.6%
- x264 [info]: kb/s:19901.71
- x264 [info]: encoded 2019 frames, 1.15 fps, 19901.79 kb/s, duration 0:29:10.02
- ========================================================================================================
- https://ffmpeg.zeranoe.com/builds/
- http://avisynth.nl/index.php/LSMASHSource/LSMASHVideoSource
- http://avisynth.nl/index.php/Dither
- http://www.videohelp.com/software/Ut-Video-Codec-Suite
- http://forum.doom9.org/showthread.php?t=162656 (avs4x26x for piping 32-bit Avisynth script to 64-bit x264.exe)
- http://komisar.gin.by/ (for better x264 patches instead of vanilla builds with handbrake, etc)
Add Comment
Please, Sign In to add comment