Fix chapter detection in video probing
Added -show_chapters flag to ffprobe command to retrieve chapter information. Parse chapters from JSON output and set HasChapters field when chapters are present. Files with chapters will now correctly show 'Chapters: Yes' in the file information display.
This commit is contained in:
parent
3b0b84b6f1
commit
e76eeba60e
11
main.go
11
main.go
|
|
@ -9160,6 +9160,7 @@ func probeVideo(path string) (*videoSource, error) {
|
|||
"-print_format", "json",
|
||||
"-show_format",
|
||||
"-show_streams",
|
||||
"-show_chapters",
|
||||
path,
|
||||
)
|
||||
utils.ApplyNoWindow(cmd)
|
||||
|
|
@ -9194,6 +9195,9 @@ func probeVideo(path string) (*videoSource, error) {
|
|||
AttachedPic int `json:"attached_pic"`
|
||||
} `json:"disposition"`
|
||||
} `json:"streams"`
|
||||
Chapters []struct {
|
||||
ID int `json:"id"`
|
||||
} `json:"chapters"`
|
||||
}
|
||||
if err := json.Unmarshal(out, &result); err != nil {
|
||||
return nil, err
|
||||
|
|
@ -9219,6 +9223,13 @@ func probeVideo(path string) (*videoSource, error) {
|
|||
src.HasMetadata = true
|
||||
}
|
||||
}
|
||||
|
||||
// Check for chapters
|
||||
if len(result.Chapters) > 0 {
|
||||
src.HasChapters = true
|
||||
logging.Debug(logging.CatFFMPEG, "found %d chapter(s) in video", len(result.Chapters))
|
||||
}
|
||||
|
||||
// Track if we've found the main video stream (not cover art)
|
||||
foundMainVideo := false
|
||||
var coverArtStreamIndex int = -1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user