File size: 619 Bytes
2c966e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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