Fast track extractions if there is no subtitles (#548)

This commit is contained in:
Zoe Roux 2024-06-19 22:34:18 +00:00 committed by GitHub
commit e47c6500f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -91,6 +91,10 @@ func GetMimeCodec(stream *ffprobe.Stream) *string {
return &ret
case "mp3":
ret := "mp4a.40.34"
return &ret
case "opus":
ret := "Opus"
return &ret
@ -107,6 +111,10 @@ func GetMimeCodec(stream *ffprobe.Stream) *string {
ret := "fLaC"
return &ret
case "alac":
ret := "alac"
return &ret
default:
log.Printf("No known mime format for: %s", stream.CodecName)
return nil

View File

@ -29,6 +29,12 @@ func Extract(path string, sha string) (<-chan struct{}, error) {
os.MkdirAll(attachment_path, 0o644)
os.MkdirAll(subs_path, 0o755)
// If there is no subtitles, there is nothing to extract (also fonts would be useless).
if len(info.Subtitles) == 0 {
close(ret)
return
}
cmd := exec.Command(
"ffmpeg",
"-dump_attachment:t", "",