Unmanic / unmanic

Unmanic - Library Optimiser
GNU General Public License v3.0
1.64k stars 82 forks source link

Help: convert H265 HDR to H264 with tone mapping in x264 plugins #316

Open antipiot opened 2 years ago

antipiot commented 2 years ago

Description

I have some h265 HDR videos that id' like to convert to x264 while keeping colors of HDR

I have read some threads about this but not sur if why i found is relevant: https://www.reddit.com/r/ffmpeg/comments/gg82o2/transcoding_h265_to_h264_while_keeping_hdr/ -x264opts colorprim=bt2020:colormatrix=bt2020nc:transfer=smpte2084:chromaloc=2

https://www.reddit.com/r/ffmpeg/comments/lrqqen/hdr_to_sdr_tone_mapping_issues_help/ ffmpeg -i input1.mkv -vf zscale=t=linear:npl=57,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p -c:v libx265 -crf 12 video-output.mkv

The second option leads to an error when put in unmanic x264 plugins under advanced configurations: "Filtering and streamcopy cannot be used together"

Is there any way in unmanic to run the conversion with thoses flags?

I dont know much about ffmpeg so any explanations, help or hint is appreciated.

Regards

Josh5 commented 2 years ago

what is the ffmpeg command that unmanic is failing on in your task history?

antipiot commented 2 years ago

what is the ffmpeg command that unmanic is failing on in your task history?

Hi Josh, thanks for your work on unmanic! Some errors and misunderstood of ffmpeg were done after some digging, i now understand ffmpeg better.

My first error was to belive that cpu x264 could do the tonemap, so no chances for this command to work. Actually tonemap commands fails if the target video has no HDR data.

This leads me to ask if there any way to filter HDR vidéos in unmanic?

image

Regards

Josh5 commented 2 years ago

what is the ffmpeg command that unmanic is failing on in your task history?

Hi Josh, thanks for your work on unmanic! Some errors and misunderstood of ffmpeg were done after some digging, i now understand ffmpeg better.

My first error was to belive that cpu x264 could do the tonemap, so no chances for this command to work. Actually tonemap commands fails if the target video has no HDR data.

This leads me to ask if there any way to filter HDR vidéos in unmanic?

image

Regards

At the moment you can filter on files that contain a regex match in the path name. So if the file does not have HDR in the file name, you could filter it out.

I think it would be cool to have a ffprobe filter plugin that limits files by data from an ffprobe