feat(stream): transcode debrid sources to HLS from a URL (hueco #2/2b)
Non-browser-native debrid content (mkv/HEVC/…) can now stream: ffmpeg reads the debrid HTTPS link directly (-i <url>) and transcodes to HLS, instead of 2a's raw direct-play which only works for mp4/m4v. - HLSSessionConfig gains SourceURL + CacheID; sourceRef() feeds ffprobe, ffmpeg -i, and subtitle extraction from one place. HTTP-resilience flags (-reconnect*, -rw_timeout) are added only for a URL source; a seek-restart re-opens the URL with a Range request (-ss before -i = input seek). - Segment cache keys by CacheID (the torrent info_hash) for URL sessions so re-plays hit cache despite the debrid URL changing each resolution (KeyForID, no filepath.Abs). - OnStreamSession: the 2a direct-play branch is now gated on PlayMethod != "hls"; a new branch handles DirectURL + PlayMethod=="hls" → HLS-from-URL. The local-file and both debrid HLS paths share a startHLSPlayback helper. - ExtractMediaInfo no longer masks a URL probe failure as "file not found" (surfaces ffprobe's real stderr, e.g. "Protocol not found" on a TLS-less ffmpeg build). - Bump 0.11.0 -> 0.12.0 as the HLS-from-URL floor the web gates on. Validated e2e against real AllDebrid: a cached HEVC x265 mkv transcodes (h264_nvenc) from the debrid URL and plays 1080p in Chrome via hls.js, subtitles extracted from the remote mkv.
This commit is contained in:
parent
b8d2b90370
commit
992e16ba05
6 changed files with 270 additions and 51 deletions
|
|
@ -67,8 +67,14 @@ func ExtractMediaInfo(ctx context.Context, ffprobePath, filePath string) (*Media
|
|||
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
if _, statErr := os.Stat(filePath); statErr != nil {
|
||||
return nil, fmt.Errorf("ffprobe: file not found: %s", filePath)
|
||||
// A remote URL (debrid HLS-from-URL, hueco #2/2b) has no local file to
|
||||
// stat — surface ffprobe's own stderr (e.g. "Protocol not found" when the
|
||||
// ffmpeg build lacks TLS, or an HTTP error) instead of a misleading
|
||||
// "file not found". Only treat a genuine local path as possibly-missing.
|
||||
if !strings.Contains(filePath, "://") {
|
||||
if _, statErr := os.Stat(filePath); statErr != nil {
|
||||
return nil, fmt.Errorf("ffprobe: file not found: %s", filePath)
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("ffprobe failed (file=%s): %s", filePath, stderr.String())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue