Use meaningful chapter names from metadata or filenames
When authoring DVDs from multiple videos, chapters now display: - Video metadata title if available - Filename without extension as fallback - Instead of generic "Chapter 1", "Chapter 2", etc. This provides better navigation experience in DVD players.
This commit is contained in:
parent
d57b3f74eb
commit
ae41dc37bd
|
|
@ -1757,19 +1757,26 @@ func (s *appState) runAuthoringPipeline(ctx context.Context, paths []string, reg
|
||||||
|
|
||||||
// Generate clips from paths if clips is empty (fallback for when job didn't save clips)
|
// Generate clips from paths if clips is empty (fallback for when job didn't save clips)
|
||||||
if len(clips) == 0 && len(paths) > 1 {
|
if len(clips) == 0 && len(paths) > 1 {
|
||||||
for i, path := range paths {
|
for _, path := range paths {
|
||||||
src, err := probeVideo(path)
|
src, err := probeVideo(path)
|
||||||
duration := 0.0
|
duration := 0.0
|
||||||
displayName := filepath.Base(path)
|
displayName := filepath.Base(path)
|
||||||
|
chapterTitle := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
duration = src.Duration
|
duration = src.Duration
|
||||||
displayName = src.DisplayName
|
displayName = src.DisplayName
|
||||||
|
// Use metadata title if available, otherwise use filename
|
||||||
|
if src.Metadata != nil {
|
||||||
|
if title, ok := src.Metadata["title"]; ok && strings.TrimSpace(title) != "" {
|
||||||
|
chapterTitle = title
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
clips = append(clips, authorClip{
|
clips = append(clips, authorClip{
|
||||||
Path: path,
|
Path: path,
|
||||||
DisplayName: displayName,
|
DisplayName: displayName,
|
||||||
Duration: duration,
|
Duration: duration,
|
||||||
ChapterTitle: fmt.Sprintf("Chapter %d", i+1),
|
ChapterTitle: chapterTitle,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if logFn != nil {
|
if logFn != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user