Preserve chapters, subtitles, and metadata in convert module

Added explicit stream mapping to preserve all streams:
- Map video, audio, and subtitle streams (subtitles optional)
- Added -map_chapters to preserve chapter information
- Added -map_metadata to preserve all file metadata
- Copy subtitle streams without re-encoding

Applies to both conversions with and without cover art.
Works for all output formats that support these features.
This commit is contained in:
Stu Leak 2025-12-17 01:22:33 -05:00
parent 75073b2f5d
commit 3b0b84b6f1

14
main.go
View File

@ -3210,13 +3210,23 @@ func (s *appState) executeConvertJob(ctx context.Context, job *queue.Job, progre
}
}
// Map cover art
// Map streams and metadata
if hasCoverArt {
args = append(args, "-map", "0:v", "-map", "0:a?", "-map", "1:v")
// With cover art: map video, audio, subtitles, and cover art
args = append(args, "-map", "0:v", "-map", "0:a?", "-map", "0:s?", "-map", "1:v")
args = append(args, "-c:v:1", "png")
args = append(args, "-disposition:v:1", "attached_pic")
} else {
// Without cover art: map video, audio, and subtitles
args = append(args, "-map", "0:v", "-map", "0:a?", "-map", "0:s?")
}
// Preserve chapters and metadata
args = append(args, "-map_chapters", "0", "-map_metadata", "0")
// Copy subtitle streams by default (don't re-encode)
args = append(args, "-c:s", "copy")
if strings.EqualFold(selectedFormat.Ext, ".mp4") || strings.EqualFold(selectedFormat.Ext, ".mov") {
args = append(args, "-movflags", "+faststart")
}