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 > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 27th January 2019, 15:37   #21  |  Link
Grojm
Registered User
 
Join Date: Mar 2016
Posts: 16
The ffmpeg team admitted that not transferring the metadata is bug, they just refuse to work on this. A bug report is open for a year without any attempts to solve this:
https://trac.ffmpeg.org/ticket/7037
Sad.
Grojm is offline   Reply With Quote
Old 27th January 2019, 16:33   #22  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,336
No one "refuses" to work on it, but most in the project donates their time for free, which means everyone works on things they are personally interested in, or have a need for in their use of ffmpeg.
Insulting the developers and demanding they work on your pet project is not going to make you any friends, or get your issue adressed any sooner.

If you want it fixed so badly, I suggest you put a bounty on it, ie. pay for someones time, instead of demanding how someone else spends their free time - after insulting them, apparently.

Or, you know, just fix it and send a patch.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is online now   Reply With Quote
Old 28th January 2019, 19:11   #23  |  Link
Grojm
Registered User
 
Join Date: Mar 2016
Posts: 16
This is not a pet project - this is absolutely necessary!

"ffmpeg HDR metadata" is the among the top 4 (!) suggestions in Google if you type "ffmpeg HDR". Because everyone who wants to encode HDR will stumble across this. HDR is already in the mass market. The demand for such a bugfix is huge.

I didn't insult the developers, I just told the truth. If you think the truth is insulting, this is your problem. I only suggested that we should stop glorifying developers for just having fun. I mean you wouldn't give a skydiver credit because he had fun, and you wouldn't say he "donated" his time to skydiving. But it's still ok that people have fun, don't get me wrong. I also like to have fun. You just can't develop software with this attitude. What's necessary is that we empathize the importance of bugfixing and start to develop a culture in which fixing bugs gets you lot's of honor and fame, and people who are just dropping their cool innovative but buggy piece of code should not be given the same amount of honor.
There is even something the leadership can do about this. Look at Linus Torvalds and how he is telling people if they produce buggy code quite clearly. Every project needs someone like Linus Torvalds.
One could even build some gamification elements in this. Like every new feature submission has to be followed by one bugfix submission, otherwise you can not submit new features any more. Bugs like the present one would be fixed within weeks. The ffmpeg devs are really fast. Just look how fast cehoyos was to downplay the importance of this very serious issue. It was like one minute reaction time - on a Sunday! They have a lot of spare time but the incentives must be misaligned if this time and energy is not converted into good code. This is what I wanted to tell right from the beginning.

Last edited by Grojm; 28th January 2019 at 19:50.
Grojm is offline   Reply With Quote
Old 28th January 2019, 20:45   #24  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,738
The broader problem is that no one is using H.264 for HDR 4K. HEVC is much more efficient for that kind of encoding, and there are plenty of HDR capable devices out there that can decode 10-bit HEVC but only 8-bit H.264. The only reason I could see to encode H.264 for HDR is if targeting a specific bit of oddball hardware that requires it. But a HDR H.264 stream will not work in many places where HDR HEVC would. And even when it worked well, it would still requires >2x the bitrate for 2160p 10-bit HDR. There is no --hdr-opt for x264 like there is in x265, for example.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 28th January 2019, 21:45   #25  |  Link
Grojm
Registered User
 
Join Date: Mar 2016
Posts: 16
H.265 ist also affected. It's independent of the codec. ffmpeg destroys any HDR related metadata. I'm interested in H.265 of course, but I just saw that H.264 users had the exact same problem.
HDR always comes with metadata telling the color profile etc. without it you can't use it effectively. To put it in other words: ffmpeg is broken for HDR. In general. That's the issue.

Last edited by Grojm; 28th January 2019 at 21:49.
Grojm is offline   Reply With Quote
Old 30th January 2019, 00:14   #26  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,738
Quote:
Originally Posted by Grojm View Post
H.265 ist also affected. It's independent of the codec. ffmpeg destroys any HDR related metadata. I'm interested in H.265 of course, but I just saw that H.264 users had the exact same problem.
HDR always comes with metadata telling the color profile etc. without it you can't use it effectively. To put it in other words: ffmpeg is broken for HDR. In general. That's the issue.
Ah. Well, THAT certainly is a bug! I presume one could re-add the metadata using x265 parameters, but a pass through would be nice.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 31st January 2019, 02:01   #27  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,986
also worth noting, maxcll and maxfall describe the light peak and average light levels of the mastered content.

The ST2084 metadata (i.e. master-display-parameters in x265 speak) describe the characteristics of the mastering display. For example, a 4000 nit Dolby Pulsar is sometimes used for grading content. So you would set the mastering display metadata to describe this. However, the content is most likely not graded up to 4000 nits. Content is quite frequently graded down to 1000 nits or less. THAT is what MaxCLL and MaxFALL describe.
Blue_MiSfit is offline   Reply With Quote
Old 27th August 2019, 05:50   #28  |  Link
hydra3333
Registered User
 
Join Date: Oct 2009
Location: crow-land
Posts: 540
Just tested and ffmpeg situation seems unchanged.
It seems even with latest nvidia 2060 Super gpu and ffmpeg build with the latest nvenc gpu encoder, nvenc based output omits the HDR metadata ... with apparently no possibility of fixing it.
Oh well.
hydra3333 is offline   Reply With Quote
Old 27th August 2019, 20:59   #29  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,738
Quote:
Originally Posted by hydra3333 View Post
Just tested and ffmpeg situation seems unchanged.
It seems even with latest nvidia 2060 Super gpu and ffmpeg build with the latest nvenc gpu encoder, nvenc based output omits the HDR metadata ... with apparently no possibility of fixing it.
Oh well.
Piping from ffmpeg into x265 works.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 31st August 2019, 15:15   #30  |  Link
hydra3333
Registered User
 
Join Date: Oct 2009
Location: crow-land
Posts: 540
Thank you !
However, one then loses the "massive?" benefit of gpu-speed encoding
I did a terrible, loose, undocumented, once-off 4k 10 bit test and thought it was near realtime in encoding fps, depending. Haven't tried x265, however suspect 4k won't be anywhere near gpu speed.
hydra3333 is offline   Reply With Quote
Old 3rd September 2019, 19:26   #31  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,738
Quote:
Originally Posted by hydra3333 View Post
Thank you !
However, one then loses the "massive?" benefit of gpu-speed encoding
I did a terrible, loose, undocumented, once-off 4k 10 bit test and thought it was near realtime in encoding fps, depending. Haven't tried x265, however suspect 4k won't be anywhere near gpu speed.
x265 can itself use the intel svt libraries for rapid acceleration. But I doubt you'll get realtime 2160p in software on anything less than a monster workstation.

GPU is fast, but it has substantial quality/efficiency limitations compared to even a performance tuned software encode.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 10th September 2019, 16:50   #32  |  Link
Loomes
Registered User
 
Join Date: Nov 2003
Location: Germany, Berlin
Posts: 48
Quote:
Originally Posted by benwaggoner View Post
Piping from ffmpeg into x265 works.
That's what I just tried using
Code:
ffmpeg -i input.mkv -c:v libx265 -x265-params crf=20:no-sao=yes:hdr=yes -pix_fmt yuv420p10le -bsf hevc_mp4toannexb -f rawvideo output.h265
but none of the HDR metadata got taken to the transcoded videofile. Maybe I am missing something? Is there a way to extract metadata from an HDR10 file (non plus) to a json file (like hdr10plus_parser does) and import it back in while piping with ffmpeg? The HDR Info in the source file are:
Code:
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0001 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 1000 cd/m2
Maximum Frame-Average Light Level        : 288 cd/m2
Loomes is offline   Reply With Quote
Old 10th September 2019, 17:19   #33  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,738
Quote:
Originally Posted by Loomes View Post
That's what I just tried using
Code:
ffmpeg -i input.mkv -c:v libx265 -x265-params crf=20:no-sao=yes:hdr=yes -pix_fmt yuv420p10le -bsf hevc_mp4toannexb -f rawvideo output.h265
but none of the HDR metadata got taken to the transcoded videofile. Maybe I am missing something? Is there a way to extract metadata from an HDR10 file (non plus) to a json file (like hdr10plus_parser does) and import it back in while piping with ffmpeg? The HDR Info in the source file are:
Code:
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0001 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 1000 cd/m2
Maximum Frame-Average Light Level        : 288 cd/m2
I mean like:

Code:
ffmpeg.exe -i foo.mov -pix_fmt yuv420p10le -strict -1 -f yuv4mpegpipe - | x265.exe - --y4m --profile main10 --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --hdr --hdr-opt --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)" --max-cll "1005,894" -o foo.hevc
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 10th September 2019, 17:25   #34  |  Link
Loomes
Registered User
 
Join Date: Nov 2003
Location: Germany, Berlin
Posts: 48
I see, yes, I could also pass the HDR metadata like -x265-params colorprim=9:transfer=16:colormatrix=9 but thats not exactly what I meant. I am looking for a way to extract and then pass them to the transcoded file automatically, like "hdr10plus_parser.exe" does.
Loomes is offline   Reply With Quote
Old 10th September 2019, 17:49   #35  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,738
Quote:
Originally Posted by Loomes View Post
I see, yes, I could also pass the HDR metadata like -x265-params colorprim=9:transfer=16:colormatrix=9 but thats not exactly what I meant. I am looking for a way to extract and then pass them to the transcoded file automatically, like "hdr10plus_parser.exe" does.
MediaInfo can tell you the values at least, although you might have to reformat them syntactically.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 14th September 2019, 09:32   #36  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,986
Just for fun it's worth mentioning that Dolby Vision has an 8 bit AVC profile with an enhancement layer

It's designed to be implemented on devices without a working HEVC decoder (or one that's present but just not licensed / activated).
Blue_MiSfit is offline   Reply With Quote
Old 17th September 2019, 09:38   #37  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,738
Quote:
Originally Posted by Blue_MiSfit View Post
Just for fun it's worth mentioning that Dolby Vision has an 8 bit AVC profile with an enhancement layer

It's designed to be implemented on devices without a working HEVC decoder (or one that's present but just not licensed / activated).
Yeah, there are a bunch of legacy profiles I've not seen in real-world deployments. I played around with that one myself ~5 years ago.

Everything for current content seems to have converged on Profile 5 (non-backwards compatible 10-bit HEVC) for VOD and Profile 8.1 (HDR-10 base layer) for Live that I know of.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 23rd September 2019, 11:55   #38  |  Link
Krautmaster
Registered User
 
Join Date: Mar 2017
Posts: 10
having the same issue for 2 years now, i can't reencode with ffmpeg as its not able to keep the HDR metadata in place.

Any how, my ffmpeg probe does not print the meta data at all, so I cant even use that massive batch posted before to do a mapping within the batch process itself.

in ffprobe i get
Quote:
[STREAM]
index=0
codec_name=hevc
codec_long_name=H.265 / HEVC (High Efficiency Video Coding)
profile=Main 10
codec_type=video
codec_time_base=1001/24000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=3840
height=2160
coded_width=3840
coded_height=2160
has_b_frames=1
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p10le
level=153
color_range=tv
color_space=bt2020nc
color_transfer=smpte2084
color_primaries=bt2020
chroma_location=unspecified
field_order=unknown
timecode=N/A
refs=1
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/1000
start_pts=17
start_time=0.017000 s
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
while mediainfo tells me

Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : PQ
Matrix coefficients : BT.2020 non-constant
Mastering display color primaries : Display P3
Mastering display luminance : min: 0.0050 cd/m2, max: 1000 cd/m2
Maximum Content Light Level : 944 cd/m2
Maximum Frame-Average Light Level : 143 cd/m2

Edit:

Okay the -show_entries side_data switch in ffprobe does extract the data itself but it takes ages. And anyway, then a custom massive manual mapping is required to pass that data to x265. Sucks. A fix should be implemented

Last edited by Krautmaster; 23rd September 2019 at 12:17.
Krautmaster is offline   Reply With Quote
Old 23rd September 2019, 13:15   #39  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
You can limit the amount of frames ffprobe reads via -read_intervals.
Code:
ffprobe -read_intervals "%+#2" -show_frames -show_entries side_data "video.mkv"
sneaker_ger is offline   Reply With Quote
Old 23rd September 2019, 13:45   #40  |  Link
Krautmaster
Registered User
 
Join Date: Mar 2017
Posts: 10
thanks !

Edit: Working fine now for me using ffprobe and that awesome mapping of a page before. That preserves my hdr metadata.

Last edited by Krautmaster; 24th September 2019 at 10:57.
Krautmaster 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 08:21.


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