Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st October 2021, 09:03   #8321  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Hi there,
I always forget who's maintaining those: http://msystem.waw.pl/x265/

but... can I ask for an AVX-512 Windows x64 build?
FranceBB is offline   Reply With Quote
Old 1st October 2021, 10:40   #8322  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Afaik all builds supports AVX512, but you have to enable it explicitly (using --avx512 option). And it benefits only in 4k encodes, so it's not really useful for common user.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 1st October 2021, 11:34   #8323  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Quote:
Originally Posted by DJATOM View Post
Afaik all builds supports AVX512, but you have to enable it explicitly (using --avx512 option). And it benefits only in 4k encodes, so it's not really useful for common user.
Ah so that's why it's not using them by default, I have to specify it from the command line, got it, now I remember, it's:

--asm=avx512

sometimes I learn something and that pushes out something else I already knew xD
FranceBB is offline   Reply With Quote
Old 1st October 2021, 17:39   #8324  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
New issue: why are 2 pools being created (56 + 56 = 112) but only 1 CPU (56) is used?

https://i.imgur.com/eWyQo1R.png

Code:
#Indexing the HDR10 PQ BT2100 4:2:2 10bit planar source
video=FFVideoSource("\\10.64.6.11\avisynth\Scambio\WARNER_MOVIES\BatmanBegins\HDR\BATMANBEGINS_INTL_UHD_HDR_PQ_REC2020_2398_240_PR4444_ITA51_ITA20_EN51_EN20-20210508155521.mov")
ch1=FFAudioSource("\\10.64.6.11\avisynth\Scambio\WARNER_MOVIES\BatmanBegins\HDR\BATMANBEGINS_INTL_UHD_HDR_PQ_REC2020_2398_240_PR4444_ITA51_ITA20_EN51_EN20-20210508155521.mov", track=1)
ch2=FFAudioSource("\\10.64.6.11\avisynth\Scambio\WARNER_MOVIES\BatmanBegins\HDR\BATMANBEGINS_INTL_UHD_HDR_PQ_REC2020_2398_240_PR4444_ITA51_ITA20_EN51_EN20-20210508155521.mov", track=2)
ch3=FFAudioSource("\\10.64.6.11\avisynth\Scambio\WARNER_MOVIES\BatmanBegins\HDR\BATMANBEGINS_INTL_UHD_HDR_PQ_REC2020_2398_240_PR4444_ITA51_ITA20_EN51_EN20-20210508155521.mov", track=3)
ch4=FFAudioSource("\\10.64.6.11\avisynth\Scambio\WARNER_MOVIES\BatmanBegins\HDR\BATMANBEGINS_INTL_UHD_HDR_PQ_REC2020_2398_240_PR4444_ITA51_ITA20_EN51_EN20-20210508155521.mov", track=4)
ch5=FFAudioSource("\\10.64.6.11\avisynth\Scambio\WARNER_MOVIES\BatmanBegins\HDR\BATMANBEGINS_INTL_UHD_HDR_PQ_REC2020_2398_240_PR4444_ITA51_ITA20_EN51_EN20-20210508155521.mov", track=5)
ch6=FFAudioSource("\\10.64.6.11\avisynth\Scambio\WARNER_MOVIES\BatmanBegins\HDR\BATMANBEGINS_INTL_UHD_HDR_PQ_REC2020_2398_240_PR4444_ITA51_ITA20_EN51_EN20-20210508155521.mov", track=6)
audio=MergeChannels(ch1, ch2, ch3, ch4, ch5, ch6)
AudioDub(video, audio)

#From 4:2:2 10bit to 4:2:2 16bit planar
ConvertBits(16)

#From 4:2:2 16bit planar Narrow Range to RGB Planar 16bit Narrow Range
z_ConvertFormat(pixel_type="RGBP16", colorspace_op="2020:2020:2020:limited=>rgb:2020:2020:limited", dither_type="none")

#From PQ to HLG with 16bit precision
Cube("I:\Scambio\WarnerBros\WarnerBros_PQToHLG_MaxCLL_1000.cube", fullrange=true)

#From RGB 16bit planar Narrow Range to YUV420 16bit planar Narrow Range
z_ConvertFormat(pixel_type="YUV420P16", colorspace_op="rgb:2020:2020:limited=>2020:2020:2020:limited", dither_type="none")

#Spatial denoise with 16bit planar precision
dfttest(sigma=64, tbsize=1, lsb_in=false, lsb=false, Y=true, U=true, V=true, opt=0, dither=0)

