gpac / gpac

GPAC Ultramedia OSS for Video Streaming & Next-Gen Multimedia Transcoding, Packaging & Delivery
https://gpac.io
GNU Lesser General Public License v2.1
2.63k stars 522 forks source link

gpac convert ll-hls latency is big in safari #2049

Open fastfading opened 2 years ago

fastfading commented 2 years ago

Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/

I convert a rtmp stream to ll-hls . then stream it with apache httpd . ./gpac -i 'rtmp://:1935/live/abc:gpac:rtmp_listen=1' -o live.m3u8:gpac:segdur=6:cdur=1:profile=live:dmode=dynamic:rdirs=outdir:llhls=sf:hlsc=true GOP is 150 , fps is 25, generate segment each 6s. and generate small segment each 1s it plays well in https://www.theoplayer.com/ll-hls-test-page and https://hls-js.netlify.app/demo/ latency is about 5s but when it plays in safari , its latency is very big. more than 18s.

I wonder why is that, is something missing?

jeanlf commented 2 years ago

It looks as if safari ignores the LL setup in this case (latency > 18sec which is 3 full segments in your setup)

No clue why, could you have a look at the http server logs to check requests: does safari tunes on edge, are the request delayed , ...

fastfading commented 2 years ago

no, the request is not delayed
the PART-HOLD-BACK is 3s , but it does not work on safari. safari start playback from the first ts in the m3u8 file. I tested the apple official tool, https://developer.apple.com/documentation/http_live_streaming/about_apple_s_http_live_streaming_tools http/2 server, the same result. Is there something missing?

fastfading commented 2 years ago

https://ll-hls-test.apple.com/llhls1/multi.m3u8
the apple official test url work well. But this link did not work from yesterday.

jeanlf commented 2 years ago

I added EXT-X-PRELOAD-HINT and EXT-X-RENDITION-REPORT, can you check if that helps ?

Also did you try with mp4 instead of ts ?

fastfading commented 2 years ago

I have tested it .

the same result. I check the stream with apple official tool and apple officia llhls test sample mediastreamvalidator https://ll-hls-test.apple.com/llhls1/multi.m3u8 I found a difference here. I already used http 2.0 . I don't know why it is still report http/2 issue. maybe safari need http/2 "PUSH" , I am not sure

MUST fix issues

Error: Content not delivered via HTTP/2 --> Detail: No content used HTTP/2 --> Source: http://localhost:8443/lowLatencyHLS.m3u8

Jean Le Feuvre @.***> 于2022年1月22日周六 01:54写道:

I added EXT-X-PRELOAD-HINT and EXT-X-RENDITION-REPORT, can you check if that helps ?

Also did you try with mp4 instead of ts ?

— Reply to this email directly, view it on GitHub https://github.com/gpac/gpac/issues/2049#issuecomment-1018733420, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7W75CV2MZ2KASWR7ZEJ63UXGMUHANCNFSM5MDOUEXQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

fastfading commented 2 years ago

image gpac - GPAC command line filter engine - version 1.1.0-DEV-rev1659-g7d3281e88-master this new version did not work as LL hls in safari.

my cmd is : ./gpac -i 'rtmp://:1935/live/abc:gpac:rtmp_listen=1' -o live.m3u8:gpac:segdur=6:cdur=1:profile=live:dmode=dynamic:rdirs=outdir:llhls=sf:hlsc=true

I use golang fileserver to stream the m4s and m3u8

package main

import (
    "fmt"
    "net/http"
)

func cors(fs http.Handler) http.HandlerFunc {
    return func(w http.ResponseWriter, r *http.Request) {
        // do your cors stuff
        // return if you do not want the FileServer handle a specific request
        header := w.Header()
        header.Set("Access-Control-Allow-Origin", "*")
        header.Set("Access-Control-Allow-Methods", "*")
        header.Set("Access-Control-Allow-Headers", "*")

        fs.ServeHTTP(w, r)
    }
}

func main() {
    fs := http.FileServer(http.Dir("./"))
    http.Handle("/", cors(fs))
    // err := http.ListenAndServe(":9091",nil)
    err := http.ListenAndServeTLS(":9443", "./server.pem", "./server.pem", nil)
    if err != nil {
        fmt.Println("Failed to start server", err)
        return
    }
}
JuanMorenoS commented 1 year ago

@jeanlf Any update? We have the same issue with the latest version of gpac 2.3-DEV

rbouqueau commented 7 months ago

Is this issue still relevant?

jeanlf commented 6 months ago

I've tried pretty much everything (using h/2, injecting program-date-time, gzip support for playlist) but on my machine the result is always the same: safari loads 30s of content then accesses the live edge through LL parts, as expected.

If any of you has a test source of LL-HLS with working PART-HOLD-BACK working, let us know - I begin to suspect this is not properly handled in safari

rbouqueau commented 6 months ago

Does anyone has access to a LL-HLS stream with PART-HOLD-BACK that works properly with Safari?