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)

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st December 2019, 03:40   #7281  |  Link
bjoker
Registered User
 
Join Date: Jan 2013
Posts: 50
Thanks.
I tested an older version of ffmpeg/x265 and it worked fine.

Unfortunately the latest ffmpeg build still has x265 3.2+15. I think I will have to use external x265.
How could I pipe ffmpeg to external x265 for 2-pass please?
bjoker is offline   Reply With Quote
Old 21st December 2019, 05:44   #7282  |  Link
Greenhorn
Registered User
 
Join Date: Apr 2018
Posts: 61
I don't really know shell syntax, but what I'd normally do for standalone x265 would be convert my input files to decompressed .y4m with ffmpeg (ffmpeg -i example_input.file example_output.y4m), then convert the y4m using x265. (x265 example_output.y4m --my_settings -o example_output.hevc) You'll need enough free disk space for the whole .y4m to be stored, and the output will be a raw HEVC stream that needs to be muxed with ffmpeg again-- although that shouldn't pose any problems, unless you've got two buggy libraries in one ffmpeg at once.
Greenhorn is offline   Reply With Quote
Old 21st December 2019, 10:37   #7283  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Quote:
Originally Posted by Greenhorn View Post
I don't really know shell syntax, but what I'd normally do for standalone x265 would be convert my input files to decompressed .y4m with ffmpeg (ffmpeg -i example_input.file example_output.y4m), then convert the y4m using x265. (x265 example_output.y4m --my_settings -o example_output.hevc) You'll need enough free disk space for the whole .y4m to be stored, and the output will be a raw HEVC stream that needs to be muxed with ffmpeg again-- although that shouldn't pose any problems, unless you've got two buggy libraries in one ffmpeg at once.
No ginormous intermediate file needed:
Code:
ffmpeg -i example_input.file -f yuv4mpegpipe -strict -2 - | x265 - -o example_output.hevc
That's going to be much faster than writing and reading to disk. The "strict -2" allows y4m to be greater than 8 bits, if necessary.
foxyshadis is offline   Reply With Quote
Old 23rd December 2019, 04:42   #7284  |  Link
nghiabeo20
Registered User
 
Join Date: Jun 2013
Posts: 32
Does x265 have tuning for monochrome picture? And is it a good practice to convert a RGB black&white source to actual BW in an encode?
nghiabeo20 is offline   Reply With Quote
Old 23rd December 2019, 04:48   #7285  |  Link
nghiabeo20
Registered User
 
Join Date: Jun 2013
Posts: 32
Quote:
Originally Posted by foxyshadis View Post
No ginormous intermediate file needed:
Code:
ffmpeg -i example_input.file -f yuv4mpegpipe -strict -2 - | x265 - -o example_output.hevc
That's going to be much faster than writing and reading to disk. The "strict -2" allows y4m to be greater than 8 bits, if necessary.
May I explain:

Code:
ffmpeg -i example_input.file -f yuv4mpegpipe -strict -2 -
The - makes ffmpeg send output to stdout.

Code:
x265 - -o example_output.hevc
The - makes x265 receive input from stdin.

The | (pipe) connects stdout to stdin.
nghiabeo20 is offline   Reply With Quote
Old 23rd December 2019, 19:15   #7286  |  Link
SaboraPie
Registered User
 
Join Date: Jan 2015
Posts: 9
why this last versions are so slow. In v3.0 or earlier versions i was encoding at 1.2fps in veryslow mode, and now it is 0.42fps. Is maybe more efficient but much slower?
SaboraPie is offline   Reply With Quote
Old 23rd December 2019, 20:07   #7287  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
The presets were changed at one point. The old "veryslow" became "slower" etc.
__________________
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 24th December 2019, 20:48   #7288  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,815
How to correctly signal HLG with x265?
So far I'm using following command line
Code:
--colorprim bt2020 --transfer bt2020-10 --colormatrix bt2020nc --atc-sei 18
but according to x265 docs there is also another required switch

