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

H265: Support HEVC over SRT.(#465) v6.0.20 #3366

Merged
merged 28 commits into from
Jan 22, 2023

Conversation

chundonglinlin
Copy link
Member

@chundonglinlin chundonglinlin commented Jan 6, 2023

When you experience hevc over srt, compile by ./configure --h265=on --srt=on, then run by ./objs/srs -c conf/srt.conf.

# SRT config.

listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;

http_api {
    enabled         on;
    listen          1985;
}

http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}

srt_server {
    enabled on;
    listen 10080;
    maxbw 1000000000;
    connect_timeout 4000;
    peerlatency 0;
    recvlatency 0;
    latency 0;
    tsbpdmode off;
    tlpktdrop off;
    sendbuf 2000000;
    recvbuf 2000000;
}

# @doc https://github.com/ossrs/srs/issues/1147#issuecomment-577607026
vhost __defaultVhost__ {
    srt {
        enabled     on;
        srt_to_rtmp on;
    }

    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }

    hls {
        enabled         on;
        hls_path        ./objs/nginx/html;
        hls_fragment    10;
        hls_window      60;
    }
}

FFmpeg Publish:'

Make sure to maintain the markdown structure.

ffmpeg -re -i ./h265_aac.ts -c copy -pes_payload_size 0 -f mpegts 'srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=publish'

Play SRT:

Make sure to maintain the markdown structure.

ffplay 'srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=request'

Play RTMP:

Make sure to maintain the markdown structure.

hevc-ffplay rtmp://127.0.0.1/live/livestream

Play FLV:

Make sure to maintain the markdown structure.

hevc-ffplay http://127.0.0.1:8080/live/livestream.flv

Play HLS:

Make sure to maintain the markdown structure.

ffplay http://127.0.0.1:8080/live/livestream.m3u8

TRANS_BY_GPT3

@winlinvip winlinvip linked an issue Jan 19, 2023 that may be closed by this pull request
@winlinvip
Copy link
Member

Publish by FFmpeg 5.0:

ffmpeg -re -i doc/source.flv -acodec copy -vcodec libx265  -pes_payload_size 0 \
  -f mpegts 'srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=publish'

Play by HTTP-TS is OK: http://localhost:8080/live/livestream.ts

Failed to play HTTP-FLV: http://localhost:8080/live/livestream.flv

@winlinvip winlinvip changed the title H265: Support HEVC over SRT.(#465) H265: Support HEVC over SRT.(#465) v6.0.20 Jan 22, 2023
@winlinvip winlinvip merged commit ef90da3 into ossrs:develop Jan 22, 2023
@johan149
Copy link

I'm running into an issue where it works with libx265 but it doesn't work with Nvenc

WORKS
ffmpeg -re -fflags +genpts -f lavfi -i "testsrc=duration=65536:size=1920x1080:rate=30" -f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=65536" -vcodec libx265 -b:v 5M -maxrate 5M -bufsize 10M -pix_fmt yuv420p -c:a aac -b:a 128k -pes_payload_size 0 -f mpegts 'srt://127.0.0.1:10080?streamid=#!::r=live/srt_h265,m=publish'

DOESN'T WORK
ffmpeg -re -fflags +genpts -f lavfi -i "testsrc=duration=65536:size=1920x1080:rate=30" -f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=65536" -c:v hevc_nvenc -preset p1 -profile main -level 4.0 -b:v 5M -maxrate 5M -bufsize 10M -pix_fmt yuv420p -c:a aac -b:a 128k -pes_payload_size 0 -f mpegts 'srt://127.0.0.1:10080?streamid=#!::r=live/srt_h265,m=publish'

When I run ffprobe is exactly the same HEVC video but SRS cannot accept it

here are the logs

image

I'm using the same above SRT conf

@chundonglinlin
Copy link
Member Author

chundonglinlin commented Jan 23, 2023

Can you raise an issue for this question? I'll test the encoder hevc_nvenc and be compatible. @johan149

@johan149
Copy link

Can you raise an issue for this question? I'll test the encoder hevc_nvenc and be compatible. @johan149

For sure, here is the new issue #3388

@pfzer
Copy link

pfzer commented Jun 27, 2023

Hello, I encountered an issue with using the Soshi encoding chip for HEVC streams. When using ffmpeg SRT to push to SRS6.0.55, the SRT to RTMP conversion is not working properly. When playing with ffplay, there is severe mosaic. You can find more information about this issue at #3604.

TRANS_BY_GPT3

@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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