restreamer icon indicating copy to clipboard operation
restreamer copied to clipboard

H265 support, why not?

Open giuseppegambino92 opened this issue 3 years ago • 10 comments

Hi, I wanted to understand why the H.265 format is not supported, and possibly understand what the incompatibility depends on. Eventually I could also move to make a commit request. Thanks in advance

giuseppegambino92 avatar Mar 09 '21 14:03 giuseppegambino92

H.265 is basically supported such that you can pull it in e.g. from a camera, but you need to re-encode it to H.264.

For HLS playback, only H.264 is widely supported in clients (browsers). Theorically it is possible to have H.265 in a HLS stream (with fragmented mp4 instead of TS), but on some platforms/browsers/players it's not supported.

ioppermann avatar Mar 10 '21 10:03 ioppermann

I just got a new camera and it's H265 for rtsp. I also believe that youtube supports accepting h265 as well. Anyway to make this work?

hemna avatar May 17 '22 16:05 hemna

Hello hemna

I am not sure if YouTube works with h265. You would have to check.

Install the latest Restreamer and try this.

https://www.youtube.com/watch?v=oVCEMUguskA

Then you can transfer your stream to YouTube via the publication service.

https://www.youtube.com/watch?v=dwywuaIQPRg&t=5s

cheerio Sven

svenerbeck avatar May 17 '22 17:05 svenerbeck

It's up, but I think it's pulling h264 from the source.

https://youtu.be/H70aJ6TZKSo

hemna avatar May 17 '22 18:05 hemna

This should be in the log files, aka—process details.

If you want, you can send the two files. I will take a look at it.

The banner file should be enough.

Here you can see where to do it:

https://docs.datarhei.com/restreamer/knowledge-base/manual/process-details

cheerio Sven

svenerbeck avatar May 17 '22 18:05 svenerbeck

Here is the banner. It seems to work for a bit, and then packets fall off until ffmpeg restarts then it works again. That repeater pattern takes about 35 seconds.

ffmpeg version 4.4.2-datarhei Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.3.1 (Alpine 10.3.1_git20211027) 20211027
  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, rtsp, from 'rtsp://admin:[email protected]:554//h265Preview_01_main':
  Metadata:
    title           : Session streamed by "preview"
    comment         : h265Preview_01_main
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: hevc (Main), yuv420p(tv), 2560x1440, 25 fps, 25 tbr, 90k tbn, 90k tbc
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[hevc @ 0x7fb99ad3f940] Could not find ref with POC 3
[libx264 @ 0x7fb99ad41600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x7fb99ad41600] profile Constrained Baseline, level 5.0, 4:2:0, 8-bit
[libx264 @ 0x7fb99ad41600] 264 - core 163 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=22 lookahead_threads=16 sliced_threads=1 slices=22 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=50 keyint_min=5 scenecut=0 intra_refresh=0 rc_lookahead=0 rc=cbr mbtree=0 bitrate=12288 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=12288 vbv_bufsize=12288 nal_hrd=none filler=0 ip_ratio=1.40 aq=0
Output #0, hls, to 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f.m3u8':
  Metadata:
    comment         : h265Preview_01_main
    title           : http://216.126.34.219:8090/620fd947-6422-4969-8730-a37f667a263f/oembed.json
    service_provider: datarhei-Restreamer
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264, yuv420p(tv, progressive), 2560x1440, q=2-31, 12288 kb/s, 25 fps, 90k tbn
    Metadata:
      encoder         : Lavc58.134.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 12288000/0/12288000 buffer size: 12288000 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
@1652816154     comment         : h265Preview_01_main
@1652816154   Duration: N/A, start: 0.000000, bitrate: N/A
@1652816154   Stream #0:0: Video: hevc (Main), yuv420p(tv), 2560x1440, 25 fps, 25 tbr, 90k tbn, 90k tbc
@1652816154   Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
@1652816154 Stream mapping:
@1652816154   Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
@1652816154   Stream #0:1 -> #0:1 (copy)
@1652816154 Press [q] to stop, [?] for help
@1652816154 [hevc      ] PPS changed between slices.
@1652816154 [hevc      ] Error parsing NAL unit #0.
@1652816154 [hevc      ] Could not find ref with POC 30
@1652816154 Error while decoding stream #0:0: Invalid data found when processing input
@1652816154 [libx264   ] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
@1652816154 [libx264   ] profile Constrained Baseline, level 5.0, 4:2:0, 8-bit
@1652816154 [libx264   ] 264 - core 163 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=22 lookahead_threads=16 sliced_threads=1 slices=22 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=50 keyint_min=5 scenecut=0 intra_refresh=0 rc_lookahead=0 rc=cbr mbtree=0 bitrate=12288 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=12288 vbv_bufsize=12288 nal_hrd=none filler=0 ip_ratio=1.40 aq=0
@1652816154 Output #0, hls, to 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f.m3u8':
@1652816154   Metadata:
@1652816154     comment         : h265Preview_01_main
@1652816154     title           : http://216.126.34.219:8090/620fd947-6422-4969-8730-a37f667a263f/oembed.json
@1652816154     service_provider: datarhei-Restreamer
@1652816154     encoder         : Lavf58.76.100
@1652816154   Stream #0:0: Video: h264, yuv420p(tv, progressive), 2560x1440, q=2-31, 12288 kb/s, 25 fps, 90k tbn
@1652816154     Metadata:
@1652816154       encoder         : Lavc58.134.100 libx264
@1652816154     Side data:
@1652816154       cpb: bitrate max/min/avg: 12288000/0/12288000 buffer size: 12288000 vbv_delay: N/A
@1652816154   Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
@1652816155 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0078.ts' for writing
@1652816157 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0079.ts' for writing
@1652816157 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0072.ts' for writing
@1652816159 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0080.ts' for writing
@1652816159 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0073.ts' for writing
@1652816161 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0081.ts' for writing
@1652816161 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0074.ts' for writing
@1652816163 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0082.ts' for writing
@1652816163 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0075.ts' for writing
@1652816165 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0083.ts' for writing
@1652816165 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0076.ts' for writing
@1652816167 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0084.ts' for writing
@1652816167 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0077.ts' for writing
@1652816169 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0085.ts' for writing
@1652816169 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0078.ts' for writing
@1652816171 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0086.ts' for writing
@1652816171 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0079.ts' for writing
@1652816173 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0087.ts' for writing
@1652816173 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0080.ts' for writing
@1652816175 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0088.ts' for writing
@1652816175 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0081.ts' for writing
@1652816177 [hls       ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0089.ts' for writing
@1652816177 [mpegts    ] Opening 'http://admin:apx2gkL94lyi1opkrY@localhost:8080/memfs/620fd947-6422-4969-8730-a37f667a263f_0082.ts' for writing

hemna avatar May 17 '22 19:05 hemna

Thank you.

I'll take a look at it tomorrow. As far as I can tell, YouTube does not support H265.

This is what the documentation says: https://support.google.com/youtube/answer/1722171?hl=en#zippy=%2Cvideo-codec-h

cheerio Sven

svenerbeck avatar May 17 '22 19:05 svenerbeck

Thanks, It would be nice to see the actual ffmpeg command line args that were used to start ffmpeg. I'm trying to figure out why ffmpeg dies after 35 seconds

hemna avatar May 17 '22 21:05 hemna

Hello hemna

The banner looks excellent. You can see that H.265 is converted to H.264.

After more intensive research, we found this for you. YouTube can receive H.265 over HLS.

You can see it here: https://developers.google.com/youtube/v3/live/guides/ingestion-protocol-comparison

It does not work via the Restreamer UI at the moment. So we always convert H.265 to H.264.

If you want to do that, you can, but you have to take the datarhei Core and make the appropriate adjustments yourself. The datarhei Core is here: https://github.com/datarhei/core

cheerio Sven

svenerbeck avatar May 18 '22 07:05 svenerbeck

I would love to have a option to copy h265. VLC is able to play it. So i can play H265 camera's on multiple location without transcoding. As that takes a lot of resources.

Pimmetje avatar Jul 03 '22 21:07 Pimmetje

Hi @Pimmetje We are closing your issue https://github.com/datarhei/restreamer/issues/250.

This may be due to the following reasons:

  • Problem/inquiry has been solved
  • The ticket remained unanswered by you for a more extended time
  • The problem was explained and handled in another ticket

You can reopen this ticket at any time!

Please do not open related tickets twice. Always answer/ask in the original issue with the same problem.

Your datarhei team //Sven

svenerbeck avatar Oct 17 '22 15:10 svenerbeck