To convert a MOV file to MP4 while preserving HDR (High Dynamic Range), you can use the following FFmpeg command:

ffmpeg -i input.mov -c:v libx265 -crf 18 -preset slow -pix_fmt yuv420p10le -x265-params 'hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=1000,400' -c:a copy output.mp4

This command uses the libx265 encoder to encode the video into HEVC (H.265) format and uses a CRF (Constant Rate Factor) of 18 for compression. You can adjust the CRF value as needed; a lower value will result in higher quality but a larger file. The -preset slow option specifies a balance between encoding speed and quality, which you can adjust as needed.

The -pix_fmt yuv420p10le option specifies the pixel format, which supports 10-bit color depth. This is necessary to preserve HDR.

The -x265-params option is used to pass more parameters to the libx265 encoder to specify HDR metadata. In this example, we use the BT.2020 color space, SMPTE ST 2084 transfer function, BT.2020 non-constant chroma matrix, and the master display color coordination information G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1) along with the maximum content light level (MaxCLL) and maximum frame average light level (MaxFALL).

Finally, the -c:a copy option copies the audio stream to the output file without re-encoding.

Please note that you will need a HDR-capable player and display device to properly view the HDR content in the converted MP4 file.

FFmpeg MOV to MP4 with HDR Preservation: Comprehensive Guide

原文地址: https://www.cveoy.top/t/topic/qiFO 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录