Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Encode] Wrong stream clip format #45

Open
dardo82 opened this issue Sep 17, 2020 · 4 comments
Open

[Encode] Wrong stream clip format #45

dardo82 opened this issue Sep 17, 2020 · 4 comments

Comments

@dardo82
Copy link

dardo82 commented Sep 17, 2020

When trying to clip a stream the output format is set by the file extension but not existing it always defaults to mkv.

@occivink
Copy link
Owner

You're talking about $x, right? It does indeed default to mkv if it cannot recognize the input format, should this be configurable?

@dardo82
Copy link
Author

dardo82 commented Sep 17, 2020

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

@occivink
Copy link
Owner

mh yeah thinking about it we probably should just use the real format instead of trying to parse it from a filename.

@dardo82
Copy link
Author

dardo82 commented Sep 18, 2020

Right,the fix worked for me but it isn't general...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants