mhamza-007's picture
Adding application files
2c966e2
raw
history blame contribute delete
619 Bytes
import os
import subprocess
def remove_audio(input_file):
output_file = f"processed_{os.path.basename(input_file).rsplit('.', 1)[0]}.mp4"
ffmpeg_cmd = [
'ffmpeg',
'-i', input_file,
'-c:v', 'libx264',
'-preset', 'ultrafast',
'-an',
'-y',
output_file
]
try:
result = subprocess.run(ffmpeg_cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print(f"Processed video saved to: {output_file}")
return output_file
except Exception as e:
print(f"Unexpected error: {e}")
return None