High bit-depth Support with Avisynth

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(Image Magick)
m (Processing High Bit-depth Video with AviSynth: redirect flash3kyuu_deband to wiki page)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
Currently, Avisynth only supports 8-bit video.  Nevertheless, through various utilities, plugins, and scripts, Avisynth can be used to import, process, and export high bit-depth video.  There has been some effort to update Avisynth itself to support high bit-depth, but there has been no progress as of 2012 (http://forum.doom9.org/showthread.php?t=162436).
+
<div style="max-width:62em" >
<br>
+
Currently, Avisynth (not AvisynthPlus) only supports 8-bit video.  Nevertheless, through various utilities, plugins, and scripts, Avisynth can be used to import, process, and export high bit-depth video.  There has been some effort to update Avisynth itself to support high bit-depth, but there has been no progress as of 2012 (http://forum.doom9.org/showthread.php?t=162436).
<br>
+
</div>
 +
 
 
== What is Deep Color? ==
 
== What is Deep Color? ==
 +
<div style="max-width:62em" >
 +
Deep Color refers to using more than 8 bits of data to represent each color channel.  It is also referred to as high bit-depth color.  Basically, deep color allows finer graduations of color, smoother gradients and more detail. Please refer to this short, easy to understand article:  [http://www.pcworld.com/article/171223/what_is_10bit_color.html PCWorld: What is 10-bit Color?]
 +
</div>
  
Deepcolor refers to using more than 8 bits of data to represent each color channel.  It is also referred to as high bit-depth color.  Basically, deepcolor/high bit-depth allows finer graduations of color, allowing smoother gradients and more detail.  Please refer to this short, easy to understand article:  [http://www.pcworld.com/article/171223/what_is_10bit_color.html PCWorld: What is 10-bit Color?]
 
<br>
 
<br>
 
  
 
== Why Use Deep Color? ==
 
== Why Use Deep Color? ==
 
+
<div style="max-width:62em" >
 
*Higher internal precision, using high-bit depth color, when processing an image in a filter, gives a higher quality (8-bit) output.
 
*Higher internal precision, using high-bit depth color, when processing an image in a filter, gives a higher quality (8-bit) output.
 
*If a video filter uses linear gamma internally, there can be noticeable differences in the image.  A linear gamma representation is best supported with a high bit-depth. See the illustration for [http://int64.org/projects/resamplehq/ ResampleHQ].
 
*If a video filter uses linear gamma internally, there can be noticeable differences in the image.  A linear gamma representation is best supported with a high bit-depth. See the illustration for [http://int64.org/projects/resamplehq/ ResampleHQ].
Line 18: Line 19:
 
**[http://x264.nl/x264/10bit_01-ateme_pierre_larbier_422_10-bit.pdf Using 10-bit AVC/H.264 Encoding with 4:2:2 for Broadcast Contribution.pdf]
 
**[http://x264.nl/x264/10bit_01-ateme_pierre_larbier_422_10-bit.pdf Using 10-bit AVC/H.264 Encoding with 4:2:2 for Broadcast Contribution.pdf]
 
**[http://x264.nl/x264/10bit_03-422_10_bit_pristine_video_quality.pdf Keeping Video Quality Pristine throughout the Production Process: 4:2:2 10-bit AVC/H.264 encoding.pdf]
 
**[http://x264.nl/x264/10bit_03-422_10_bit_pristine_video_quality.pdf Keeping Video Quality Pristine throughout the Production Process: 4:2:2 10-bit AVC/H.264 encoding.pdf]
 +
</div>
 +
 +
 +
== AviSynth+ Native Deep Color Support ==
 +
<div style="max-width:62em" >
 +
Since [https://github.com/pinterf/AviSynthPlus/releases/tag/r2290-MT r2290] (October 2016), {{AvsPluscon}} supports deep color &ndash; 10, 12, 14, 16 and 32-bit (floating point) RGB &amp; YUV color spaces. All AVS+ color spaces are listed [[Avisynthplus_color_formats|here]]. Support functions include [[ConvertBits]], [[ConvertStacked]], [[Extract]] and [[CombinePlanes]]. Deep color support has also been added to all [[Internal_filters|internal filters]] and many [[AviSynth%2B_x64_plugins|external plugins]].
 +
 +
'''''This feature greatly simplifies use of deep color and could make much of the information below obsolete.'''''
 +
 +
See the [[AviSynth%2B|AviSynth+ main page]] for more information.
 +
</div>
  
<br>
 
  
 
== Importing High Bit-depth Video into AviSynth ==
 
== Importing High Bit-depth Video into AviSynth ==
 +
<div style="max-width:62em" >
 
For importing high bit depth video [http://sourceforge.net/projects/avisynth2/ AviSynth 2.6.0] or greater is strongly recommended. AviSynth 2.6 adds the additional [[planar]] color spaces ([[Y8]],[[YV16]],[[YV24]], [[YV411]]) which makes it that much more compatible with all of the existing formats.  
 
For importing high bit depth video [http://sourceforge.net/projects/avisynth2/ AviSynth 2.6.0] or greater is strongly recommended. AviSynth 2.6 adds the additional [[planar]] color spaces ([[Y8]],[[YV16]],[[YV24]], [[YV411]]) which makes it that much more compatible with all of the existing formats.  
<br>
+
 
<br>
+
 
=== [[FFmpegSource|FFMS2]] ===
 
=== [[FFmpegSource|FFMS2]] ===
 
'''Patched FFMS2''' - import DNxHD, ProRes, and other 10-bit videos in their native format (4:2:2 and 4:4:4 are also supported), output greater than 8-bits will always be in the [[Stack16]] format.
 
'''Patched FFMS2''' - import DNxHD, ProRes, and other 10-bit videos in their native format (4:2:2 and 4:4:4 are also supported), output greater than 8-bits will always be in the [[Stack16]] format.
Line 33: Line 44:
 
==== Download ====
 
==== Download ====
 
Updated binaries: March 15, 2015 | [http://www.mediafire.com/folder/2izh9abzep52o/Video_works older versions]
 
Updated binaries: March 15, 2015 | [http://www.mediafire.com/folder/2izh9abzep52o/Video_works older versions]
* <code>[http://www.nmm-hd.org/upload/get~t6gq8DWihBs/ffms2-6e0d654+a9fe004-ffmbc-FFmbc-0.7.1.7z ffms2-6e0d654+a9fe004-ffmbc-FFmbc-0.7.1.7z]</code> | [http://web.archive.org/web/20150321005059/https://www.nmm-hd.org/upload/get~t6gq8DWihBs/ffms2-6e0d654+a9fe004-ffmbc-FFmbc-0.7.1.7z mirror] - This version uses [http://code.google.com/p/ffmbc/ FFmbc] as a decoder; may have better support for professional video formats like ProRes, DNxHD, etc.
+
* [http://www.nmm-hd.org/upload/get~t6gq8DWihBs/ffms2-6e0d654+a9fe004-ffmbc-FFmbc-0.7.1.7z ffms2-6e0d654+a9fe004-ffmbc-FFmbc-0.7.1.7z] | [http://web.archive.org/web/20150321005059/https://www.nmm-hd.org/upload/get~t6gq8DWihBs/ffms2-6e0d654+a9fe004-ffmbc-FFmbc-0.7.1.7z mirror] - This version uses [http://code.google.com/p/ffmbc/ FFmbc] as a decoder; may have better support for professional video formats like ProRes, DNxHD, etc.
* <code>[http://www.nmm-hd.org/upload/get~BLsLZwgj5ps/ffms2-6e0d654+a9fe004-ffmpeg-1e4d049.7z ffms2-6e0d654+a9fe004-ffmpeg-1e4d049.7z]</code> | [http://web.archive.org/web/20150321005255/https://www.nmm-hd.org/upload/get~BLsLZwgj5ps/ffms2-6e0d654+a9fe004-ffmpeg-1e4d049.7z mirror] - This version uses [http://en.wikipedia.org/wiki/FFmpeg FFmpeg] as a decoder; may be better for general (more common) formats.
+
* [http://www.nmm-hd.org/upload/get~BLsLZwgj5ps/ffms2-6e0d654+a9fe004-ffmpeg-1e4d049.7z ffms2-6e0d654+a9fe004-ffmpeg-1e4d049.7z] | [http://web.archive.org/web/20150321005255/https://www.nmm-hd.org/upload/get~BLsLZwgj5ps/ffms2-6e0d654+a9fe004-ffmpeg-1e4d049.7z mirror] - This version uses [http://en.wikipedia.org/wiki/FFmpeg FFmpeg] as a decoder; may be better for general (more common) formats.
* <code>[http://www.nmm-hd.org/upload/get~Q4mZfV9y0Og/ffms2-6e0d654+a9fe004-libav-9a60b1f.7z ffms2-6e0d654+a9fe004-libav-9a60b1f.7z]</code> | [http://web.archive.org/web/20150321005339/https://www.nmm-hd.org/upload/get~Q4mZfV9y0Og/ffms2-6e0d654+a9fe004-libav-9a60b1f.7z mirror] - This version uses [http://en.wikipedia.org/wiki/Libav Libav] as a decoder; may be better for general (more common) formats.
+
* [http://www.nmm-hd.org/upload/get~Q4mZfV9y0Og/ffms2-6e0d654+a9fe004-libav-9a60b1f.7z ffms2-6e0d654+a9fe004-libav-9a60b1f.7z] | [http://web.archive.org/web/20150321005339/https://www.nmm-hd.org/upload/get~Q4mZfV9y0Og/ffms2-6e0d654+a9fe004-libav-9a60b1f.7z mirror] - This version uses [http://en.wikipedia.org/wiki/Libav Libav] as a decoder; may be better for general (more common) formats.
These versions work just like the official [[FFmpegSource|FFMS2]], but includes the additional {{FuncDef3|enable10bithack}} parameter and support for the additional [[planar]] colorspaces available is AviSynth 2.6. <br/>By default {{FuncDef3|enable10bithack}} is set to false so it will work just like the official FFMS2; to import high bit depth video set {{FuncDef3|enable10bithack}}<tt>=true</tt>, output will be in the [[Stack16]] format.<br/>
+
 
 +
These versions work just like the official [[FFmpegSource|FFMS2]], but includes the additional {{FuncDef3|enable10bithack}} parameter and support for the additional [[planar]] colorspaces available is AviSynth 2.6.  
 +
By default {{FuncDef3|enable10bithack}} is set to false so it will work just like the official FFMS2; to import high bit depth video set {{FuncDef3|enable10bithack}}<code>=true</code>, output will be in the [[Stack16]] format.
 
See [http://github.com/mpv-player/mpv/wiki/FFmpeg-versus-Libav FFmpeg versus Libav] for information on pros and cons and differences between the FFmpeg and Libav.<br/>
 
See [http://github.com/mpv-player/mpv/wiki/FFmpeg-versus-Libav FFmpeg versus Libav] for information on pros and cons and differences between the FFmpeg and Libav.<br/>
 
<!--===== Archived Downloads =====
 
<!--===== Archived Downloads =====
Line 43: Line 56:
 
<code>[http://www.nmm-hd.org/upload/get~3O9tHZ9TJIM/ffms2-9417b9c-libav-aca2510.7z ffms2-9417b9c-libav-aca2510.7z]</code>
 
<code>[http://www.nmm-hd.org/upload/get~3O9tHZ9TJIM/ffms2-9417b9c-libav-aca2510.7z ffms2-9417b9c-libav-aca2510.7z]</code>
 
-->
 
-->
<br>
 
  
 
=== [[LSMASHSource]] ===
 
=== [[LSMASHSource]] ===
Line 49: Line 61:
 
*[[LSMASHSource/LSMASHVideoSource|LSMASHVideoSource]] - This function uses [http://en.wikipedia.org/wiki/Libavcodec#Implemented_video_codecs libavcodec] as a video decoder and [http://github.com/l-smash/l-smash L-SMASH] as a demuxer. Recommended for MP4, MOV, [http://en.wikipedia.org/wiki/ISO_base_media_file_format ISO Base Media] and its derived file formats.<br/>
 
*[[LSMASHSource/LSMASHVideoSource|LSMASHVideoSource]] - This function uses [http://en.wikipedia.org/wiki/Libavcodec#Implemented_video_codecs libavcodec] as a video decoder and [http://github.com/l-smash/l-smash L-SMASH] as a demuxer. Recommended for MP4, MOV, [http://en.wikipedia.org/wiki/ISO_base_media_file_format ISO Base Media] and its derived file formats.<br/>
 
*[[LSMASHSource/LWLibavVideoSource|LWLibavVideoSource]] - This function uses [http://en.wikipedia.org/wiki/Libavcodec#Implemented_video_codecs libavcodec] as a video decoder and [http://www.ffmpeg.org/libavformat.html libavformat] as a demuxer.<br/>
 
*[[LSMASHSource/LWLibavVideoSource|LWLibavVideoSource]] - This function uses [http://en.wikipedia.org/wiki/Libavcodec#Implemented_video_codecs libavcodec] as a video decoder and [http://www.ffmpeg.org/libavformat.html libavformat] as a demuxer.<br/>
<br>
+
 
 
=== [[VapourSource]] ===
 
=== [[VapourSource]] ===
Can be used to import [http://www.vapoursynth.com/ VapourSynth] scripts into AviSynth. Video can be 8-bit or greater.<br/>
+
Can be used to import [http://www.vapoursynth.com/ VapourSynth] scripts into AviSynth. Video can be 8-bit or greater.
<br>
+
 
 +
=== ImageMagick ===
 +
You can also import video or still via 16-bit PNG format pictures with the following [http://www.imagemagick.org/ ImageMagick] command lines. 
  
=== [[Image Magick]] ===
+
Examples shown are for Windows. Requires the 16-bit version of ImageMagick; get it [http://www.imagemagick.org/script/binary-releases.php#windows here] (look for downloads with ''Q16'' in the file name)
You can also import video or still via 16-bit PNG format pictures with the following Image Magick command lines (examples shown for Windows, requires the 16-bit version of Image Magick found at http://www.imagemagick.org/script/bi...es.php#windows, the file ImageMagick-x.y.z-a-Q16-x64)
+
  
Convert 16-bit to stacked (high/low or stack16 format):
+
*Convert 16-bit to [[Stack16]] (high/low or stack16 format):<div {{BoxWidthIndent|60|1}} >
<pre>
+
convert 16bit.png -depth 16 ( +clone -evaluate and 255 -evaluate multiply 256 )  
convert 16bit.png -depth 16 ( +clone -evaluate and 255 -evaluate multiply 256 ) -append stacked.png
+
        -append stacked.png
</pre>
+
</div><div style="max-width:62em" >
  
convert stacked (high/low) to 16bit:
+
*Convert Stack16 (high/low) to 16bit:<div {{BoxWidthIndent|60|1}} >
<pre>
+
convert stacked.png -depth 16 -crop 100%x50% ( +clone -evaluate divide 256 )  
convert stacked.png -depth 16 -crop 100%x50% ( +clone -evaluate divide 256 ) -delete 1 -compose Add -composite -define png:bit-depth=16 16bit1.png
+
        -delete 1 -compose Add -composite -define png:bit-depth=16 16bit1.png
</pre>
+
</div>
  
For further explanation of these command lines, please see the thread http://forum.doom9.org/showthread.php?t=172846
+
For further explanation of these command lines, please see the thread [http://forum.doom9.org/showthread.php?t=172846 ''Image Magick and stacked high bit-depth''] (doom9.org)
  
 
=== Obsolete ===  
 
=== Obsolete ===  
Line 83: Line 96:
  
 
*[http://forum.doom9.org/showthread.php?t=162598&page=2 RawSource with ffmpeg]  - shows an example of using ffmpeg to convert to a 16bit format which can be read by RawSource in Avisynth 2.6.
 
*[http://forum.doom9.org/showthread.php?t=162598&page=2 RawSource with ffmpeg]  - shows an example of using ffmpeg to convert to a 16bit format which can be read by RawSource in Avisynth 2.6.
<br>
+
</div>
  
== Processing High Bit-depth Video with AviSynth ==
 
  
 +
== Processing High Bit-depth Video with AviSynth ==
 +
<div style="max-width:62em" >
 
Some plugins support processing internally in a higher bit-depth for better quality and return an 8-bit video.  Others support full high-bit processing and can retun a special format 16 bit video.
 
Some plugins support processing internally in a higher bit-depth for better quality and return an 8-bit video.  Others support full high-bit processing and can retun a special format 16 bit video.
  
Line 93: Line 107:
 
* Multipurpose
 
* Multipurpose
 
**'''[[Dither_tools|Dither]]''' - A set of scripts, original and modified plugins to process 16-bit clips. Some of the functions include 16-bit color space conversion, debanding, denoising, resizing, and dithering 16-bit to lower bit depths.
 
**'''[[Dither_tools|Dither]]''' - A set of scripts, original and modified plugins to process 16-bit clips. Some of the functions include 16-bit color space conversion, debanding, denoising, resizing, and dithering 16-bit to lower bit depths.
**'''[http://github.com/tp7/CLExpr/releases CLExpr]''' - OpenCl plugin for runtime calculation of expressions on 8 and 16-bit depths clips. Makes mt_lutxy and mt_lutxyz possible on 16-bit. More information [http://forum.doom9.org/showpost.php?p=1672638 here].
+
**'''[[CLExpr]]''' - OpenCl plugin for runtime calculation of expressions on 8 and 16-bit depths clips. Makes mt_lutxy and mt_lutxyz possible on 16-bit.
**'''[http://forum.doom9.org/showthread.php?t=154971 SmoothAdjust]''' - High quality YUV color adjustment plugin. SmoothAdjust can input and output 16-bits; all calculations are internally done in 32-bit float to avoid rounding errors and artifacts.
+
**'''[[SmoothAdjust]]''' - High quality YUV color adjustment plugin. SmoothAdjust can input and output 16-bits; all calculations are internally done in 32-bit float to avoid rounding errors and artifacts.
  
 
* Antialiasing
 
* Antialiasing
 
**'''[[Xaa]]''' - anti-aliasing and resizing script.
 
**'''[[Xaa]]''' - anti-aliasing and resizing script.
 +
 +
* Color Correction
 +
** '''[[AutoAdjust]]''' - Automatic color adjustment plugin.
 +
** '''[http://www.snovidenie.com/plugins/hdr/ HDRMatrix]''' - Bt.601-Bt.709 conversion and RGB color correction filter, see [http://forum.doom9.org/showthread.php?t=172189&page=2#post1756038 discussion].
  
 
* Debanding
 
* Debanding
**'''[http://forum.doom9.org/showthread.php?t=161411 flash3kyuu_deband]''' - Debanding filter with 8/16 bit input/output. In addition flash3kyuu_deband can be used to dither 16-bit to lower bit depths.  
+
**'''[[f3kdb|flash3kyuu_deband]]''' - Debanding filter with 8/16 bit input/output. In addition flash3kyuu_deband can be used to dither 16-bit to lower bit depths.  
  
 
* Degraining
 
* Degraining
Line 108: Line 126:
 
**'''[http://forum.doom9.org/showthread.php?t=162342 DenoiseMD]''' - 8/16-bit denoise.
 
**'''[http://forum.doom9.org/showthread.php?t=162342 DenoiseMD]''' - 8/16-bit denoise.
 
**'''[[Dfttest]]''' - 8/16-bit 2D/3D frequency domain denoiser.
 
**'''[[Dfttest]]''' - 8/16-bit 2D/3D frequency domain denoiser.
**'''[http://forum.doom9.org/showthread.php?t=171379 KNLMeansCL]''' - OpenCL based Non Local Means denoising with support for 16-bit input and output.
+
**'''[[KNLMeansCL]]''' - OpenCL based Non Local Means denoising with support for 16-bit input and output.
**'''[http://forum.doom9.org/showthread.php?t=163018 RedAverage]''' - 16-bit capable average with masking. Download latest version [http://chaosking.de/wp-content/uploads/avsfilters/Unclassified/RedAverage___(1.4.3_-_2011-12-02).7z here]
+
**'''[[SMDegrainMod]]''' - 8/16 bit denoising with additional features like sharpening. [http://web.archive.org/web/20131210170708/http://doom10.org/index.php?topic=2178.0 Original Doom10 archived page.]
**'''[http://forum.videohelp.com/threads/369142-Simple-MDegrain-Mod-v2-2d-A-Quality-Denoising-Solution SMDegrainMod]''' - 8/16 bit denoising with additional features like sharpening. [http://web.archive.org/web/20131210170708/http://doom10.org/index.php?topic=2178.0 Original Doom10 archived page.]
+
**'''[[TempLinearApproximate]]''' - 8/16 bit filter for temporal linear approximation between pixels . Meant mainly for denoising aid in motion compensated clips.
**'''[http://forum.doom9.org/showthread.php?t=167032 TempLinearApproximate]''' - 8/16 bit filter for temporal linear approximation between pixels . Meant mainly for denoising aid in motion compensated clips.
+
**'''[http://forum.doom9.org/showthread.php?t=172966 xNLMeans]''' - Implementation of the Non Local Means denoising algorithm, as described by Buades et al. Includes support for 16-bit input and output.
  
 
* Deringing
 
* Deringing
Line 118: Line 136:
 
* Effects
 
* Effects
 
**'''[[f3kgrain]]''' - Luma adaptive grain generator with 8/16-bit input and output.
 
**'''[[f3kgrain]]''' - Luma adaptive grain generator with 8/16-bit input and output.
 +
**[http://www.snovidenie.com/plugins/hdr/ HDRNoise] - Random noise and film grain library, see [http://forum.doom9.org/showthread.php?t=172189&page=2#post1756038 discussion.]
  
 
* Frame Averaging
 
* Frame Averaging
 
**'''[http://forum.doom9.org/showpost.php?p=1579509 AvgAll_16]''' - Average all frames in a clip with 16-bit accuracy.
 
**'''[http://forum.doom9.org/showpost.php?p=1579509 AvgAll_16]''' - Average all frames in a clip with 16-bit accuracy.
**'''[http://forum.doom9.org/showthread.php?t=168048 ClipBlend16]''' - Blend an specified amount of frames into a single frame with 16-bit accuracy.  
+
**'''[[ClipBlend16]]''' - Blend an specified amount of frames into a single frame with 16-bit accuracy.
 +
**'''[[RedAverage]]''' - 16-bit capable average with masking.
 
 
 
* Resizing
 
* Resizing
Line 127: Line 147:
 
**'''[[Debilinear]]''' - This filter is designed to reverse the effects of bilinear upsampling. 8/16-bit input and output.     
 
**'''[[Debilinear]]''' - This filter is designed to reverse the effects of bilinear upsampling. 8/16-bit input and output.     
 
**'''[[nnedi3_resize16]]''' - An advanced script for high quality image resizing and colorspace conversion. It supports 16-bit input and output.
 
**'''[[nnedi3_resize16]]''' - An advanced script for high quality image resizing and colorspace conversion. It supports 16-bit input and output.
**'''[http://svn.int64.org/viewvc/int64/resamplehq/doc/index.html ResampleHQ]''' - Provides gamma-aware resizing and color space conversion.  Uses 32-bit linear color internally but input and output is limited to 8-bit.
+
**'''[[ResampleHQ]]''' - Provides gamma-aware resizing and color space conversion.  Uses 32-bit linear color internally but input and output is limited to 8-bit.
 
**'''[http://forum.videohelp.com/threads/369143-ResizersPack-MasksPack-PlaygroundPack-SmoothContrast-Logo-mod-functions?p=2364056 Resizers Functions Pack]''' - Includes LinearResize(), a function to resize in linear space. 8/16-bit input/output. [http://web.archive.org/web/20141105135234/http://doom10.org/index.php?topic=2182.0 Original Doom10 archived page.]
 
**'''[http://forum.videohelp.com/threads/369143-ResizersPack-MasksPack-PlaygroundPack-SmoothContrast-Logo-mod-functions?p=2364056 Resizers Functions Pack]''' - Includes LinearResize(), a function to resize in linear space. 8/16-bit input/output. [http://web.archive.org/web/20141105135234/http://doom10.org/index.php?topic=2182.0 Original Doom10 archived page.]
 +
 +
* Support
 +
**'''[http://www.snovidenie.com/plugins/hdr/ HDRCore]''' - Basic YUV bitdepth and range conversion filters, see [http://forum.doom9.org/showthread.php?t=172189 discussion].
  
 
* Deprecated
 
* Deprecated
 
**'''[http://forum.doom9.org/showthread.php?p=1467907#post1467907 Deep Color Tools]''' - This Script provides basic functions to import 10bit video, do color adjustments, and export to 8bit. (NOT RECOMMENDED, THERE ARE BETTER ALTERNATIVES)
 
**'''[http://forum.doom9.org/showthread.php?p=1467907#post1467907 Deep Color Tools]''' - This Script provides basic functions to import 10bit video, do color adjustments, and export to 8bit. (NOT RECOMMENDED, THERE ARE BETTER ALTERNATIVES)
 
  
 
You can also check the [[External_filters#Deepcolor_Filters|External Filters: DeepColor]] section, and the [[:Category:Deep_color_tools|Deep Color Tools]] category for possibly more listings.
 
You can also check the [[External_filters#Deepcolor_Filters|External Filters: DeepColor]] section, and the [[:Category:Deep_color_tools|Deep Color Tools]] category for possibly more listings.
<br>
+
</div>
<br>
+
  
 
== Codecs which support high bit-depth ==
 
== Codecs which support high bit-depth ==
 
+
<div style="max-width:62em" >
 
*[http://en.wikipedia.org/wiki/Animation_codec Apple Animation]
 
*[http://en.wikipedia.org/wiki/Animation_codec Apple Animation]
  
Line 155: Line 176:
  
 
*[http://azfcpug.org/wp-content/uploads/2011/02/Digital%20Video%20Acquisition%20Codecs.pdf Digital Video Acquisition Codecs.pdf] [http://web.archive.org/web/20141021023458/http://azfcpug.org/wp-content/uploads/2011/02/Digital%20Video%20Acquisition%20Codecs.pdf mirror]
 
*[http://azfcpug.org/wp-content/uploads/2011/02/Digital%20Video%20Acquisition%20Codecs.pdf Digital Video Acquisition Codecs.pdf] [http://web.archive.org/web/20141021023458/http://azfcpug.org/wp-content/uploads/2011/02/Digital%20Video%20Acquisition%20Codecs.pdf mirror]
<br>
+
</div>
 +
 
 +
 
 
== Exporting High Bit-depth Video ==
 
== Exporting High Bit-depth Video ==
 
+
<div style="max-width:62em" >
 
You can encode out of AviSynth to 10bit x264 via
 
You can encode out of AviSynth to 10bit x264 via
  
*[http://tmod.nmm-hd.org/x264/ x264-tMod] - A modification to the x264 encoder to enable various enhancements, especially for the use of high-bit depth input.  Supports the AviSynth high bit-depth convention, quality enhancements, bit-depth conversion, filters such as denoising and deinterlacing.<br>10bit x264 command-line example:<br/><pre>avs2yuv -raw "script.avs" -o - | x264-10bit --demuxer raw --input-depth 10 --input-res 1280x720 --fps 24 --output "out.mp4" -</pre>
+
*[http://tmod.nmm-hd.org/x264/ x264-tMod] - A modification to the x264 encoder to enable various enhancements, especially for the use of high-bit depth input.  Supports the AviSynth high bit-depth convention, quality enhancements, bit-depth conversion, filters such as denoising and deinterlacing.
 +
 
 +
10bit x264 command-line example:<div {{BoxWidthIndent|60|1}} >
 +
avs2yuv -raw "script.avs" -o - | x264-10bit --demuxer raw --input-depth 10  
 +
        --input-res 1280x720 --fps 24 --output "out.mp4" -
 +
</div>
  
 
*[[Avs2YUV]]
 
*[[Avs2YUV]]
Line 166: Line 194:
 
*[[avs2pipemod]]
 
*[[avs2pipemod]]
  
*[[avs4x264mod]] - This command-line tool will directly convert from a high bit-depth convention Avisynth script to H.264 with x264, including the 10bit profile.  Please check the [http://astrataro.wordpress.com/category/encode/x264/avs4x26x/ blog] for updated versions.<br>Example:<br/><pre>avs4x264mod.exe --x264-binary “C:\x264_64-abc.exe” -o out.264 in.avs</pre>
+
*[[avs4x264mod]] - This command-line tool will directly convert from a high bit-depth convention Avisynth script to H.264 with x264, including the 10bit profile.  Please check the [http://astrataro.wordpress.com/category/encode/x264/avs4x26x/ blog] for updated versions.
<br>
+
 
 +
Example:<div {{BoxWidthIndent|60|1}} >
 +
avs4x264mod.exe --x264-binary “C:\x264_64-abc.exe” -o out.264 in.avs
 +
</div>
 +
 
 
Some tutorials on exporting high bit depth image sequences:
 
Some tutorials on exporting high bit depth image sequences:
 
*[http://web.archive.org/web/20130914191039/http://blendervse.wordpress.com/2011/09/16/8bit-video-to-16bit-scene-referred-linear-exrs/ 8-bit video to 16-bit Scene Referred Linear .EXR’s]
 
*[http://web.archive.org/web/20130914191039/http://blendervse.wordpress.com/2011/09/16/8bit-video-to-16bit-scene-referred-linear-exrs/ 8-bit video to 16-bit Scene Referred Linear .EXR’s]
 
*[http://web.archive.org/web/20131112191047/http://blendervse.wordpress.com/2013/03/23/pipe-to-rgb-quick-how-to/ Pipe To RGB – Quick How To]
 
*[http://web.archive.org/web/20131112191047/http://blendervse.wordpress.com/2013/03/23/pipe-to-rgb-quick-how-to/ Pipe To RGB – Quick How To]
 
*[http://web.archive.org/web/20131009105710/http://blendervse.wordpress.com/2013/03/12/pipe-to-rgb-avspmod-to-imagemagick/ Pipe To RGB – AvsPmod To ImageMagick]
 
*[http://web.archive.org/web/20131009105710/http://blendervse.wordpress.com/2013/03/12/pipe-to-rgb-avspmod-to-imagemagick/ Pipe To RGB – AvsPmod To ImageMagick]
<br>
+
</div>
 +
 
 +
 
 
== Playback of High Bit-depth Videos ==
 
== Playback of High Bit-depth Videos ==
 +
<div style="max-width:62em" >
 
*Most of the time you will only get to see dithered 8-bit video, as equipment to truly display high bit-depths is not as common at the consumer level in 2014 ([http://4ktvblog.com/10-bit-monitor list of 10-bit monitors]).
 
*Most of the time you will only get to see dithered 8-bit video, as equipment to truly display high bit-depths is not as common at the consumer level in 2014 ([http://4ktvblog.com/10-bit-monitor list of 10-bit monitors]).
  
Line 180: Line 215:
 
*Digital theaters project up to 12-bit video; for more information read the wiki article: [http://en.wikipedia.org/wiki/Digital_Cinema_Initiatives#Image_and_audio_capability_overview Digital Cinema Initiatives]
 
*Digital theaters project up to 12-bit video; for more information read the wiki article: [http://en.wikipedia.org/wiki/Digital_Cinema_Initiatives#Image_and_audio_capability_overview Digital Cinema Initiatives]
  
 
+
=====Playback Software=====
'''Playback Software'''
+
  
 
*[http://forum.doom9.org/showthread.php?t=146228 MadVR]
 
*[http://forum.doom9.org/showthread.php?t=146228 MadVR]
Line 191: Line 225:
 
*[http://www.videolan.org VLC]
 
*[http://www.videolan.org VLC]
  
 
+
=====Other Software and Information=====
'''Other Software and Information'''
+
  
 
*[http://forum.doom9.org/showthread.php?t=161548 Further information on high-bit playback]
 
*[http://forum.doom9.org/showthread.php?t=161548 Further information on high-bit playback]
Line 199: Line 232:
  
 
*[http://forum.doom9.org/showthread.php?t=161915 FFdshow builds with 10-bit support] (deprecated)
 
*[http://forum.doom9.org/showthread.php?t=161915 FFdshow builds with 10-bit support] (deprecated)
<br>
+
</div>
  
== Sample High Bit-Depth Videos ==
 
  
 +
== Sample High Bit-Depth Videos ==
 +
<div style="max-width:62em" >
 
See this thread for links to examples.  There are also deepcolor versions of standard test clips (used in image processing research).  http://forum.doom9.org/showthread.php?t=158836&highlight=v210
 
See this thread for links to examples.  There are also deepcolor versions of standard test clips (used in image processing research).  http://forum.doom9.org/showthread.php?t=158836&highlight=v210
  
 
todo add: piping RGB48 data from avs2yuv and export 16bit image sequences in either .tif or .exr preferably using ImageMagick: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=18943 or .jp2 image sequences http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=24718
 
todo add: piping RGB48 data from avs2yuv and export 16bit image sequences in either .tif or .exr preferably using ImageMagick: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=18943 or .jp2 image sequences http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=24718
 +
</div>
  
 
[[Category:Advanced topics]]
 
[[Category:Advanced topics]]
 +
[[Category:Deep_color_tools]]

Latest revision as of 06:42, 13 October 2020

Contents

[edit] Introduction

Currently, Avisynth (not AvisynthPlus) only supports 8-bit video. Nevertheless, through various utilities, plugins, and scripts, Avisynth can be used to import, process, and export high bit-depth video. There has been some effort to update Avisynth itself to support high bit-depth, but there has been no progress as of 2012 (http://forum.doom9.org/showthread.php?t=162436).

[edit] What is Deep Color?

Deep Color refers to using more than 8 bits of data to represent each color channel. It is also referred to as high bit-depth color. Basically, deep color allows finer graduations of color, smoother gradients and more detail. Please refer to this short, easy to understand article: PCWorld: What is 10-bit Color?


[edit] Why Use Deep Color?


[edit] AviSynth+ Native Deep Color Support

Since r2290 (October 2016), AVS+ supports deep color – 10, 12, 14, 16 and 32-bit (floating point) RGB & YUV color spaces. All AVS+ color spaces are listed here. Support functions include ConvertBits, ConvertStacked, Extract and CombinePlanes. Deep color support has also been added to all internal filters and many external plugins.

This feature greatly simplifies use of deep color and could make much of the information below obsolete.

See the AviSynth+ main page for more information.


[edit] Importing High Bit-depth Video into AviSynth

For importing high bit depth video AviSynth 2.6.0 or greater is strongly recommended. AviSynth 2.6 adds the additional planar color spaces (Y8,YV16,YV24, YV411) which makes it that much more compatible with all of the existing formats.

[edit] FFMS2

Patched FFMS2 - import DNxHD, ProRes, and other 10-bit videos in their native format (4:2:2 and 4:4:4 are also supported), output greater than 8-bits will always be in the Stack16 format.

[edit] Download

Updated binaries: March 15, 2015 | older versions

These versions work just like the official FFMS2, but includes the additional enable10bithack parameter and support for the additional planar colorspaces available is AviSynth 2.6. By default enable10bithack is set to false so it will work just like the official FFMS2; to import high bit depth video set enable10bithack=true, output will be in the Stack16 format. See FFmpeg versus Libav for information on pros and cons and differences between the FFmpeg and Libav.

[edit] LSMASHSource

Another source filter to import regular 8-bit and high bit depth video. LSMASHSource includes these 2 fuctions to import video:

[edit] VapourSource

Can be used to import VapourSynth scripts into AviSynth. Video can be 8-bit or greater.

[edit] ImageMagick

You can also import video or still via 16-bit PNG format pictures with the following ImageMagick command lines.

Examples shown are for Windows. Requires the 16-bit version of ImageMagick; get it here (look for downloads with Q16 in the file name)

  • Convert 16-bit to Stack16 (high/low or stack16 format):
convert 16bit.png -depth 16 ( +clone -evaluate and 255 -evaluate multiply 256 ) 
        -append stacked.png
  • Convert Stack16 (high/low) to 16bit:
convert stacked.png -depth 16 -crop 100%x50% ( +clone -evaluate divide 256 ) 
        -delete 1 -compose Add -composite -define png:bit-depth=16 16bit1.png

For further explanation of these command lines, please see the thread Image Magick and stacked high bit-depth (doom9.org)

[edit] Obsolete

The following methods are obsolete! If you must, only use as a verification or as workaround:

  • Readv210mod - Can read uncompressed v210 in .mov container as color. Needs a manual setting skip the file header.
  • Sashimi - Sashimi 0.85 has different bit-depth support. Please see OtherFormats/Read_v210.avs included in the package.
  • ReadV210 - Can read uncompressed v210 in .mov container as greyscale.


Alternative builds and methods of importing (also obsolete):

  • ffms2mod - Can return most 10bit video in the Avisynth high bit-depth convention.
  • RawSource with ffmpeg - shows an example of using ffmpeg to convert to a 16bit format which can be read by RawSource in Avisynth 2.6.


[edit] Processing High Bit-depth Video with AviSynth

Some plugins support processing internally in a higher bit-depth for better quality and return an 8-bit video. Others support full high-bit processing and can retun a special format 16 bit video.

Most developers have adopted a vertically stacked format known as Stack16, where the high bits (MSB) are stored in the upper half of a video, and the lower bits (LSB) in the lower half of the video.
This special format must be processed only with high-bit aware scripts and plugins.

  • Multipurpose
    • Dither - A set of scripts, original and modified plugins to process 16-bit clips. Some of the functions include 16-bit color space conversion, debanding, denoising, resizing, and dithering 16-bit to lower bit depths.
    • CLExpr - OpenCl plugin for runtime calculation of expressions on 8 and 16-bit depths clips. Makes mt_lutxy and mt_lutxyz possible on 16-bit.
    • SmoothAdjust - High quality YUV color adjustment plugin. SmoothAdjust can input and output 16-bits; all calculations are internally done in 32-bit float to avoid rounding errors and artifacts.
  • Antialiasing
    • Xaa - anti-aliasing and resizing script.
  • Color Correction
  • Debanding
    • flash3kyuu_deband - Debanding filter with 8/16 bit input/output. In addition flash3kyuu_deband can be used to dither 16-bit to lower bit depths.
  • Degraining
    • SMDegrain - mvtools+mdegrain denoising with 16-bit input and output.
  • Denoising
    • DenoiseMD - 8/16-bit denoise.
    • Dfttest - 8/16-bit 2D/3D frequency domain denoiser.
    • KNLMeansCL - OpenCL based Non Local Means denoising with support for 16-bit input and output.
    • SMDegrainMod - 8/16 bit denoising with additional features like sharpening. Original Doom10 archived page.
    • TempLinearApproximate - 8/16 bit filter for temporal linear approximation between pixels . Meant mainly for denoising aid in motion compensated clips.
    • xNLMeans - Implementation of the Non Local Means denoising algorithm, as described by Buades et al. Includes support for 16-bit input and output.
  • Deringing
    • HQDeringMod - Deringing script with 16-bit input and output.
  • Effects
    • f3kgrain - Luma adaptive grain generator with 8/16-bit input and output.
    • HDRNoise - Random noise and film grain library, see discussion.
  • Frame Averaging
    • AvgAll_16 - Average all frames in a clip with 16-bit accuracy.
    • ClipBlend16 - Blend an specified amount of frames into a single frame with 16-bit accuracy.
    • RedAverage - 16-bit capable average with masking.
  • Resizing
    • Debicubic - This filter is designed to reverse the effects of bicubic upsampling. 8/16-bit input and output.
    • Debilinear - This filter is designed to reverse the effects of bilinear upsampling. 8/16-bit input and output.
    • nnedi3_resize16 - An advanced script for high quality image resizing and colorspace conversion. It supports 16-bit input and output.
    • ResampleHQ - Provides gamma-aware resizing and color space conversion. Uses 32-bit linear color internally but input and output is limited to 8-bit.
    • Resizers Functions Pack - Includes LinearResize(), a function to resize in linear space. 8/16-bit input/output. Original Doom10 archived page.
  • Deprecated
    • Deep Color Tools - This Script provides basic functions to import 10bit video, do color adjustments, and export to 8bit. (NOT RECOMMENDED, THERE ARE BETTER ALTERNATIVES)

You can also check the External Filters: DeepColor section, and the Deep Color Tools category for possibly more listings.

[edit] Codecs which support high bit-depth

  • H.264 - 10-bit YUV 4:2:0/4:2:2/4:4:4 available via x264 (lossy/lossless compression supported).
  • HEVC - 10-bit YUV 4:2:0/4:2:2/4:4:4 available via x265 (lossy/lossless compression supported).


[edit] Exporting High Bit-depth Video

You can encode out of AviSynth to 10bit x264 via

  • x264-tMod - A modification to the x264 encoder to enable various enhancements, especially for the use of high-bit depth input. Supports the AviSynth high bit-depth convention, quality enhancements, bit-depth conversion, filters such as denoising and deinterlacing.
10bit x264 command-line example:
avs2yuv -raw "script.avs" -o - | x264-10bit --demuxer raw --input-depth 10 
        --input-res 1280x720 --fps 24 --output "out.mp4" -
  • avs4x264mod - This command-line tool will directly convert from a high bit-depth convention Avisynth script to H.264 with x264, including the 10bit profile. Please check the blog for updated versions.
Example:
avs4x264mod.exe --x264-binary “C:\x264_64-abc.exe” -o out.264 in.avs

Some tutorials on exporting high bit depth image sequences:


[edit] Playback of High Bit-depth Videos

  • Most of the time you will only get to see dithered 8-bit video, as equipment to truly display high bit-depths is not as common at the consumer level in 2014 (list of 10-bit monitors).
  • The Blu-ray standard does not support high bit-depth video nor xvYCC color space (full-range 8 bit video). On September 2014 it was announced that the up-and-coming 4k Blu-ray standard will support 10-bit video and a greater color gamut by using the Rec. 2020 color space.
[edit] Playback Software
[edit] Other Software and Information


[edit] Sample High Bit-Depth Videos

See this thread for links to examples. There are also deepcolor versions of standard test clips (used in image processing research). http://forum.doom9.org/showthread.php?t=158836&highlight=v210

todo add: piping RGB48 data from avs2yuv and export 16bit image sequences in either .tif or .exr preferably using ImageMagick: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=18943 or .jp2 image sequences http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=24718

Views
Personal tools
Navigation
community
in other languages
Tools