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] Doesn't seem to work but produces a valid command #39

Open
UserNaem opened this issue May 31, 2020 · 3 comments
Open

[encode] Doesn't seem to work but produces a valid command #39

UserNaem opened this issue May 31, 2020 · 3 comments

Comments

@UserNaem
Copy link

I had to edit encode.lua to make it work at all (issue #38), but this issue looks like it shouldn't exist. I'm trying to use multiple complex filter graphs, and it fails, but the command that is (supposedly) used is valid and works if I copy-paste it to a regular console window.

My config file: https://pastebin.com/PV11Fpts

[vo/gpu/d3d11] shaderc: 1978us, SPIRV-Cross: 151us, D3DCompile: 1749us
[statusline] AV: 00:00:01 / 00:00:05 (23%) A-V:  0.000
[encode] Opened config file script-opts/encode_gif.conf.
[encode] ffmpeg -ss 00:00.701 -i "C:\Users\Ten\Desktop\mpv\ff.mkv" -to 0.5423416661745 -map 0 -sn -an -f gif -filter_complex "[0:v] fps=1,scale=2*trunc(iw/max(1\,sqrt((iw*ih)/(640*360)))/2):-2,split [a][b];[a] palettegen [p];[b][p] paletteuse" "C:\Users\Ten\Desktop\mpv\ff_2.gif"
[statusline] AV: 00:00:02 / 00:00:05 (38%) A-V:  0.000
[cplayer] Set property: pause -> 1
[statusline] (Paused) AV: 00:00:02 / 00:00:05 (38%) A-V:  0.000

@occivink
Copy link
Owner

occivink commented Jun 2, 2020

I had to edit encode.lua to make it work at all

The quoting should only be a problem if you copy-paste the command, the line is only being printed for informative purposes. Let me see

@occivink
Copy link
Owner

occivink commented Jun 2, 2020

Mh yes I think the problem is that the codec option is quite basic and the value is being split on whitespace, so your filter_complex ends up malformed. I need to think of a way to make this more robust

@AeliusSaionji
Copy link

I don't actually know lua, and thus don't know why this doesn't work. It again produces a valid command- but nothing happens.

I figured it's probably worthwhile to just explicitly have a filter complex setting.

--- encode.lua  2020-09-10 13:50:55.429526500 -0400
+++ AppData/Roaming/mpv/scripts/encode.lua      2020-09-10 13:49:05.761400800 -0400
@@ -179,6 +179,12 @@
     if #filters > 0 then
         append_args({ "-filter:v", table.concat(filters, ",") })
     end
+    -- attempt to add filter complex
+    local filterc = {}
+    if settings.append_filter_complex ~= "" then
+        filterc = settings.append_filter_complex
+        append_args({ "-filter_complex", filterc })
+    end

     -- split the user-passed settings on whitespace
     for token in string.gmatch(settings.codec, "[^%s]+") do
@@ -291,6 +297,7 @@
             only_active_tracks = false,
             preserve_filters = true,
             append_filter = "",
+            append_filter_complex = "",
             codec = "-an -sn -c:v libvpx -crf 10 -b:v 1000k",
             output_format = "$f_$n.webm",
             output_directory = "",

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

3 participants