pcdoido2 commited on
Commit
47612f1
·
verified ·
1 Parent(s): 0004fa7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -25
app.py CHANGED
@@ -50,48 +50,34 @@ def random_string(n=12):
50
  return ''.join(random.choices(string.ascii_letters + string.digits, k=n))
51
 
52
  def randomize_video_metadata(file_path):
53
- """FULL HARD: limpa tudo e reinsere metadados randômicos"""
54
  mime, _ = mimetypes.guess_type(file_path)
55
  if not mime or not mime.startswith("video"):
56
  return
57
 
58
  temp_path = file_path + ".tmp"
59
 
60
- # strings randômicas
61
- rand_enc = random_string(8)
62
- rand_title = random_string(12)
63
- rand_comment = random_string(12)
64
- rand_desc = random_string(12)
65
- rand_artist = random_string(10)
66
- rand_album = random_string(10)
67
- rand_brand = random.choice(["mp42", "iso2", "isom", "avc1"])
68
- rand_compat = random.choice([
69
- "mp42,isom,avc1",
70
- "isom,avc1,mp41",
71
- "iso2,mp42,isom"
72
- ])
73
-
74
  cmd = [
75
  "ffmpeg", "-y", "-i", file_path,
76
- "-map_metadata", "-1", # ⚡ limpa TODOS os metadados originais
 
77
  "-c:v", "libx264", "-preset", "fast", "-crf", "23",
78
  "-c:a", "aac", "-b:a", "128k",
79
  "-movflags", "use_metadata_tags+faststart",
80
- "-brand", rand_brand,
81
- "-metadata", f"compatible_brands={rand_compat}",
82
- "-metadata:s:v", f"encoder={rand_enc}",
83
- "-metadata", f"title={rand_title}",
84
- "-metadata", f"comment={rand_comment}",
85
- "-metadata", f"description={rand_desc}",
86
- "-metadata", f"artist={rand_artist}",
87
- "-metadata", f"album={rand_album}",
88
  temp_path
89
  ]
90
 
91
  try:
92
  subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
93
  os.replace(temp_path, file_path)
94
- print(f"✅ FULL HARD METADATA aplicado em {file_path}")
95
  except Exception as e:
96
  print(f"⚠ Erro ao randomizar {file_path}: {e}")
97
 
 
50
  return ''.join(random.choices(string.ascii_letters + string.digits, k=n))
51
 
52
  def randomize_video_metadata(file_path):
53
+ """FULL HARD REAL: remove LvMetaInfo/Aigc e reinsere metadados randômicos"""
54
  mime, _ = mimetypes.guess_type(file_path)
55
  if not mime or not mime.startswith("video"):
56
  return
57
 
58
  temp_path = file_path + ".tmp"
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  cmd = [
61
  "ffmpeg", "-y", "-i", file_path,
62
+ "-map", "0:v", "-map", "0:a", # ⚡ vídeo e áudio
63
+ "-map_metadata", "-1", # limpa tudo
64
  "-c:v", "libx264", "-preset", "fast", "-crf", "23",
65
  "-c:a", "aac", "-b:a", "128k",
66
  "-movflags", "use_metadata_tags+faststart",
67
+ "-brand", random.choice(["mp42", "isom", "iso2", "avc1"]),
68
+ "-metadata", f"encoder={random_string(10)}",
69
+ "-metadata", f"title={random_string(12)}",
70
+ "-metadata", f"comment={random_string(12)}",
71
+ "-metadata", f"description={random_string(12)}",
72
+ "-metadata", f"artist={random_string(10)}",
73
+ "-metadata", f"album={random_string(10)}",
 
74
  temp_path
75
  ]
76
 
77
  try:
78
  subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
79
  os.replace(temp_path, file_path)
80
+ print(f"✅ FULL HARD REAL aplicado em {file_path}")
81
  except Exception as e:
82
  print(f"⚠ Erro ao randomizar {file_path}: {e}")
83