mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
harden qobuz and downloader reliability edge cases
This commit is contained in:
@@ -72,6 +72,17 @@ func buildFFmpegArgs(inputPath, outputPath string, p profile, cfg config.Convers
|
||||
"-c:a", p.codecLib,
|
||||
}
|
||||
|
||||
if supportsAttachedPicture(p.ext) {
|
||||
args = append(args,
|
||||
"-map", "0:v:0?",
|
||||
"-c:v", "mjpeg",
|
||||
"-disposition:v:0", "attached_pic",
|
||||
)
|
||||
if p.ext == "mp3" {
|
||||
args = append(args, "-id3v2_version", "3")
|
||||
}
|
||||
}
|
||||
|
||||
if p.lossless {
|
||||
filter := buildLosslessFilter(cfg)
|
||||
if filter != "" {
|
||||
@@ -87,6 +98,15 @@ func buildFFmpegArgs(inputPath, outputPath string, p profile, cfg config.Convers
|
||||
return args
|
||||
}
|
||||
|
||||
func supportsAttachedPicture(ext string) bool {
|
||||
switch strings.TrimPrefix(strings.ToLower(ext), ".") {
|
||||
case "flac", "mp3", "m4a", "mp4":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func buildLosslessFilter(cfg config.ConversionConfig) string {
|
||||
parts := make([]string, 0, 2)
|
||||
if cfg.SamplingRate > 0 {
|
||||
|
||||
Reference in New Issue
Block a user