mpv-scripts
mpv-scripts copied to clipboard
[Encode] Wrong stream clip format
When trying to clip a stream the output format is set by the file extension but not existing it always defaults to mkv.
You're talking about $x, right? It does indeed default to mkv if it cannot recognize the input format, should this be configurable?
Should be the same as the stream format; i've modified the code:
function get_extension(path)
local is_stream = not file_exists(path)
local format = mp.get_property("file-format")
local candidate = string.match(path, "%.([^.]+)$")
if candidate then
for _, ext in ipairs({ "mkv", "webm", "mp4", "avi" }) do
if candidate == ext then
return candidate
else
if is_stream then
if format == "mov,mp4,m4a,3gp,3g2,mj2" then
return "mp4"
end
end
end
end
end
return "mkv"
end
mh yeah thinking about it we probably should just use the real format instead of trying to parse it from a filename.
Right,the fix worked for me but it isn't general...