select.lua: allow ffmpeg to print errors if it fails

Also don't print subprocess result to OSD, as it is not comprehensible.
This commit is contained in:
Kacper Michajłow 2024-05-13 15:27:07 +02:00
parent 691a25de38
commit c3bf2c72a6
1 changed files with 6 additions and 8 deletions

View File

@ -193,20 +193,18 @@ mp.add_forced_key_binding(nil, "select-subtitle-line", function ()
name = "subprocess",
capture_stdout = true,
args = sub.external
and {"ffmpeg", "-loglevel", "quiet", "-i", sub["external-filename"],
and {"ffmpeg", "-loglevel", "error", "-i", sub["external-filename"],
"-f", "lrc", "-map_metadata", "-1", "-fflags", "+bitexact", "-"}
or {"ffmpeg", "-loglevel", "quiet", "-i", mp.get_property("path"),
or {"ffmpeg", "-loglevel", "error", "-i", mp.get_property("path"),
"-map", "s:" .. sub["id"] - 1, "-f", "lrc", "-map_metadata",
"-1", "-fflags", "+bitexact", "-"}
})
if r.status < 0 then
show_error("subprocess error: " .. r.error_string)
if r.error_string == "init" then
show_error("Failed to extract subtitles: ffmpeg not found.")
return
end
if r.status > 0 then
show_error("ffmpeg failed with code " .. r.status)
elseif r.status ~= 0 then
show_error("Failed to extract subtitles.")
return
end