-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathverify_ffmpeg_cmd.py
More file actions
64 lines (51 loc) · 1.78 KB
/
verify_ffmpeg_cmd.py
File metadata and controls
64 lines (51 loc) · 1.78 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Developed by ARGON telegram: @REACTIVEARGON
import sys
import os
# Add the project root to sys.path
sys.path.append(os.getcwd())
from bot.func.ffmpeg_utils import generate_ffmpeg_cmd
def test_generate_ffmpeg_cmd():
settings = {
"video": {
"resolution": ["1080p"],
"codec": "libx264",
"crf": 23,
"preset": "medium"
}
}
input_file = "test_input.mp4"
output_base = "test_output"
import sys
import os
# Add the project root to sys.path
sys.path.append(os.getcwd())
from bot.func.ffmpeg_utils import generate_ffmpeg_cmd
def test_generate_ffmpeg_cmd():
settings = {
"video": {
"resolution": ["1080p"],
"codec": "libx264",
"crf": 23,
"preset": "medium"
}
}
input_file = "test_input.mp4"
output_base = "test_output"
commands = generate_ffmpeg_cmd(settings, input_file, output_base)
for cmd_info in commands:
cmd = cmd_info["cmd"]
print(f"Generated command: {cmd}")
# Check for map flags, handling potential quotes
has_video = "-map 0:v?" in cmd or "-map '0:v?'" in cmd or '-map "0:v?"' in cmd
has_audio = "-map 0:a?" in cmd or "-map '0:a?'" in cmd or '-map "0:a?"' in cmd
has_subs = "-map 0:s?" in cmd or "-map '0:s?'" in cmd or '-map "0:s?"' in cmd
if has_video and has_audio and has_subs:
print("SUCCESS: Command contains correct map flags.")
else:
print("FAILURE: Command missing correct map flags.")
sys.exit(1)
if "-map 0 " in cmd or "-map '0'" in cmd: # Check for the old flag
print("FAILURE: Command contains old map flag '-map 0'.")
sys.exit(1)
if __name__ == "__main__":
test_generate_ffmpeg_cmd()