Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with HEVC, Dolby Vision, fmp4 #1568

Open
akkiyan opened this issue Mar 2, 2025 · 1 comment
Open

Issues with HEVC, Dolby Vision, fmp4 #1568

akkiyan opened this issue Mar 2, 2025 · 1 comment

Comments

@akkiyan
Copy link

akkiyan commented Mar 2, 2025

There is a problem and I will go straight to the point.

/root/ffmpeg/bin/ffmpeg -analyzeduration 500M -probesize 500M -y -i /root/video/input.mkv -dolbyvision 1 -strict unofficial -ignore_chapters 1 -map_chapters -1 -map_metadata -1 -map 0:v:0 -map 0:a:0 -metadata:s:a:0 title="dub" -c:a:0 aac -ac:a:0 6 -ar:a:0 48000 -b:a:0 320k -disposition:a:0 default -filter:a:0 "volume=4dB" -vcodec libx265 -pix_fmt yuv420p10le -r 23.976023976024 -g 240 -vsync 1 -async 1 -vf zscale=width=640:height=-2:filter=lanczos -preset medium -profile:v main10 -level 5 -b:v 600k -maxrate 800k -bufsize 1600k -x265-params no-info=1:open-gop=0:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc -colorspace bt2020nc -color_trc smpte2084 -color_primaries bt2020 -max_muxing_queue_size 2048 -f mp4 -brand mp42 -movflags +faststart /root/video/output.mp4

ffmpeg generate this file:
File with -tag:v hvc1: https://mega.nz/file/XqxxHZzA#GEE7PFw-sXoyBzuV59OIxT3smfRyug9EDMw5d5Plgk4
File without -tag:v hvc1: https://mega.nz/file/OupglbIA#fZVN-VUB4WSrOcN1OLd_BAqWNQNAO8jamXKpY5l6kIg

nginx location config:
vod hls; vod_segment_duration 6000; vod_align_segments_to_key_frames on; vod_manifest_segment_durations_mode accurate; vod_hls_container_format fmp4;

Issues with Kaltura nginx-vod-module

Go to the https://hlsjs.video-dev.org/demo/ put your master.m3u8 link, set check "Dump transmuxed fMP4 data" and you will see this errors:
Found no media in msn
The video doesn't play. But if you uncheck the box "Dump transmuxed fMP4 data", then everything is fine. But only work HEVC, Dolby Vision does work.

Shaka Packager

If i mux with Shaka this ffmpeg file /root/video/output.mp4
./packager in=/root/video/output.mp4,stream=video,init_segment=cop5/init.mp4,segment_template=cop5/$Number$.m4s,playlist_name=cop5/main.m3u8,iframe_playlist_name=cop5/iframe.m3u8' \ --hls_master_playlist_output cop5/master.m3u8

It generates the following master.m3u8 file:
`#EXTM3U

#EXT-X-INDEPENDENT-SEGMENTS

#EXT-X-STREAM-INF:BANDWIDTH=879305,AVERAGE-BANDWIDTH=649924,CODECS="hvc1.2.4.L63.90",RESOLUTION=640x360,FRAME-RATE=23.976,VIDEO-RANGE=PQ,CLOSED-CAPTIONS=NONE
main.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=879305,AVERAGE-BANDWIDTH=649924,CODECS="dvh1.08.01",RESOLUTION=640x360,FRAME-RATE=23.976,VIDEO-RANGE=PQ,CLOSED-CAPTIONS=NONE
main.m3u8`

Result: works both HEVC and Dolby Vision.
This stream will be available to everyone, for those who have DV and for those who do not have DV (only HEVC)

But what's most surprising is that it will put information about different codecs into the master.m3u8, but in fact, it will generate one playlist segments files.

Dolby Vision

If i understand Dolby Vision validator requires a tag dby1.
https://ott.dolby.com/OnDel_tools/validator/Start_Here.html

In Shaka i found this code (but i don't have skills to understand problem and fix it)
L241: /shaka-packager-main/packager/media/formats/mp4/mp4_muxer.cc
// https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf std::string codec_string = static_cast<const VideoStreamInfo*>(streams()[0].get()) ->codec_string(); std::string supplemental_codec_string = static_cast<const VideoStreamInfo*>(streams()[0].get()) ->supplemental_codec(); if (codec_string.find("dvh") != std::string::npos || supplemental_codec_string.find("dvh") != std::string::npos || codec_string.find("dav1") != std::string::npos || supplemental_codec_string.find("dav1") != std::string::npos) ftyp->compatible_brands.push_back(FOURCC_dby1); FourCC extra_brand = static_cast<const VideoStreamInfo*>(streams()[0].get()) ->compatible_brand(); if (extra_brand != FOURCC_NULL) ftyp->compatible_brands.push_back(extra_brand);

Versions
nginx-vod-module: last master
hls.js v1.5.20 - nginx-vod-module does not work at all.
hls.js v1.6.0-beta.4 - nginx-vod-module works without "Dump transmuxed fMP4 data". Dolby Vision still does work.

@akkiyan
Copy link
Author

akkiyan commented Mar 2, 2025

I forgot one thing.
If you convert a file with libx264 codec and go to https://hlsjs.video-dev.org/demo/ and click on "Dump transmuxed fMP4 data", you will still get an error Found no media in msn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant