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 14th September 2017, 12:17   #5601  |  Link
_kermit
Registered User
 
Join Date: Apr 2017
Posts: 10
Re-encode UHD

Good day,

my first post, although I follow this thread for a long time now, so first things first:
I'd like to thank you for your work. It's amazing how much effort you put into such a great and free ! solution. Really appriciated!

I'd like to re-encode some UHD material but while I found quite a bit about Quality Tuning, I'm lost when it comes to just re-encoding it, using less bandwidth, but keeping everything else the same.
In particular the HDR Parameters.

Examples:
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : SMPTE ST 2084
Matrix coefficients : BT.2020 non-constant
Mastering display color primaries : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312680 y=0.329000
Mastering display luminance : min: 0.0050 cd/m2, max: 1000.0000 cd/m2
Maximum Content Light Level : 1000 cd/m2
Maximum Frame-Average Light Level : 96 cd/m2


Color range : Limited
Color primaries : BT.2020
Transfer characteristics : SMPTE ST 2084
Matrix coefficients : BT.2020 non-constant
Mastering display color primaries : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000
Mastering display luminance : min: 0.0000 cd/m2, max: 1000.0000 cd/m2


Color range : Limited
Color primaries : BT.2020
Transfer characteristics : SMPTE ST 2084
Matrix coefficients : BT.2020 non-constant
Mastering display color primaries : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312680 y=0.329000
Mastering display luminance : min: 0.0050 cd/m2, max: 1000.0000 cd/m2


they all have a bit different Parameters.
How would I re-encode those, while preserving all those values for each file?
I guess there is no "take those Parameters from the source file and re-use them in the target file" Option and I have to provide them manually for every file?

Can you provide an example on how to re-encode an mkv (I use ffmpeg and pipe), maybe with some good tunning tips included?

thanks!!
_kermit is offline   Reply With Quote
Old 14th September 2017, 12:42   #5602  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,268
Example for your first file:
ffmpeg -i "input.mkv" -pix_fmt yuv420p10 -strict -1 -f yuv4mpegpipe - | x265 - --y4m --output-depth 10 --colorprim 9 --transfer 16 --colormatrix 9 --range limited --chromaloc 2 --max-cll "1000,96" --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15634,16450)L(10000000,50)" -o "output.265"
(--chromalog 2 is usually used for 4K HDR so I have set it. But MediaInfo doesn't show this about your source.)
remux with audio/subs from source: mkvmerge -o "output.mkv" "output.265" --no-video "input.mkv"

You can find some more examples/discussion here:
https://forum.doom9.org/showthread.php?t=174491
http://x265.readthedocs.io/en/defaul...mation-options

Last edited by sneaker_ger; 14th September 2017 at 13:55. Reason: edited colorprim/transer/matrix to int values because of x265 cli change
sneaker_ger is offline   Reply With Quote
Old 14th September 2017, 13:25   #5603  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 5,278
It's now --transfer smpte2084

edit:

Can anybody provide a sample file which such HDR metadata?

Last edited by stax76; 14th September 2017 at 13:36.
stax76 is offline   Reply With Quote
Old 14th September 2017, 13:44   #5604  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,268
Quote:
Originally Posted by stax76 View Post
It's now --transfer smpte2084
Ah, I forgot. Thx. Edited.

Quote:
Originally Posted by stax76 View Post
Can anybody provide a sample file which such HDR metadata?
Knock yourself out:
http://demo-uhd3d.com/
sneaker_ger is offline   Reply With Quote
Old 14th September 2017, 14:29   #5605  |  Link
_kermit
Registered User
 
Join Date: Apr 2017
Posts: 10
Quote:
Originally Posted by sneaker_ger View Post
Example for your first file:
ffmpeg -i "input.mkv" -pix_fmt yuv420p10 -strict -1 -f yuv4mpegpipe - | x265 - --y4m --output-depth 10 --colorprim 9 --transfer 16 --colormatrix 9 --range limited --chromaloc 2 --max-cll "1000,96" --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15634,16450)L(10000000,50)" -o "output.265"
(--chromalog 2 is usually used for 4K HDR so I have set it. But MediaInfo doesn't show this about your source.)
remux with audio/subs from source: mkvmerge -o "output.mkv" "output.265" --no-video "input.mkv"

You can find some more examples/discussion here:
https://forum.doom9.org/showthread.php?t=174491
http://x265.readthedocs.io/en/defaul...mation-options
that was fast

so basically only --max-cll changes accordingly to the source?
Is there a need/benefit using any of the uhd/hdr Options like "--hdr-opt"?

You have some advice on the remaining regular settings for UHD? (preset, CRF value)?

thanks!
_kermit is offline   Reply With Quote
Old 14th September 2017, 15:06   #5606  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,268
Quote:
Originally Posted by _kermit View Post
so basically only --max-cll changes accordingly to the source?
Other parameters might change as well but it seems most of the sources floating around use the same parameters, mostly. It's your job to check.

Also, some sources have parameters that don't make much sense. Like your second file which has "Mastering display luminance : min: 0.0000 cd/m2, max: 1000.0000 cd/m2".
Minimum luminance of 0? I don't think such a display is on the market.

Quote:
Originally Posted by _kermit View Post
Is there a need/benefit using any of the uhd/hdr Options like "--hdr-opt"?

You have some advice on the remaining regular settings for UHD? (preset, CRF value)?
[/QUOTE]
--hdr-opt is supposed to increase compression for HDR but I haven't actually tested it nor see other comparisons. I suggest you read the thread I linked and look around a bit around the forum. It's subjective.
Preset: as slow as you are willing to wait
CRF: as low as you are willing to sacrifice HDD space
sneaker_ger is offline   Reply With Quote
Old 14th September 2017, 15:59   #5607  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 5,278
@sneaker_ger

You can't really trust the documentation, it's not always in sync with the code, I would always use strings instead of integers for flags.
stax76 is offline   Reply With Quote
Old 14th September 2017, 16:05   #5608  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,268
The integers should be the integers as they are stored in the bitstream, i.e. taken right out of the HEVC specs. I assume .. well .. hope they will never change. In this case I just chose them so it works with old and new x265 version.
sneaker_ger is offline   Reply With Quote
Old 14th September 2017, 16:12   #5609  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 5,278
I think if you compare with the console and online help you'll probably find more then one issue.

Code:
static const char * const x265_source_csp_names[] = { "i400", "i420", "i422", "i444", "nv12", "nv16", 0 };
static const char * const x265_video_format_names[] = { "component", "pal", "ntsc", "secam", "mac", "unknown", 0 };
static const char * const x265_fullrange_names[] = { "limited", "full", 0 };
static const char * const x265_colorprim_names[] = { "reserved", "bt709", "unknown", "reserved", "bt470m", "bt470bg", "smpte170m", "smpte240m", "film", "bt2020", "smpte428", "smpte431", "smpte432", 0 };
static const char * const x265_transfer_names[] = { "reserved", "bt709", "unknown", "reserved", "bt470m", "bt470bg", "smpte170m", "smpte240m", "linear", "log100",
                                                    "log316", "iec61966-2-4", "bt1361e", "iec61966-2-1", "bt2020-10", "bt2020-12",
                                                    "smpte2084", "smpte428", "arib-std-b67", 0 };
static const char * const x265_colmatrix_names[] = { "gbr", "bt709", "unknown", "", "fcc", "bt470bg", "smpte170m", "smpte240m",
                                                     "ycgco", "bt2020nc", "bt2020c", "smpte2085", "chroma-derived-nc", "chroma-derived-c", "ictcp", 0 };
stax76 is offline   Reply With Quote
Old 14th September 2017, 16:30   #5610  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,268
I don't.
sneaker_ger is offline   Reply With Quote
Old 14th September 2017, 16:45   #5611  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 5,278
Maybe the order is correct, there are some incorrect names however like smpte-st-428 -> smpte428
stax76 is offline   Reply With Quote
Old 18th September 2017, 13:42   #5612  |  Link
cap5lock
Registered User
 
Join Date: Sep 2017
Posts: 8
Is there any h.265 parameters that remove digital noise and make background really still ?
I have no problem with color banding
Any possibilities to do it without additional filtering (avisynth, etc.)?
cap5lock is offline   Reply With Quote
Old 18th September 2017, 19:22   #5613  |  Link
birdie
.
 
birdie's Avatar
 
Join Date: Dec 2006
Posts: 118
Quote:
Originally Posted by cap5lock View Post
Is there any h.265 parameters that remove digital noise and make background really still ?
I have no problem with color banding
Any possibilities to do it without additional filtering (avisynth, etc.)?
None, it's not the codec's job to do.

Besides there are over several dozen of ways to remove noise and artifacts depending on the source.
birdie is offline   Reply With Quote
Old 18th September 2017, 19:28   #5614  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,513
There are the --nr-intra and --nr-inter options available. Also the dreaded --sao a.k.a. Smooth All Objects could be helpful in your case.
__________________
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 18th September 2017, 22:37   #5615  |  Link
birdie
.
 
birdie's Avatar
 
Join Date: Dec 2006
Posts: 118
sao is enabled by default, the two other options are not meant for removing noise or smoothing backgrounds because they will as well smooth everything else. If one wants to remove noise, use avisynth filters for that.
birdie is offline   Reply With Quote
Old 20th September 2017, 23:50   #5616  |  Link
Natty
Noob
 
Join Date: Mar 2017
Posts: 76
Quote:
Originally Posted by cap5lock View Post
Is there any h.265 parameters that remove digital noise and make background really still ?
I have no problem with color banding
Any possibilities to do it without additional filtering (avisynth, etc.)?
u can set deblocking -3:0, raise qcomp, disable all smoothings, but these wont be enough until u use filters.
Natty is offline   Reply With Quote
Old 30th September 2017, 02:09   #5617  |  Link
Midzuki
Unavailable
 
Midzuki's Avatar
 
Join Date: Mar 2009
Location: offline
Posts: 1,477
x265.exe 2.5+20-0967d0add97e

https://forum.videohelp.com/threads/...=1#post2497549
Midzuki is offline   Reply With Quote
Old 2nd October 2017, 02:47   #5618  |  Link
Barough
Registered User
 
Barough's Avatar
 
Join Date: Feb 2007
Location: Sweden
Posts: 307
x265 v2.5+20-0967d0add97e (GCC 7.2.0, 32 & 64-bit 8/10/12bit Multilib Windows Binaries)

x265 [info]: HEVC encoder version 2.5+20-0967d0add97e
x265 [info]: build info [Windows][GCC 7.2.0][32/64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2


Code:
https://bitbucket.org/multicoreware/x265/commits/branch/default
Barough is offline   Reply With Quote
Old 3rd October 2017, 12:38   #5619  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 5,787
x265 2.5+22-8db95a1da9f8 (MSYS/MinGW, GCC 7.1.0) ... does XhmikosR still update?

Fixes for analysis load, WPP, bitstream payload size, VBV hanging; new (internal?) parameter for disabling lookahead; Windows DLL will export x265_encoder_ctu_info()
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 6th October 2017, 20:40   #5620  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,794
Quote:
Originally Posted by birdie View Post
sao is enabled by default, the two other options are not meant for removing noise or smoothing backgrounds because they will as well smooth everything else. If one wants to remove noise, use avisynth filters for that.
--nr-inter works sort of like an adaptive deadzone for predicted blocks. It absolutely will reduce random noise with a high spatial and temporal frequency, and will help stabalize the background of noisy sources. This can also yield significant bitrate reduction since encoding all those high frequency residuals every frame is expensive.

Of course it can also lose detail in moving areas as well.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner 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 12:02.


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