Code:
ffmpeg.exe -i "D:\Temp\AVS Script.avs" -vf scale=out_color_matrix=bt2020nc:out_h_chr_pos=0:out_v_chr_pos=0 -pix_fmt yuv420p16le -strict -1 -an -f yuv4mpegpipe - | x265.exe --y4m - --dither --preset medium --level 5.0 --tune fastdecode --no-high-tier --ref 4 --profile main10 --bitrate 25000 --deblock -1:-1 --min-luma 64 --max-luma 940 --chromaloc 2 --range limited --videoformat component --colorprim bt2020 --transfer arib-std-b67 --colormatrix bt2020nc --overscan show --no-open-gop --min-keyint 1 --keyint 24 --repeat-headers --rd 3 --vbv-maxrate 25000 --vbv-bufsize 25000 --wpp --pass 1 --asm=avx512 -o NUL 

ffmpeg.exe -i "D:\Temp\AVS Script.avs" -vf scale=out_color_matrix=bt2020nc:out_h_chr_pos=0:out_v_chr_pos=0 -pix_fmt yuv420p16le -strict -1 -an -f yuv4mpegpipe - | x265.exe --y4m - --dither --preset medium --level 5.0 --tune fastdecode --no-high-tier --ref 4 --profile main10 --bitrate 25000 --deblock -1:-1 --min-luma 64 --max-luma 940 --chromaloc 2 --range limited --videoformat component --colorprim bt2020 --transfer bt2020-10 --colormatrix bt2020nc --overscan show --no-open-gop --min-keyint 1 --keyint 24 --repeat-headers --rd 3 --vbv-maxrate 25000 --vbv-bufsize 25000  --wpp --pass 2 --asm=avx512 -o "D:\Temp\raw_video.hevc"



C:\Program Files\MKVToolNix\mkvmerge.exe --output "D:\Temp\raw_video.mkv" --language 0:und ^"^(^" D:\Temp\raw_video.hevc ^"^)^"

ffmpeg.exe -i "D:\Temp\AVS Script.avs" -map 0:1 -af loudnorm=I=-24:LRA=14:tp=-2 -c:a ac3 -b:a 384k -ar 48000 "D:\Temp\audio.ac3"

ffmpeg.exe -i "D:\Temp\AVS Script.avs" -map 0:1 -af loudnorm=I=-24:LRA=14:tp=-2 -c:a libtwolame -b:a 192k -ar 48000 "D:\Temp\audio.mp2"

ffmpeg.exe  -i "D:\Temp\raw_video.mkv" -i "D:\Temp\audio.ac3" -i "D:\Temp\audio.mp2" -map 0:0 -map 1:0 -map 2:0 -c:v copy -c:a copy -c:a copy  -f mpegts -metadata provider_name="Sky" -metadata service_provider="Sky" -metadata service_name="Sky" -mpegts_original_network_id 0x1122 -mpegts_transport_stream_id 0x3344 -mpegts_service_id 0x5566 -mpegts_pmt_start_pid 0x1500 -mpegts_start_pid 0x150 -mpegts_service_type "digital_tv" -mpegts_flags "resend_headers" "D:\Temp\final.ts"

pause

Last edited by FranceBB; 4th October 2021 at 22:01.
FranceBB is offline   Reply With Quote
Old 2nd October 2021, 19:52   #8325  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
Quote:
Originally Posted by FranceBB View Post
Hi there,
I always forget who's maintaining those: http://msystem.waw.pl/x265/
Btw who IS maintaining those?
LeXXuz is offline   Reply With Quote
Old 4th October 2021, 08:14   #8326  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Why am I getting VBV violation? (the command line is the one above). x265 3.5+13-4c6880d


Last edited by FranceBB; 4th October 2021 at 08:22.
FranceBB is offline   Reply With Quote
Old 4th October 2021, 12:27   #8327  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
Based on those QPs, your source is just too compressible and the encoder cannot keep up with the requested bitrate at those points?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 4th October 2021, 15:26   #8328  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Quote:
Originally Posted by Boulder View Post
Based on those QPs, your source is just too compressible and the encoder cannot keep up with the requested bitrate at those points?
Makes sense.
The movie is 1h and 30 and it looks like it's near the end, which is pure black with static credits, so it's very likely.
The CBR 1 Gbit/s ProRes is almost definitely zero filled towards that point.
Nobody asked for CBR, so VBR 25 Mbit/s with underflow should be ok. I'm gonna send those over anyway, wish me good luck :P
FranceBB is offline   Reply With Quote
Old 4th October 2021, 17:05   #8329  |  Link
Mr.Rippley
Registered User
 
