1

I hope this is the right forum for this question; StackOverflow directed me here.

My Fuji X-T3 generates an FHD movie as a .mov with HEVC video and PPM audio (plus a QuickTime TC stream). The new Media Player on Windows and Movies & TV won't play this (without buying a codec) so I convert it to .mp4 using ffmpeg CLI (ffmpeg -i in.mov out.mp4). The resulting .mp4 file uses AVC video and AAC LC audio. This plays fine in VLC and MPC, but will not play in Windows Media Player, Media Player or Movies & TV. Looking at MediaInfo the AVC codec kept the 10 bit depth of the HEVC stream - which Windows players doesn't seem to play. I added "-pix_fmt yuv420p" to fix the bit depth to 8 bits. Now WMP plays it perfectly. But in MP and M&TV it looks overexposed and some of the colors are off. MediaInfo for the input file shows

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5.2@High
Codec ID                                 : hvc1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 13 s 13 ms
Bit rate                                 : 201 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 3.236
Stream size                              : 312 MiB (97%)
Language                                 : English
Encoded date                             : 2023-08-14 16:16:08 UTC
Tagged date                              : 2023-08-14 16:16:08 UTC
Color range                              : Full
Color primaries                          : BT.2020
Transfer characteristics                 : HLG
Matrix coefficients                      : BT.2020 non-constant
Codec configuration box                  : hvcC

Audio ID : 2 Format : PCM Format settings : Little / Signed Codec ID : lpcm Duration : 13 s 13 ms Bit rate mode : Constant Bit rate : 2 304 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Bit depth : 24 bits Stream size : 3.57 MiB (1%) Language : English Encoded date : 2023-08-14 16:16:08 UTC Tagged date : 2023-08-14 16:16:08 UTC

Other ID : 3 Type : Time code Format : QuickTime TC Duration : 13 s 13 ms Bit rate mode : Constant Frame rate : 29.970 (30000/1001) FPS Time code of first frame : 00:15:55;05 Time code of last frame : 00:16:08;06 Time code, stripped : No Language : English Encoded date : 2023-08-14 16:16:08 UTC Tagged date : 2023-08-14 16:16:08 UTC

Media for the output file shows

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 13 s 13 ms
Bit rate                                 : 3 166 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.051
Stream size                              : 4.91 MiB (96%)
Writing library                          : x264 core 164 r3107 a8b68eb
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : HLG
Matrix coefficients                      : BT.2020 non-constant
Codec configuration box                  : avcC

Audio ID : 2 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 13 s 13 ms Source duration : 13 s 34 ms Bit rate mode : Constant Bit rate : 132 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Frame rate : 46.875 FPS (1024 SPF) Compression mode : Lossy Stream size : 208 KiB (4%) Source stream size : 208 KiB (4%) Language : English Default : Yes Alternate group : 1

Other ID : 3 Type : Time code Format : QuickTime TC Duration : 13 s 13 ms Frame rate : 29.970 (30000/1001) FPS Time code of first frame : 00:15:55;05 Time code of last frame : 00:16:08;06 Time code, stripped : Yes Language : English Default : No

The "Color range: Limited" looks suspicious; but the video plays fine (looks correct) in VLC, MPC and now WMP. MP and M&TV play fine, but the video looks overexposed (everything too light). Before using the -pix_fmt option I tried different bit rates, removing the QuickTime TC channel, moving the metadata to the front, and others - but until the -pix_fmt, the output video would not play in WMP, MP or M&TV (it did play in VLC and MPC in all cases).

Another interesting thing is the output still has a QuickTime TC stream, but MediaInfo says "Timecode, stripped: yes" - I'm not sure what that means.

Has anyone else seen and solved this problem? Any help would be greatly appreciated.

1 Answers1

0

We may use zscale filter for converting from BT.2020 HDR standard to BT.709 SDR standard:

ffmpeg -y -i DSCF0541.MOV -vf "zscale=out_range=limited:primaries=bt709:transfer=bt709:matrix=bt709" -c:v libx264 -pix_fmt yuv420p -c:a aac -bsf:v h264_metadata=video_full_range_flag=0:colour_primaries=1:transfer_characteristics=1:matrix_coefficients=1 output.mp4

Note that the conversion from HDR to SDR assumes that video is intended to be displayed on non-HDR monitor (and assumes that the video player HDR to SDR conversion is not optimal or that HDR is not supported by the player).


The original video has 10 bits per component, BT.2020 Color Primaries and Matrix Coefficients and HLG "Gamma" transfer function that applies HDR content.
We want the output video to have 8 bits per component and BT.709 Color Primaries, Matrix Coefficients and Gamma that applies SDR content (BT.709 is recommended for SDR 1080p content).
We also want to convert from "Full Rane" to "Limited Range" standard, because some video players have issues with "Full range" YUV components.

  • zscale=out_range=limited:primaries=bt709:transfer=bt709:matrix=bt709 - Converts the HDR input video to "Limited Rane", BT.709 standard output video.
  • -pix_fmt yuv420p - Selects YUV420 with 8 bits per component.
  • -bsf:v h264_metadata=video_full_range_flag=0:colour_primaries=1:transfer_characteristics=1:matrix_coefficients=1 - Marks the H.264 video stream as "Limited Rane", BT.709.

About the "Timecode, stripped: yes", I am also not sure what that means (I think FFmpeg doesn't support Timecodes, and copies the Timecodes form the input to the output in a wrong way).

Rotem
  • 3,346