View Full Version : Best way to decode HEVC 4K HDR streams ?
Nico8583
12th April 2019, 17:47
Hi,
I would like to recode some HEVC streams (container M2TS/MKV or raw/demuxed HEVC) but I would like to know if AviSynth is still the best tool to do that ? If yes, what plugin do you use to decode it ? If no, could you give me another tool ?
Thank you !
Blue_MiSfit
12th April 2019, 18:29
No, AviSynth isn't a great choice for HEVC. Use it if you must, but the high frame sizes typically associated with HEVC don't mesh well with 32 bit single threaded AviSynth :)
ffmpeg is a very frequently used tool for HEVC processing.
Nico8583
13th April 2019, 18:28
Thank you ! And decoding and encoding with FFMpeg is also a great choice ?
FranceBB
13th April 2019, 22:30
If speed isn't your main concern, you can use MP_Pipeline to split a filterchain in Avisynth 32bit or even pipe it to the 64bit version.
what plugin do you use to decode it ?
FFMpegSource2 is fine, but remember that you are indexing an HDR stream which is gonna be in BT2100 with a special color curve (either PQ or HLG).
What's your target? Do you wanna encode it to HDR and just reduce the file size? Do you wanna encode it to SDR?
'cause in that case, you may wanna take a look at the tone-mapping algorithms available for Avisynth with HDRTools or at my LUTs.
Nico8583
14th April 2019, 08:55
Thank you, my goal is just to reduce the file size.
FranceBB
14th April 2019, 21:58
Then, yes, if you wanna leave it as it is without changing anything, you can just use FFMpegSource2 to index the video and audio tracks and then use avs4x265 http://avisynth.nl/index.php/Avs4x265 to pipe the uncompressed AV stream to x265 to encode, just make sure you use the right flag about color space, nits and curve in x265 when dealing with HDR contents. As to the audio, just use your preferred encoder to pipe Avisynth to it. I generally use NeroAAC to make AAC files.
As to the muxing, I suggest you mkvmerge to make an mkv, but nothing stops you from making an mp4 with HEVC inside, just keep in mind that mp4box won't let you do it and some players might (or might not) read it.
(If you want an example I can share my BAT)
Blue_MiSfit
15th April 2019, 01:24
Why deal with AviSynth just to transcode HEVC to a lower bitrate? This is dramatically easier and faster if you just use ffmpeg.
Also, mp4 containing hevc is absolutely positively bog standard. It's used everywhere.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.