FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lua-scripts/2mp4.lua at main · TangentFoxy/lua-scripts · GitHub
TangentFoxy
/
lua-scripts
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
14
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
lua-scripts
/
2mp4.lua
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
34 lines (25 loc) · 1.28 KB
Breadcrumbs
lua-scripts
/
2mp4.lua
Copy path
File metadata and controls
executable file
·
34 lines (25 loc) · 1.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!
/usr/bin/env luajit
package.path
=
(
arg
[
0
]:
match
(
"
@?(.*/)
"
)
or
arg
[
0
]:
match
(
"
@?(.*
\\
)
"
))
..
"
lib
"
..
package.config
:
sub
(
1
,
1
)
..
"
?.lua;
"
..
package.path
local
utility
=
require
"
utility
"
local
argparse
=
utility
.
require
(
"
argparse
"
)
local
parser
=
argparse
():
description
(
"
Converts everything in the local directory to mp4, placed in
\"
./2mp4-output
\"
.
"
)
--
BUG argparse will not set the default number of threads I told it to (this is outdated anyhow)
--
parser:argument("threads", "Number of threads ffmpeg will be assigned."):default(1):defmode("arg"):convert(tonumber):args("?")
parser
:
argument
(
"
threads
"
,
"
Number of threads ffmpeg will be assigned.
"
):
convert
(
tonumber
):
args
(
"
?
"
)
local
options
=
parser
:
parse
()
utility
.
required_program
(
"
ffmpeg
"
)
local
for_files
=
utility
.
ls
()
os.execute
(
"
mkdir 2mp4-output
"
)
for_files
(
function
(
file_name
)
local
_
,
name
,
extension
=
utility
.
split_path_components
(
file_name
)
if
extension
then
name
=
name
:
sub
(
1
,
-
(
#
extension
+
2
))
end
local
command
if
options
.
threads
then
command
=
"
ffmpeg -threads
"
..
options
.
threads
..
"
-i
\"
"
..
file_name
..
"
\"
-threads
"
..
options
.
threads
..
"
\"
2mp4-output/
"
..
name
..
"
.mp4
\"
"
else
command
=
"
ffmpeg -i
\"
"
..
file_name
..
"
\"
\"
2mp4-output/
"
..
name
..
"
.mp4
\"
"
end
os.execute
(
command
)
end
)
Back
|
FazBrowse Home
|
New Git URL