Quote:
--pic-struct <integer>
Set the picture structure and emits it in the picture timing SEI message. Values in the range 0..12. See D.3.3 of the HEVC spec. for a detailed explanation. Required for HLG (Hybrid Log Gamma) signalling. Not signalled by default.
What value has to be set there? Is --pic-struct 0 correct/needed for progressive frame?

Last edited by Atak_Snajpera; 24th December 2019 at 20:58.
Atak_Snajpera is offline   Reply With Quote
Old 24th December 2019, 23:30   #7289  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Yes, 0 for progressive. Odd that HLG requires it. Wouldn't transfer be arib-std-b67 for HLG?
foxyshadis is offline   Reply With Quote
Old 25th December 2019, 13:13   #7290  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,815
Quote:
Originally Posted by foxyshadis View Post
Yes, 0 for progressive. Odd that HLG requires it. Wouldn't transfer be arib-std-b67 for HLG?
Mediainfo detects both so I'm not sure if arib-std-b67 is required...

--transfer bt2020-10
Code:
Transfer characteristics                 : HLG / BT.2020 (10-bit)
--transfer arib-std-b67
Code:
Transfer characteristics                 : HLG / HLG
Atak_Snajpera is offline   Reply With Quote
Old 26th December 2019, 18:39   #7291  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
This is the command line of an HLG encode I've done recently:

Code:
--colorprim bt2020 --transfer arib-std-b67 --colormatrix bt2020nc --atc-sei 18
I've never used --pic-struct, but the file has been recognized as an HLG one anyway.

But... Atak_Snajpera made it popping back up in my mind by asking about it, so... should I include --pic-struct 0 as well?
FranceBB is offline   Reply With Quote
Old 26th December 2019, 23:39   #7292  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 325
Quote:
Originally Posted by FranceBB View Post
This is the command line of an HLG encode I've done recently:

Code:
--colorprim bt2020 --transfer arib-std-b67 --colormatrix bt2020nc --atc-sei 18
I've never used --pic-struct, but the file has been recognized as an HLG one anyway.

But... Atak_Snajpera made it popping back up in my mind by asking about it, so... should I include --pic-struct 0 as well?
Quote:
Originally Posted by Atak_Snajpera View Post
Mediainfo detects both so I'm not sure if arib-std-b67 is required...

--transfer bt2020-10
Code:
Transfer characteristics                 : HLG / BT.2020 (10-bit)
--transfer arib-std-b67
Code:
Transfer characteristics                 : HLG / HLG
AFIK according to the specc its recommended for HLG that the fallback transfer function should flaged in "--transfer" and the HLG transfer i.e. arib-std-b67 / 18 with the preferred/alternative transfer characteristics flag (--atc-sei).

Last edited by excellentswordfight; 26th December 2019 at 23:44.
excellentswordfight is offline   Reply With Quote
Old 27th December 2019, 02:54   #7293  |  Link
hevc_enocder
Registered User
 
Join Date: Jan 2019
Posts: 2
hello, may I have question?

What is right scrip for zones I tried this and i alaways get an error

Quote:
--zones 9277,9328,crf=15.4/9381,9742,crf=15.4/27589,27647,crf=15.4/27885,28012,crf=15.4/28091,28174,crf=15.4/28285,28368,crf=15.4/36778,36848,crf=15.4/71142,71170,crf=15.4/72038,72097,crf=15.4/72401,72422,crf=15.4/157075,157141,crf=15.4/180290,180426,crf=15.4/188329,188459,crf=15.4/199320,199359,crf=15.4/199895,199990,crf=15.4/205184,205327,crf=15.4/221411,221500,crf=15.4/222062,222108,crf=15.4/237130,243727,crf=22
So my final setting is this:
Quote:
--crf 16 --output-depth 10 --level-idc 5.1 --high-tier --ref 5 --bframes 12 --rd 6 --me 3 --subme 5 --merange 32 --ipratio 1.3 --pbratio 1.2 --weightb --b-intra --hevc-aq --no-rskip --qcomp 0.60 --psy-rd 1.07 --psy-rdoq 1.00 --ctu 64 --rc-lookahead 60 --deblock -3:-3 --cbqpoffs 0 --crqpoffs 0 --qg-size 8 --no-rskip --no-rect --no-amp --no-sao --no-open-gop --no-cutree --range limited --aud --repeat-headers --zones 9277,9328,crf=15.4/9381,9742,crf=15.4/27589,27647,crf=15.4/27885,28012,crf=15.4/28091,28174,crf=15.4/28285,28368,crf=15.4/36778,36848,crf=15.4/71142,71170,crf=15.4/72038,72097,crf=15.4/72401,72422,crf=15.4/157075,157141,crf=15.4/180290,180426,crf=15.4/188329,188459,crf=15.4/199320,199359,crf=15.4/199895,199990,crf=15.4/205184,205327,crf=15.4/221411,221500,crf=15.4/222062,222108,crf=15.4/237130,243727,crf=22
please can you tell me what is wrong about it? Thank you so much.
hevc_enocder is offline   Reply With Quote
Old 27th December 2019, 06:39   #7294  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
I don't think x265 supports setting CRF in zones, you need to define q instead.
__________________
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 27th December 2019, 08:23   #7295  |  Link
RainyDog
Registered User
 
Join Date: May 2009
Posts: 184
Quote:
Originally Posted by hevc_enocder View Post
hello, may I have question?

What is right scrip for zones I tried this and i alaways get an error

So my final setting is this:

please can you tell me what is wrong about it? Thank you so much.
Try replacing all instances of crf=15.4 in your script with b=1.3 (or find your preferred value instead of 1.3).

The 'b' stands for bitrate multiplier so 1.3 will increase the bitrate of the frames designated within zones by a factor of x1.3 (or +30%).
RainyDog is offline   Reply With Quote
Old 29th December 2019, 01:47   #7296  |  Link
Magik Mark
Registered User
 
Join Date: Dec 2014
Posts: 666
Guys,

When encoding do you use ssim-rdo? Do you see any difference? When is the best time to use this? During 2pass perhaps? or CRF?

It takes longer when this is enabled.
__________________
Asus ProArt Z790 - 13th Gen Intel i9 - RTX 3080 - DDR5 64GB Predator - LG OLED C9 - Yamaha A3030 - Windows 11 x64 - PotPlayerr - Lav - MadVR
Magik Mark is offline   Reply With Quote
Old 29th December 2019, 23:32   #7297  |  Link
vpupkind
Registered User
 
Join Date: Jul 2007
Posts: 63
Quote:
Originally Posted by Boulder View Post
I don't think x265 supports setting CRF in zones, you need to define q instead.
You can change crf (as well as some other parameters) per zone using the --zonefile option and a "sidecar file" with frame numbers and zone settings. You can change additional settings beyond crf/bitrate this way.
vpupkind is offline   Reply With Quote
Old 29th December 2019, 23:35   #7298  |  Link
vpupkind
Registered User
 
Join Date: Jul 2007
Posts: 63
Quote:
Originally Posted by Magik Mark View Post
Guys,

When encoding do you use ssim-rdo? Do you see any difference? When is the best time to use this? During 2pass perhaps? or CRF?

It takes longer when this is enabled.
It is heavy but is totally worth it, IMO. We've seen meaningful quality improvements.
vpupkind is offline   Reply With Quote
Old 30th December 2019, 06:22   #7299  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,844
Quote:
Originally Posted by vpupkind View Post
It is heavy but is totally worth it, IMO. We've seen meaningful quality improvements.
From my testing, it produces worse results in dark, mostly clean frames with a little of mosquito noise. Tested on Blade Runner 2049 starting from 6:00 minutes
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 31st December 2019, 19:03   #7300  |  Link
Greenhorn
Registered User
 
Join Date: Apr 2018
Posts: 61
Oddly, enabling ssim-rd by itself will disable psy-rd, but if you manually specify both they'll both be used.

Last edited by Greenhorn; 31st December 2019 at 20:35. Reason: I'm dumb.
Greenhorn is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 23:11.


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