Advertisement
TangentFox

(maintained elsewhere) any2webm.lua

Nov 21st, 2023 (edited)
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. #!/usr/bin/env luajit
  2. -- any2webm.lua
  3. -- Requires ffmpeg
  4. -- Place in a directory with video files and they will all slowly be converted to webm files.
  5.  
  6. -- THIS IS BEING MAINTAINED AT https://github.com/TangentFoxy/.lua-files
  7. -- GO THERE INSTEAD OF DOWNLOADING THIS FILE DIRECTLY.
  8.  
  9. -- OS must be detected to choose list command
  10. local ls
  11. if package.config:sub(1,1) == "\\" then
  12.   ls = "dir /w /b > files.txt"
  13. else
  14.   ls = "ls -1 > files.txt"
  15. end
  16.  
  17. os.execute(ls)
  18.  
  19. os.execute("mkdir any2webm-output")
  20.  
  21. for line in io.lines("files.txt") do
  22.   if line:find("%.") and line ~= "files.txt" and line ~= "any2webm.lua" then
  23.     os.execute("ffmpeg -threads 1 -i \"" .. line .. "\" -threads 1 \"any2webm-output/" .. line .. ".webm\"")
  24.   end
  25. end
  26.  
  27. os.execute("rm files.txt")
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement