-
-
Save me7/f6e85c245b8cc4672eb549a9f05f4a76 to your computer and use it in GitHub Desktop.
use lua to execute ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convert2wmv(filename) | |
return os.execute('ffmpeg -i \"'..filename..'\" -q:v -vf scale=w=854:h=854:force_original_aspect_ratio=decrease \"'..filename..'.wmv\"') | |
end | |
function convert2wma(filename) | |
return os.execute('ffmpeg -i \"'..filename..'\" -vn \"'..filename..'.wma\"') | |
end | |
function cutvideo(filename) | |
io.write("cut from (sec): ") | |
from = io.read() | |
io.write("to (sec): ") | |
to = io.read() | |
return os.execute('ffmpeg -i \"'..filename..'\" -q:v 10 -vf scale=w=854:h=854:force_original_aspect_ratio=decrease -ss '..from..' -to '..to..' \"'..filename..'_'..from..'-'..to..'.wmv\"') | |
end | |
function cutaudio(filename) | |
io.write("cut from (sec): ") | |
from = io.read() | |
io.write("to (sec): ") | |
to = io.read() | |
return os.execute('ffmpeg -i \"'..filename..'\" -q:a 10 -vn -ss '..from..' -to '..to..' \"'..filename..'_'..from..'-'..to..'.wma\"') | |
end | |
funcname = arg[1] | |
filename = arg[2] | |
if not _G[funcname](filename) then io.read() end | |
-- usage: lua d:\cmd cut2wmv "%1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
function convert2wmv(filename)
return os.execute('ffmpeg -i "'..filename..'" -q:v -vf scale=w=854:h=854:force_original_aspect_ratio=decrease "'..filename..'.wmv"')
end
function convert2wma(filename)
return os.execute('ffmpeg -i "'..filename..'" -vn "'..filename..'.wma"')
end
function cut2wmv(filename)
io.write("cut from (sec): ")
from = io.read()
io.write("to (sec): ")
to = io.read()
return os.execute('ffmpeg -i "'..filename..'" -q:v 10 -vf scale=w=854:h=854:force_original_aspect_ratio=decrease -ss '..from..' -to '..to..' "'..filename..'_'..from..'-'..to..'.wmv"')
end
function cut2wma(filename)
io.write("cut from (sec): ")
from = io.read()
io.write("to (sec): ")
to = io.read()
return os.execute('ffmpeg -i "'..filename..'" -q:a 10 -vn -ss '..from..' -to '..to..' "'..filename..'_'..from..'-'..to..'.wma"')
end
funcname = arg[1]
filename = arg[2]
if not _Gfuncname then io.read() end
-- usage: lua d:\cmd cut2wmv "%1"