Foliovision › Forums › FV Player › How to … › H.265 streaming
-
Greetings,
I’m planning to get FV Player and stream HLS. Got two questions.
1. H.264 is supported everywhere, while H.265 is not widely supported, but has better compression. I would like to find out how I can stream H.265 if the device supports it, then fall back to H.264 if it doesn’t.
2. HLS automatically selects the stream based on the connection’s speed. What if the screen resolution is HD (720p), but the connection can support Full HD (1080p)? Will a Full HD stream be called? If so, that will be a waste of bandwidth, because the device’s screen only supports HD. I would like the stream to match the device’s screen resolution. How can that be done? Or is it done automatically?
Regards,
Nich
-
-
Hello Nich,
1) It appears you can use VP9 codec for Chrome, Firefox, Edge and Android in a WebM container and H265 in an MP4 container for Safari and iOS: https://foliovision.com/support/fv-wordpress-flowplayer/how-to/mkv-vp9-and-mp4-h265-on-one-video#post-74297
However streaming the video from a single file is not perfect and something like like HLS is much better.
You can actually create a HLS stream where you provide a mix of streams with H265 and H264 codecs. I was able to setup that up here: https://foliovision.com/player/demos/hls-stream -> “HLS STREAM WITH H265 AND H264 CODECS”
I used AWS MediaConvert. You have to pick the CMAF output type with Segmented Files to make sure the HLS stream will use fMP4 segments (.m4s) rather than TS as iOS doesn’t support H265 in TS.
In that video there is 1080p video with H265 and 360p with H264, so you can tell what you are getting. I get the 1080p stream on iPad 6th generation just fine. Although it won’t play for me in Safari 12.1.1 on macOS 10.12.6 – no H265 HLS plays for me there.
2) FV Player will limit the video resolution to the player size. See that if you play the “AWS MediaConvert” video on https://foliovision.com/player/demos/encrypted-hls-stream You only get 720p or 1080p if you go fullscreen.
On desktop computers this is done with the HLS.js library, on iOS it uses it’s own HLS engine which is even better.
Thanks,
MartinHi Video,
At this point, H265 support is limited. H265 only really runs properly on devices with dedicated hardware support (and software drivers for it). We will be adding additional H265 support as H265 slowly acquires support among streaming services over the next couple of years.
As Martin explained, FV Player does support H265 but setting up the streaming is a lot of trouble. It’s too early to troubleshoot H265 issues as part of our standard plugin license. So you are in for either a lot of troubleshooting yourself or you’ll have to pick up pro support incidents to have us troubleshoot your H265 issues for you.
Hi Martin, i am trying to test H.265 codec on FV Flowplayer Video Player.
steps:
- i took 4K video
- transcoded it using MediaConvert using container “MPEG-2 Transport Stream for Apple Adaptive” (which we also use for HLS codec H.264 for lower resolutions <= Full HD)
- i tested resulted HLS video using:
desktop MacOS VLC – success
hls.js demo page (https://hlsjs.video-dev.org/demo/) – success
FV Flowplayer Video Player – fail (player downloads ts-file, progressbar ticks seconds, but i don’t see picture)
questions:
- what is the possible issue and how to debug the reason?
- does FV Flowplayer Video Player compatible with MediaConvert “MPEG-2 Transport Stream for Apple Adaptive” container to create HLS? we use it for different resolutions without issues, but now want to try with 4K
- maybe you have other suggestions (from your experince) about best MediaConvert-presets/containers/… for HLS, which will work for FV Flowplayer Video Player?
- does FV Player 8 has better compatibility with H.265?
P.S. job.json, raw and resulted video files in the attachments: https://drive.google.com/file/d/1uj4Kw-_OgAyj4UGwJGS1eo4BK9nqHlO0/view?usp=sharing
Thanks!
Hello Sergey,
Thank you for all the details and your HLS stream files.
FV Player 8 uses HLS.js 1.4.12, while the latest version is 1.6.5.
I see we could upgrade and then your stream would start playing.
However – I don’t like the fact that your HLS stream does not play on iPhone 11 Pro Max nor iPhone 16 Pro which I have a hand.
We cannot use HLS.js on iPhone as the web browser there do not support Media Source Extensions.
I checked
codecs
attribute in your m3u8 file and it says:hev1.1.6.L153.B0,mp4a.40.2
Using using Level of 5.1.
Here’s a different HLS stream with H265 codecs which plays with your version of HLS.js and also on the two iPhones which I was mentioning: https://bitmovin-a.akamaihd.net/content/dataset/multi-codec/hevc/stream_fmp4.m3u8
I has the following
codecs
:hvc1.1.c.L120.90,mp4a.40.2
Using using Level of 4.0 which means it’s easier to decode, although it seems to limit 4K stream to 30 fps.
So it seems you should be trying to find a balance of the video quality and device support.
Perhaps all you need is to add a lower resolution stream which the older iPhones would play just fine.
But unless you need 4K at 60 fps I would be using the lower Level of 4.0.
Thanks,
MartinHello, Martin, thanks for the fast response! :)
i changed codec level to 4.0, 4.1. in both cases MediaConvert returned error:
1040 – Error initializing encoder for video target [1] [initialization failed: Invalid level specified for the selected resolution.]on level 5.0 it processed, but with the same result as on 5.1 – no picture.
so it is really interesting which parameters to use in MediaConvert to get applicable HLS-result compatible +/- with different OS/browsers.
MediaConvert doesn’t have system presets:
a) for HLS using H.264 for resolutions higher than Full HD (but it should be compatible – https://docs.aws.amazon.com/mediaconvert/latest/ug/supported-output-resolution-maximums-by-codec.html)
b) for HLS using H.265their support answered to me like: you can create own preset by using parameters/values from other Generic-presets or using https://developer.apple.com/documentation/http-live-streaming/hls-authoring-specification-for-apple-devices.
also i checked fast your suggested playlist https://bitmovin-a.akamaihd.net/content/dataset/multi-codec/hevc/stream_fmp4.m3u8.
AFAIU it is CMAF, because it has not ts-segments, but m4s. this container i didn’t use before, because i trusted that HLS – is completely enough for my needs. and internet AFAIR said that HLS is wider supported.
but in general HLS should work nowadays? how iPhone 16 unable to play it? :) if it unable – then what can?Hello Sergey,
I was testing a HLS stream created with Apple Compressor. It contains the following video streams:
#EXTM3U #EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6081126,BANDWIDTH=7976053,CODECS="mp4a.40.2, hvc1.1.60000000.L120.B0",RESOLUTION=1920x1080 HEVC Broadband HD (and 4G LTE and higher) #EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=12398816,BANDWIDTH=18128342,CODECS="mp4a.40.2, hvc1.1.60000000.L150.B0",RESOLUTION=3840x2160 HEVC Broadband UHD (and 4G LTE and higher) #EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3581290,BANDWIDTH=4253971,CODECS="mp4a.40.2, hvc1.1.60000000.L93.B0",RESOLUTION=1280x720 HEVC Cellular large (3G or lower) #EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1786976,BANDWIDTH=2362768,CODECS="mp4a.40.2, hvc1.1.60000000.L90.B0",RESOLUTION=960x540 HEVC Cellular medium (3G or lower) #EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=246126,BANDWIDTH=430027,CODECS="mp4a.40.29, hvc1.1.60000000.L63.B0",RESOLUTION=640x360 HEVC Cellular small - (3G or lower)
So if we break it down by bitrate and HEVC level:
Resolution Average Bandwidth (Mbps) HEVC Level 3840×2160 (4K UHD) 12.40 Mbps Level 5.0 1920×1080 (Full HD) 6.08 Mbps Level 4.0 1280×720 (HD) 3.58 Mbps Level 3.1 960×540 (qHD) 1.79 Mbps Level 3.0 640×360 (nHD) 0.25 Mbps Level 2.1 All of these are HEVC “Main” profile,
60000000
forgeneral_profile_compatibility_flags
andB0
foradditional general_constraint_indicator_flags
.I tested it on varios devices and it plays even on iPhone 6s which is 10 years old. Although it would only go up to 1280×720 pixels on it.
Google Pixel 4 phone which is 6 years old plays fine too.
I still want to test on 10 or 15 years old computer with Fedora Linux.
Thanks,
MartinHello, Martin
continue reading articles.. due to this answer: https://repost.aws/questions/QUAUznNk7VT3mosH8v9McRDw/mediaconvert-hevc-forcing-hvc1-tag-in-an-hls-output-group it seems CMAF is the unique possible solution to play HLS on iPhone and other places.
today transcoded video as CMAF:
hev1.1.6.L150.B0,mp4a.40.2
hvc1.1.6.L150.B0,mp4a.40.2 (this result on attachments: https://drive.google.com/file/d/1MvEOr9O8aHg_cj5usF70-QrsAyBXc38Q/view?usp=sharing)result:
macOS chrome https://hlsjs.video-dev.org/demo – success
macOS chrome https://developer-tools.jwplayer.com/stream-tester – success
macOS safari direct m3u8 – success
ipadOS safari direct m3u8 – success
FV Player 7/8 – unable to playquestions:
- why do you think FV Player 7/8 unable to play CMAF? lower version or hls.js or something else?
- how do you test transcoded streams on Android/iPhone? do you use some website or applications?
- how do you think WHY MediaConvert has possibility to transcode videos to TS-segments in HLS using H.265 if this result can’t be played (confirmed by my and your tests) on iPhone platform, strictly for which HLS was created?
thanks!
Hello Sergey,
Upgrading HLS.js would fix the issue. FV Player would then play all the same streams with the HLS.js dome page plays.
But it’s not so simple with HEVC –
That Apple Compressor HEVC HLS plays fine on both iPhone 11 Pro Max and 16 Pro. Although it does not seem to switch to the 4K resolution, not even if I go to fullscreen in horizontal device orientation. The 4K stream uses Level 5.0 which might be too complex for iPhone.
It plays on Google Pixel 4 phone with Android 13 and up to date Google Chrome browser too. That’s good as that device is 6 years old.
It also plays on iPhone SE from 2020, although it seems to max out on the 1280×720 resolution for which it’s Level 3.1 of HEVC.
1280×720 even plays in iPhone 6s, which dates back to 2015! It does not even try to use the higher resolution, so it probably does not support Level 4.0 of HEVC.
However – it does not play on Windows 10 or 11 without either a paid video codec (https://apps.microsoft.com/detail/9nmzlz57r3t7) or without hardware support for HEVC.
I don’t think a typical low end computer with Windows which you buy today would be able to play these HEVC streams. We will have to check.
We might come up with a strategy for HEVC for FV Player Coconut. Since most people who do not get HEVC support are on older desktop computers, providing a H264 720p or 1080p stream for the might be a good enough.
Thanks,
MartinHello Martin, thanks for the info! your answers are very valuable and helpful!
questions:
- how do you test transcoded streams on Android/iPhone? do you use some website or applications or simply direct URL to m3u8 in browser?
- do you have any roadmap to update HLS.js in FV Player? will it be upgraded only for version 8 or 7 also?
- do you have demo page, where it is possible to test concrete video URL in FV Player? AFAIS all URLs in demos are hardcoded and my attempts to inject own URL into player in HTML are failed
thanks!
Hello Sergey,
-
We test on real devices. The iOS Simulator in X Code on macOS is also very handy.
-
The new HLS.js library is about 1/3 bigger than the previous version, otherwise we would upgrade to it right away.
-
We would like to have such page which would let us also compare FV Player to other libraries.
Thanks,
Martin