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

Support H265/HEVC for Livestreams/VODs #6330

Open
MattyBoombalatty opened this issue Apr 14, 2024 · 23 comments
Open

Support H265/HEVC for Livestreams/VODs #6330

MattyBoombalatty opened this issue Apr 14, 2024 · 23 comments
Labels
Status: Waiting for answer Waiting issue author answer

Comments

@MattyBoombalatty
Copy link

Describe the problem to be solved

After spending the good part of today editing a plugin I forked to enable H264 NVENC encoding, I realized that H265 only seems to be supported in VODs, not Livestreams. I'm not sure if this is an issue on my end, or with the browser (I tried several). The replay transcodes fine, and is viewable as normal

Describe the solution you would like

Enable H265/HEVC live video playback in browser.

@Chocobozzz
Copy link
Owner

I realized that H265 only seems to be supported in VODs, not Livestreams.

Can you describe the problem? Is the player unable to play the live stream? Or is the server unable to transcode it?

@Chocobozzz Chocobozzz added the Status: Waiting for answer Waiting issue author answer label Apr 15, 2024
@MattyBoombalatty
Copy link
Author

MattyBoombalatty commented Apr 15, 2024

I'm able to transcode it fine - I have a plugin and it works pretty well. However, the browser itself will not play the video during a livestream, only during the replay.

  1. Livestream with HEVC profile
  2. Video shows as live, but there is no video on screen
  3. Terminate livestream
  4. Replay video, which plays back in browser correctly

The only issue is that the video does not play back in browser. Please note that HEVC profile is enabled for VODs as well. Here's a link to my plugin if you wanted a better idea of how it works, in case I missed something.

https://gitea.nicecrew.digital/matty/peertube-plugin-nctv-nvenc-transcode

@MattyBoombalatty
Copy link
Author

MattyBoombalatty commented Apr 15, 2024

Here's the error - I was incorrect, this does happen with VODs too, on some browsers but I think it depends on what format they were uploaded in. Not sure.

Failed to play video
The video failed to play due to technical issues.

HLS.js error: mediaError - fatal: true - manifestIncompatibleCodecsError
\"reason\":\"no level with compatible codecs found in manifest\"

You can see a test video here.

It seems to work on mobile browsers (at least on Android) - perhaps it's an issue with desktop browsers not supporting H265? Either way, I figured I'd ask.

@MattyBoombalatty MattyBoombalatty changed the title Support H265/HEVC for Livestreams Support H265/HEVC for Livestreams/VODs Apr 15, 2024
@MattyBoombalatty
Copy link
Author

MattyBoombalatty commented Apr 16, 2024

Update:

H265 encoded VODs will play on Windows and Android mobile devices across Chromium based browsers (Brave, Chrome, Edge) Live videos will not. Perhaps it's the FFMPEG options that are passed in? Who knows.

H265 encoded VODs do not play on Linux browsers (tested Firefox, Chrome and Brave). Unfortunately I believe this is simply a limitation of supported devices.

It would still be nice to have Live videos encoded in H265 play on supported browsers and hardware, so I'll leave this open in an attempt to assist in future proofing PeerTube.

@Chocobozzz
Copy link
Owner

It would still be nice to have Live videos encoded in H265 play on supported browsers and hardware, so I'll leave this open in an attempt to assist in future proofing PeerTube.

Can you paste the web browser error when you try to play a H265 live?

@MattyBoombalatty
Copy link
Author

There is no error. Audio plays, but not video. It's just a black screen.

@emansom
Copy link
Contributor

emansom commented Apr 17, 2024

I'd recommend switching to VP9 instead, broader compatibility and should be supported by NVENC as well.

Edit: doesn't seem to be implemented in ffmpeg. Weird. AV1 a possibility, or card doesn't support it?

If AV1 is not supported and your goal is to increase video quality, with bandwidth being less of a concern: try H264 at 12Mbps bitrate per YouTube's recommendations.