Join Date: Sep 2021
Posts: 4
Hi! I decided to learn how to efficiently encode video using HEVC. What is needed for this? Some special software or coding settings should be set "very slowly". Now I use StaxRip 2.8. I would like to achieve the quality and size of the video as on the PSA website, there are just magicians(IMHO). Thank you in advance for your help!
Mr.Rippley is offline   Reply With Quote
Old 4th October 2021, 17:16   #8330  |  Link
rwill
Registered User
 
Join Date: Dec 2013
Posts: 349
Quote:
Originally Posted by FranceBB View Post
Makes sense.
The movie is 1h and 30 and it looks like it's near the end, which is pure black with static credits, so it's very likely.
The CBR 1 Gbit/s ProRes is almost definitely zero filled towards that point.
Nobody asked for CBR, so VBR 25 Mbit/s with underflow should be ok. I'm gonna send those over anyway, wish me good luck :P
Please check one of the following:
[ ] I know what a VBV underflow means.
[ ] I do not know what a VBV underflow means.
rwill is offline   Reply With Quote
Old 4th October 2021, 20:04   #8331  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Quote:
Originally Posted by rwill View Post
Please check one of the following:
[ ] I know what a VBV underflow means.
[X] I do not know what a VBV underflow means.
Checked, but I thought it was implied by the fact that I asked you, guys, about it xD
I get that that any vbv warning means that there's something off with the bitrate, however I generally used to get vbv errors when I was using like a very low CRF and there's a very complex scene like rain or snow etc and the bitrate wanted to skyrocket and fly high but I was limiting it with some constraints to stay much lower than it should, however I feel like this time it's a completely different situation, so if you could clarify what the encoder is actually telling me other than the fact that there's something wrong and it can't abide my constraints, that would be very helpful!
FranceBB is offline   Reply With Quote
Old 4th October 2021, 21:48   #8332  |  Link
rwill
Registered User
 
Join Date: Dec 2013
Posts: 349
Video Buffer Verifier Model: Two buckets with one being above the other and having a hole in it. The buckets
hold bits. The encoder encodes pictures and puts them in the upper bucket. From there they flow through the
hole at a constant rate ( the vbv maxrate ) to the lower bucket. The lower bucket is the video buffer. When the
decoder decodes a picture it takes bits from the lower bucket ( video buffer ), most of the time this happens
at a constant frame rate.

A video buffer overflow happens when a decoder is not taking enough bits from the lower bucket and it flows over.
Now this is not really problematic unless its caused by encoder and decoder clocks drifting apart. If encoder
and decoder share a common clock the encoder should always put pictures at a framerate in its upper bucket
so that they can be removed at the same framerate from the lower bucket. Padding the flow from upper to lower
bucket when the upper bucket is empty may prevent that nothing flows but today thats not really needed anymore,
it was needed in the past though. When replacing the encoder and upper bucket by some instant access storage
( like a file ) one would just stop reading and so stop filling the lower bucket once it is full.

Now a problem arises where the encoder produces pictures that are so large that they cannot make it fast enough
through the hole to the lower bucket and once they made it there they are quicky removed by the decoder at the
fixed rate. There might arise a situation where the decoder tries to fetch a picture from the lower bucket but
the bucket does not contain a complete picture as it still needs some refill from the upper bucket. The past
pictures were to large and got removed previously -> the video buffer is empty, underrun, underflow -> "Buffering".

Video encoders try to prevent such a situation ( mostly at all costs because violating the VBV model will get your
stream get kicked from broadcast multiplex for example ). x265 tries to increase the QP within a picture when it
detects that encoding takes more bits than anticipated while encoding a picutre. I guess the pictures in question
( the ones with the underflows ) show lower quality in the lower pictures parts, maybe even complete breakage.
It appears to be not enough to prevent the underflow though. I think x265 just does not see it coming. Encoding
at such low QPs is quite delicate.

I wonder what the content looks like that x265 is able to maintain an average QP of ~3.2 at that rate. Are you
sure you got your bitdepth and clipping right ? I see in your script that you use
"-pix_fmt yuv420p16le -f yuv4mpegpipe". I never used y4m but wouldnt this flag the y4m as 16 bit depth ?
x265 gets no explicit input bit depth set too. And your .AVS script is doing 10 bit with limited range clipping.
I am confused.

Have you decoded the encoder output ? Does it look ok ?
rwill is offline   Reply With Quote
Old 4th October 2021, 22:15   #8333  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
First of all thank you so much for the detailed explanation, it makes a lot of sense now!
Still, I get that x265 just doesn't see it coming, but I kinda thought it would given that it's a two pass encode and this is the second pass.

Quote:
Originally Posted by rwill View Post
I wonder what the content looks like that x265 is able to maintain an average QP of ~3.2 at that rate. Are you
sure you got your bitdepth and clipping right ?
Given that it's an old digital movie upscaled by the studio who sent it for the HDR UHD Remaster, I think there are no details whatsoever so it's just very easy to encode for x265.

Quote:
Originally Posted by rwill View Post
I see in your script that you use
"-pix_fmt yuv420p16le -f yuv4mpegpipe". I never used y4m but wouldnt this flag the y4m as 16 bit depth ?
x265 gets no explicit input bit depth set too.
Yeah I forgot to post the final AVS, I have updated it now.
And yes, I tend to deliver 16bit planar to x265 and let it dither down to 10bit planar and use x265 itself to perform clipping at 64, 940 Limited TV range (not that HLG ever reaches the upper part of the available 940 anyway 'cause the movie ain't 1000 nits in the first place, but I just play safe). About the complexity, I don't like grain, like, at all, it doesn't look good on anything unless you have a very high bitrate (which I never have), therefore I always always always get rid of it, either spatially or temporally and sometimes both. This also makes things much easier for x265, hence the low qp.

Quote:
Originally Posted by rwill View Post
Have you decoded the encoder output ? Does it look ok ?
It looks ok from the RDP given that all this is going on in a server, however I'll be able to tell once the encode is over and the file has been moved to a shared RAID6 instead of a puny local RAID1.

Last edited by FranceBB; 4th October 2021 at 22:18.
FranceBB is offline   Reply With Quote
Old 5th October 2021, 05:38   #8334  |  Link
rwill
Registered User
 
Join Date: Dec 2013
Posts: 349
Quote:
Originally Posted by FranceBB View Post
It looks ok from the RDP given that all this is going on in a server, however I'll be able to tell once the encode is over and the file has been moved to a shared RAID6 instead of a puny local RAID1.
I would look at least around timecode 00:34:21, 01:05:02, 01:21:16 and 01:29:24 and check
for visual problems.

Maybe lowering the average rate to 20Mbit or doing more passes will help. Or
increase minQP. x265 does not give many options in such a case, I think its
being too enthusiastic about reaching the average rate of 25Mbit and due to
local failure in frame size prediction it produces underflows.
rwill is offline   Reply With Quote
Old 7th October 2021, 00:15   #8335  |  Link
Barough
Registered User
 
Barough's Avatar
 
Join Date: Feb 2007
Location: Sweden
Posts: 483
x265 v3.5+16-7955046e7 (32 & 64-bit 8/10/12bit Multilib Windows Binaries) (GCC 10.3.0)
Code:
https://bitbucket.org/multicoreware/x265_git/commits/branch/master
Barough is offline   Reply With Quote
Old 10th October 2021, 14:02   #8336  |  Link
Mr.Rippley
Registered User
 
Join Date: Sep 2021
Posts: 4
Thanks!

Last edited by Mr.Rippley; 12th October 2021 at 18:54.
Mr.Rippley is offline   Reply With Quote
Old 11th October 2021, 08:30   #8337  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Quote:
Originally Posted by Mr.Rippley View Post
Please, help me!
We don't have enough info. Do you want device playback compatibility or not? 'cause if you don't and you just want to compress, then it's much easier. You can try with something like:

Code:
--preset placebo --ref 16 --me full --subme 7 --crf 22
to start and then you can work from there.
FranceBB is offline   Reply With Quote
Old 11th October 2021, 18:04   #8338  |  Link
Mr.Rippley
Registered User
 
Join Date: Sep 2021
Posts: 4
Quote:
Originally Posted by FranceBB View Post
We don't have enough info. Do you want device playback compatibility or not? 'cause if you don't and you just want to compress, then it's much easier. You can try with something like:

Code:
--preset placebo --ref 16 --me full --subme 7 --crf 22
to start and then you can work from there.
Thanks for the answer! I tried the placebo preset, coded it for several days) And what kind of encoder program do you use?Or do you consider it the best?
Mr.Rippley is offline   Reply With Quote
Old 11th October 2021, 18:43   #8339  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Quote:
Originally Posted by Mr.Rippley View Post
Thanks for the answer! I tried the placebo preset, coded it for several days) And what kind of encoder program do you use?Or do you consider it the best?
x265.exe via command line called through a BAT file.
If you're looking for builds, you'll find them here: http://msystem.waw.pl/x265/
FranceBB is offline   Reply With Quote
Old 12th October 2021, 08:32   #8340  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
'Placebo' preset is a little bit over the top, isn't it?

If encoding time and energy consumption is of no concern, well go for it then.

But I think for private every day use the 'Slower' or 'Very Slow' presets are more than sufficient enough. I highly doubt most people would see any difference, especially on consumer displays.

Last edited by LeXXuz; 12th October 2021 at 08:34.
LeXXuz is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:10.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.