View Single Post
Old 22nd January 2021, 19:54   #3  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,770
This is how I had to make some of our HDR demo clips for CES 2015. If you've exported your YUV frames as proper SMPTE 2100 (PQ with 2020 primaries), it's pretty trivial to use that as source. I'd probably convert from the frames to a .y4m file in ffmpeg first, just to confirm I've got a single file with the correct metadata. You could also pipe straight to x265. One trick here is using -pix_fmt yuv420p10le -strict -1 in your ffmpeg command line so it'll make a real 10-bit YUV. There's also ffmpeg's turgid image sequence file reading syntax, which you've probably already figured out.

x265 can directly read a .y4m file and will read the height/width/fps/color depth/subsampling from the metadata so you don't have to specify all that.

Here's a sample command line for encoding from .y4m to HDR.

Code:
ffmpeg.exe -i foo.y4m -pix_fmt yuv420p10le -strict -1 -f yuv4mpegpipe - | x265.exe - --y4m --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --hdr --hdr-opt --max-cll "2000,300" -o foo.hevc
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote