Edward-Wu / srt-live-server

srt live server for low latency
Other
650 stars 195 forks source link

HEVC Stream recognized as H264 #36

Open TyrasNistru opened 4 years ago

TyrasNistru commented 4 years ago

I'm trying to use ffmpeg and SLS to restream a H265/MPEG-TS video stream through SLS, but when I try to play the SRT stream that SLS serves, it is recognized as H264, giving me an audio-only stream.

The UDP-to-SRT ffmpeg call is as follows: ffmpeg -i udp://239.5.5.1:5004 -c copy -f mpegts "srt://localhost:5554?streamid=transmit/preview/23"

And I Try to play the SRT stream with the following command: ffplay -i srt://localhost:5554?streamid=player/preview/23

My sls.conf is:

srt {
    worker_threads  1;
    worker_connections 300 ;

    log_file logs/error.log ; 
    log_level info;

    server {
        listen 5554; 
        latency 20;

        domain_player player;
        domain_publisher transmit;
        backlog 100;
        idle_streams_timeout 10

        app {
            app_player preview ;           
            app_publisher preview ; 

            record_hls off;
            record_hls_segment_duration 10;
        }
    }
}

ffplay and ffprobe returns the following stream information:

Input #0, mpegts, from 'srt://localhost:5554?streamid=player/preview/23':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 ([27][0][0][0] / 0x001B), none, 24 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101](por): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 66 kb/s

preceded by a very long repetition of the following error:

[h264 @ 0x7ff92001cb40] no frame!
[h264 @ 0x7ff92001cb40] missing picture in access unit with size 185319
[h264 @ 0x7ff92001cb40] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x7ff92001cb40] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[h264 @ 0x7ff92001cb40] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x7ff92001cb40] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)

The Stream given to SLS is definitly HEVC:

Input #0, mpegts, from 'udp://239.5.5.1:5004':
  Duration: N/A, start: 4.813333, bitrate: N/A
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: hevc (HEVC / 0x43564548), yuv420p(tv), 1920x1080, 24 tbr, 90k tbn, 90k tbc
    Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 65 kb/s
Output #0, mpegts, to 'srt://localhost:5554?streamid=transmit/preview/23':
  Metadata:
    encoder         : Lavf58.39.101
    Stream #0:0: Video: hevc (HEVC / 0x43564548), yuv420p(tv), 1920x1080, q=2-31, 24 tbr, 90k tbn, 90k tbc
    Stream #0:1(und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 65 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
sunlock21 commented 4 years ago

这个应该不支持HEVC 的ts

TyrasNistru commented 4 years ago

这个应该不支持HEVC 的ts

I don't think thats the case, since it works if I stream a HEVC file directly to sls.

RichardCowart commented 4 years ago

I am seeing the same issue. Easy to replicate. First stream h264 to sls. Stop the stream and begin streaming HEVC. ffprobe and ffplay reporting as h264 stream and is incorrect.

matiaspl commented 3 years ago

Same here. The built in TS parser in SLS does not support HEVC, it's unfortunately H264 only. I'm not sure a parser would be needed if there's no recording taking place (especially if for example the SRT stream is coming in encrypted), nevertheless I believe this to be root cause of the problem. If you try to do ffplay -codec:v hevc "srt://..." you will at some point get usable picture but this is only because ffmpeg tends to guess a lot of stuff that it suspects to be broken.

timokorkalainen commented 3 years ago

Does this mean srt-live-server does not support h265 streaming at the moment?

EDIT: No, it does not. It seems to mean that one can't change a stream from H264 to H265, without also changing the stream id.

truedei commented 6 months ago

参考: https://blog.csdn.net/qq_17623363/article/details/137863559?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22137863559%22%2C%22source%22%3A%22qq_17623363%22%7D