@MattyBoombalatty
Copy link
Author

We already do use H264 NVENC and it works fine. I was just hoping to be able to support hevc_nvenc for future proofing and bandwidth constraints.

@emansom
Copy link
Contributor

emansom commented Apr 17, 2024

We already do use H264 NVENC and it works fine. I was just hoping to be able to support hevc_nvenc for future proofing and bandwidth constraints.

HEVC/H265 is dead due to licensing issues. Use AV1 for future proofing and bandwidth saving. 😉

@MattyBoombalatty
Copy link
Author

Well unfortunately the GPU in my server cares less about licensing issues and more about encoder support, of which, AV1 is not supported. ;)

@emansom
Copy link
Contributor

emansom commented Apr 17, 2024

Well unfortunately the GPU in my server cares less about licensing issues and more about encoder support, of which, AV1 is not supported. ;)

It's an industry wide concern, this is why web browser compatibility of H265/HEVC isn't broad.

AV1 has a permissible license, allowing web browsers and media appliances to implement software fallbacks without fear of legal ramifications.

AV1 implements similar in goal features to H265/HEVC, which results in similar increase in quality and bandwidth saving.

If you have the available budget: the Intel Arc A310 is a very good choice as hardware accelerated encoder. It supports H264, VP9, H265/HEVC and AV1.

@MattyBoombalatty
Copy link
Author

I am unfamiliar with Intel GPUs as they're relatively new to the market. I can budget for it, but that would also involve ensuring that there are Linux drives for it. I have a Tesla P4 at the moment and have been relatively pleased with it. I could, in theory, purchase one for research and see where it goes. I appreciate the heads up.

@emansom
Copy link
Contributor

emansom commented Apr 17, 2024

I am unfamiliar with Intel GPUs as they're relatively new to the market. I can budget for it, but that would also involve ensuring that there are Linux drives for it. I have a Tesla P4 at the moment and have been relatively pleased with it. I could, in theory, purchase one for research and see where it goes. I appreciate the heads up.

The kernel, Mesa drivers, VAAPI and ffmpeg support are all there in the latest stable releases. On rolling-release distro's like Fedora Rawhide/CentOS Stream 9 (+ ELRepo and locally recompiled Mesa to re-enable proprietary codecs) or Arch Linux it'd work.

There is the problem of fan control however, this is currently not yet implemented.

https://youtu.be/zjGieJci3xE

@MattyBoombalatty
Copy link
Author

Much appreciated.

@Chocobozzz
Copy link
Owner

@MattyBoombalatty Can you provide a permanent live stream link + a vod video link so I can try to find what's the cause of your issue?

@MattyBoombalatty
Copy link
Author

@Chocobozzz sure, when would be a good time for you? Did you want me to set up an HEVC encoded livestream and give you the link while it's going?

@Chocobozzz
Copy link
Owner

Did you want me to set up an HEVC encoded livestream and give you the link while it's going?

Yes please

@MattyBoombalatty
Copy link
Author

Okay, I'll do that tonight. Our time differences make this more difficult 😄

@MattyBoombalatty
Copy link
Author

Are you available for me to do this now?

@Chocobozzz
Copy link
Owner

Yes

@MattyBoombalatty
Copy link
Author

Here is the HEVC livestream:

https://nicecrew.tv/w/tpC3YaHrwTTn8Ys3gkJE8w

and an HEVC VOD

https://nicecrew.tv/w/mLbNbdTbhFFviFsD8zmtfp

@Chocobozzz
Copy link
Owner

Thanks, unfortunately the issue seems more complex that I thought. Can you try AV1 and tell me if it works?

@MattyBoombalatty
Copy link
Author

The transcoding GPU on my server does not support AV1, unfortunately. In the future I will likely upgrade GPUs, but I'll see if I can put together a plugin for it. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Waiting for answer Waiting issue author answer
Projects
None yet
Development

No branches or pull requests

3 participants