Opened 2 months ago

Last modified 2 months ago

#7347 reopened defect

HEVC HDR playback issues

Reported by: enen92 Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mov hevc dvvideo
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

FFmpeg (ffplay) incorrectly identifies video codec as dvvideo and fails. If you force hevc decoder it will play. Streams can be found here (labeled as HDR_HVEC):

https://sylvan.apple.com/Aerials/2x/entries.json

Example stream: ​https://sylvan.apple.com/Aerials/2x/Videos/LA_A006_C008_2K_HDR_HEVC.mov

This issue was also submitted on Kodi trac: https://trac.kodi.tv/ticket/17831

How to reproduce:

% ffplay https://sylvan.apple.com/Aerials/2x/Videos/LA_A006_C008_2K_HDR_HEVC.mov

Version: 4.0.2

Attachments (1)

LA_A006_C008_2K_HDR_HEVC_cut.mov (2.4 MB) - added by cehoyos 2 months ago.

Change History (16)

comment:1 Changed 2 months ago by enen92

  • Summary changed from HVEC HDR playback issues to HEVC HDR playback issues

comment:2 Changed 2 months ago by enen92

  • Keywords hevc added; hvec removed

comment:3 follow-up: Changed 2 months ago by jkqxz

The video stream is tagged as 'dvh1', indicating that it contains DVCPRO HD video. It actually does contain a valid H.265 stream, but FFmpeg does not probe the content of files where the container explicitly signals its parameters (H.265 video should be tagged as 'hvc1' or 'hev1').

You can remux the file with:

ffmpeg -c:v hevc -i LA_A006_C008_2K_HDR_HEVC.mov -c:v copy remuxed.mov

to make it playable.

Do you know how the file was created? Maybe the muxer which made it is misconfigured somehow?

comment:4 Changed 2 months ago by cehoyos

  • Component changed from ffmpeg to avformat
  • Keywords mov added; hdr removed
  • Reproduced by developer set
  • Status changed from new to open

Changed 2 months ago by cehoyos

comment:5 follow-up: Changed 2 months ago by heleppkes

'dvh1' is actually the FourCC for Dolby Vision videos (dvh1 for the hvc1 variant, dvhe for hev1). Although I could only find it in Dolby docs, not sure if they registered it officially for mov/mp4.

Is the DVCPRO HD code official somewhere? Or just something FFmpeg somehow "allows" in mov?

Apple devices definitely understand 'dvh1' (the Dolby Vision one), so considering Apple owns MOV, its probably valid.

Last edited 2 months ago by heleppkes (previous) (diff)

comment:6 in reply to: ↑ 5 Changed 2 months ago by cehoyos

Replying to heleppkes:

'dvh1' is actually the FourCC for Dolby Vision videos (dvh1 for the hvc1 variant, dvhe for hev1). Although I could only find it in Dolby docs, not sure if they registered it officially for mov/mp4.

They did (and it should definitely not been allowed).

Is the DVCPRO HD code official somewhere? Or just something FFmpeg somehow "allows" in mov?

https://web.archive.org/web/20070330141901/https://msdn.microsoft.com/archive/en-us/directx9_c/directx/htm/dvvideosubtypes.asp
Contrary to popular believe here, MEncoder was not the usual application writing such (mov) files.

comment:7 follow-up: Changed 2 months ago by heleppkes

Microsoft FourCCs are not automatically valid in every container format. They apply to AVI, not MOV or MP4.

comment:8 in reply to: ↑ 7 Changed 2 months ago by cehoyos

Replying to heleppkes:

Microsoft FourCCs are not automatically valid in every container format. They apply to AVI, not MOV or MP4.

I was neither saying this nor am I believing it. It's imo just not very helpful to mention it.

comment:9 in reply to: ↑ 3 ; follow-up: Changed 2 months ago by enen92

Replying to jkqxz:

The video stream is tagged as 'dvh1', indicating that it contains DVCPRO HD video. It actually does contain a valid H.265 stream, but FFmpeg does not probe the content of files where the container explicitly signals its parameters (H.265 video should be tagged as 'hvc1' or 'hev1').

You can remux the file with:

ffmpeg -c:v hevc -i LA_A006_C008_2K_HDR_HEVC.mov -c:v copy remuxed.mov

to make it playable.

Do you know how the file was created? Maybe the muxer which made it is misconfigured somehow?

Thanks for taking a look. I have no idea how the files were created. Those are the aerial videos Apple uses in their Apple TV4 screensaver. The main reason for posting the "bug" was mainly because I found vlc was able to play the file without any issues nor further configurations unlike ffmpeg. So I though maybe something could be improved in ffmpeg. I don't want nor need to remux the files, I can already play them in ffplay if I force the hevc decoder.
If it is a false positive feel free to close.

comment:10 Changed 2 months ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

comment:11 in reply to: ↑ 9 Changed 2 months ago by cehoyos

Replying to enen92:

The main reason for posting the "bug" was mainly because I found vlc was able to play the file without any issues nor further configurations unlike ffmpeg.

Thank you for the report, it is much appreciated! We love samples that don't work here;-)

comment:12 Changed 2 months ago by Igor_Selivanov

  • Resolution fixed deleted
  • Status changed from closed to reopened

It will be nice to implement not only Dolby Vision "dvh1" profile, but also "dvhe", "dva1" und "dvav" Dolby Vision profiles. The follow patch fixes codec recognition error.

+++ libavformat/isom.c    (working copy)
@@ -164,6 +164,13 @@
     { AV_CODEC_ID_HEVC, MKTAG('h', 'e', 'v', '1') }, /* HEVC/H.265 which indicates parameter sets may be in ES */
     { AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which indicates parameter sets shall not be in ES */
 
+    // Dolby vision HEVC
+    { AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', 'e') }, /* HEVC/H.265 Dobly Vision HEV1  */
+    //{ AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', '1') }, /* HEVC/H.265 Dolby Vision HVC1  */
+    // Dolby vision H264
+    { AV_CODEC_ID_H264, MKTAG('d', 'v', 'a', 'v') }, /* HEVC/H.264 Dolby Vision AVC3S  */
+    { AV_CODEC_ID_H264, MKTAG('d', 'v', 'a', '1') }, /* HEVC/H.264 Dolby Vision AVC1  */
+
     { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
     { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '2') },
     { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') },

Please note that patch above works only for mov container (and not for mp4, mkv, ts ...). Unfortunately MKTAG('d', 'v', 'h', '1') codec_tag is already used for AV_CODEC_ID_DVVIDEO codec. It's why it's commented in my patch, but it will be nice to have at least for "mp4" und "ts".

Dolby Vision public documentation can be found under:
https://www.dolby.com/us/en/technologies/dolby-vision/dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.0.pdf
https://www.dolby.com/in/en/technologies/dolby-vision/dolby-vision-profiles-levels-v1-2-92-171021.pdf

Dobly Vision transport stream with codec tag "dvhe" can be found under:
http://4kmedia.org/tag/dolby-vision/

I hope it helps (FYI: VLC supports Dolby Vision profiles)
Thanks in advance

comment:13 Changed 2 months ago by cehoyos

Please send your patch - made with git format-patch - to the FFmpeg development mailing list, patches are ignored here.

comment:14 Changed 2 months ago by cehoyos

Please move the new H.264 tags below the existing H.264 tags.

comment:15 Changed 2 months ago by Igor_Selivanov

Patch is sent to FFmpeg development mailing list.

Note: See TracTickets for help on using tickets.