ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.

Home Page:https://ossrs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

H265: Support HEVC in RTMP/SRT/HLS/WebRTC/DASH/GB28181

winlinvip opened this issue · comments

赵文杰 20:38:44
Actually, for RTMP to support H.265, we need Adobe's approval.
赵文杰 20:38:58
There's no problem with HLS supporting H.265.
杨成立 20:39:02
As long as FFMPEG can play it, it's fine.
杨成立 20:39:06
Adobe is not an option.
赵文杰 20:39:32
Yes, SRS supports it easily, it depends on the RTMP parser.
杨成立 20:39:45
If VLC can play it, it's fine. You can provide a patch and see if VLC accepts it. If not, we can start a project.
赵文杰 20:39:51
Also, let's first create a streaming client.
杨成立 20:39:58
The delay is still too long for live streaming using HLS.
赵文杰 20:40:16
Okay, how about ffplay? Can it play it?
杨成立 20:40:24
Yes, it can.

TRANS_BY_GPT3

Doesn't srs 2.0 release support it?

TRANS_BY_GPT3

Now I want to implement h265 HLS live streaming on version 2.0. I want to support h265 by modifying the code and use the latest ffmpeg to transcode the rtmp stream. However, it seems that h265 does not support flv, so I cannot directly transcode it like this (SRS transcodes to rtmp). In this case, is there a solution? The solution I thought of is to let SRS generate hls segments first, and then transcode each segment to h265.

TRANS_BY_GPT3

The problem for SRS to support H.265+RTMP/FLV is no encoder support publish H.265 stream, so I filed a issue for FFMPEG. But it seems there is no reason for FFMPEG to support a private stuff that Adobe not update, so maybe I should ask Adobe about upgrading the RTMP/FLV protocol for H.265, which may take a very long time. Well, there seems no workaround for this issue.

It's very important for RTMP/FLV to support H.265, because for the interactive live streaming, which is 1-3s latency live streaming, the protocol plays an extremely important role and only RTMP/FLV is friendly to CDN. Neither HLS or DASH is possible to get 1-3s latency, even though I refine the HLS to HLS+(which is standard HLS with very dynamic small segments, about 0.8-1.2s segments), the latency of HLS is still 6s+. I want to tell everyone a rule ALL segment based protocols such as HLS and DASH have large latency, they're impossible to get 1-3s latency.

If your businesses require 1-3s latency and maybe migrate from H.264 to H.265, please comment to vote this issue FFMPEG. Remember only when your business is requiring H.265+RTMP/FLV then vote it, or FFMPEG developer will think all these votes are from sockpuppet accounts.

@winlinvip, take a look at this link and you will understand why H.265 is not supported: https://wenku.baidu.com/view/3905adeec850ad02df80414d.html

TRANS_BY_GPT3

@huanghe2015 FFMPEG does not support it not because of patent and licensing issues, but because Adobe has not updated the RTMP/FLV protocol. So if FFMPEG wants to support it, it would have to implement a non-standard protocol, which is not suitable for FFMPEG. In fact, other encoding methods, such as VP9 or the domestic standard mentioned in the article, would also have the same problem if FFMPEG were to support RTMP/FLV. So in reality, FFMPEG's lack of support for RTMP/FLV is like a death sentence, and we won't be able to work with it for real-time streaming.

For English user:
Nop, FFMPEG reject this feature not for fee, it's only because RTMP/FLV doesn't support H.265. So the right way is to wait for Adobe to upgrade the RTMP/FLV for H.265, or FFMPEG will be a private implmentation of H.265+RTMP/FLV. But this issue also exists when support other new codecs, such as VP9+RTMP/FLV, so it's a hard time for live streaming developer, especially for 1-3s interactive live streaming service.

TRANS_BY_GPT3

There is a patch for FFMPEG to publish 265 over FLV: https://github.com/CDN-Union/Code/tree/master/flv265-ChinaNetCenter

FLV CodecID for H.265 by Kingsoft: https://github.com/CDN-Union/Code/tree/master/flv265-Kingsoft

Give up to support H.265 in FLV/RTMP, SRS3 will support it in HTTP-TS and HLS.

FFmpeg patch show both the document and code about the extensions for H.265/HEVC over flv, which defines the codec id 12 for HEVC video packet for rtmp/flv live streaming.

Regarding 265, my latest understanding is:

  1. TS is supported, which means HLS can package this codec. However, Safari, iOS, and Android browsers do not support this decoding. It only means that HLS packaging can support it.
  2. RTMP is not supported because it is not updated by the official, which leads to FFMPEG only being able to support it through patching.
  3. There are patent issues with 265, which may prevent it from being widely adopted. The current trend is to focus on codecs like AV1.

In summary, it is possible to support it, but it is estimated that it will only be supported within a small range.

TRANS_BY_GPT3

https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices

Apple's specifications require the use of fmp4 for h265. Although ts supports h265, currently, when transmitting h265 videos using the HLS protocol, fmp4 must be used.

TRANS_BY_GPT3

为啥我们的H265视频用srs的H265分支 播放不了,H264的视频可以播放

是因为SRS支持H265,但是浏览器不支持

Plan to support HEVC in SRS 6.0

When playing h265 with ffplay, there will be a freeze

I noticed that ByteDance company uses flv to transmit hevc, including tiktok and douyin.FLV has extremely low latency.

TS stream local buffering for up to 10 seconds, flv < 1s