Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ import string
|
|
| 8 |
import tempfile
|
| 9 |
import shutil
|
| 10 |
import mimetypes
|
|
|
|
| 11 |
|
| 12 |
BASE_FOLDER = "uploaded_files"
|
| 13 |
CATEGORIES = ["AVATAR WORLD", "BLOX FRUITS", "TOCA LIFE"]
|
|
@@ -83,13 +84,31 @@ def process_video(file_path, hard_mode=False):
|
|
| 83 |
return temp_out
|
| 84 |
|
| 85 |
# Randomizações técnicas
|
| 86 |
-
crf = str(random.randint(18, 26))
|
| 87 |
bitrate = f"{random.randint(96, 192)}k"
|
| 88 |
fps = f"{random.uniform(29.5, 30.5):.2f}"
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
compressor = random_string(random.randint(6, 12))
|
| 91 |
encoder_name = random_string(random.randint(6, 14))
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
# Metadados falsos
|
| 94 |
meta = {
|
| 95 |
"title": random_string(random.randint(8, 20)),
|
|
@@ -101,7 +120,9 @@ def process_video(file_path, hard_mode=False):
|
|
| 101 |
"publisher": random_string(random.randint(5, 15)),
|
| 102 |
"encoded_by": random_string(random.randint(5, 15)),
|
| 103 |
"location": random_string(random.randint(5, 15)),
|
| 104 |
-
"encoder": encoder_name
|
|
|
|
|
|
|
| 105 |
}
|
| 106 |
|
| 107 |
cmd_ffmpeg = [
|
|
@@ -112,7 +133,8 @@ def process_video(file_path, hard_mode=False):
|
|
| 112 |
"-c:a", "aac", "-b:a", bitrate,
|
| 113 |
"-r", fps,
|
| 114 |
"-movflags", "use_metadata_tags+faststart",
|
| 115 |
-
"-
|
|
|
|
| 116 |
"-metadata", f"encoder={encoder_name}",
|
| 117 |
"-metadata", f"CompressorName={compressor}",
|
| 118 |
"-fflags", "+bitexact",
|
|
|
|
| 8 |
import tempfile
|
| 9 |
import shutil
|
| 10 |
import mimetypes
|
| 11 |
+
import datetime
|
| 12 |
|
| 13 |
BASE_FOLDER = "uploaded_files"
|
| 14 |
CATEGORIES = ["AVATAR WORLD", "BLOX FRUITS", "TOCA LIFE"]
|
|
|
|
| 84 |
return temp_out
|
| 85 |
|
| 86 |
# Randomizações técnicas
|
| 87 |
+
crf = str(random.randint(18, 26))
|
| 88 |
bitrate = f"{random.randint(96, 192)}k"
|
| 89 |
fps = f"{random.uniform(29.5, 30.5):.2f}"
|
| 90 |
+
|
| 91 |
+
# Rotação de brands
|
| 92 |
+
major_brand = random.choice(["isom", "iso2", "mp42", "avc1", "dash", "iso3"])
|
| 93 |
+
compatible_sets = [
|
| 94 |
+
["isom", "iso2", "avc1", "mp41"],
|
| 95 |
+
["mp42", "isom", "avc1"],
|
| 96 |
+
["iso5", "mp41", "isom"],
|
| 97 |
+
["iso2", "mp42", "isom"]
|
| 98 |
+
]
|
| 99 |
+
compatible_brands = " ".join(random.choice(compatible_sets))
|
| 100 |
+
|
| 101 |
compressor = random_string(random.randint(6, 12))
|
| 102 |
encoder_name = random_string(random.randint(6, 14))
|
| 103 |
|
| 104 |
+
# Datas nunca zeradas
|
| 105 |
+
start_date = datetime.datetime.now() - datetime.timedelta(days=180)
|
| 106 |
+
random_date = start_date + datetime.timedelta(
|
| 107 |
+
days=random.randint(0, 180),
|
| 108 |
+
seconds=random.randint(0, 86400)
|
| 109 |
+
)
|
| 110 |
+
date_str = random_date.strftime("%Y-%m-%d %H:%M:%S")
|
| 111 |
+
|
| 112 |
# Metadados falsos
|
| 113 |
meta = {
|
| 114 |
"title": random_string(random.randint(8, 20)),
|
|
|
|
| 120 |
"publisher": random_string(random.randint(5, 15)),
|
| 121 |
"encoded_by": random_string(random.randint(5, 15)),
|
| 122 |
"location": random_string(random.randint(5, 15)),
|
| 123 |
+
"encoder": encoder_name,
|
| 124 |
+
"creation_time": date_str,
|
| 125 |
+
"modify_time": date_str
|
| 126 |
}
|
| 127 |
|
| 128 |
cmd_ffmpeg = [
|
|
|
|
| 133 |
"-c:a", "aac", "-b:a", bitrate,
|
| 134 |
"-r", fps,
|
| 135 |
"-movflags", "use_metadata_tags+faststart",
|
| 136 |
+
"-metadata", f"major_brand={major_brand}",
|
| 137 |
+
"-metadata", f"compatible_brands={compatible_brands}",
|
| 138 |
"-metadata", f"encoder={encoder_name}",
|
| 139 |
"-metadata", f"CompressorName={compressor}",
|
| 140 |
"-fflags", "+bitexact",
|