File size: 852 Bytes
76e8731
 
 
 
4530235
76e8731
 
 
 
 
4530235
 
 
 
76e8731
4530235
76e8731
8905957
4530235
8905957
 
4530235
 
76e8731
8905957
76e8731
 
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
import os
import subprocess

def process_video(input_path, output_path, duration=None):
    # Effects configuration
    shake = "crop=iw*0.95:ih*0.95:iw*0.025+iw*0.01*sin(2*t):ih*0.025+ih*0.01*cos(2.3*t)"
    color = "eq=saturation=0.8:contrast=0.9:brightness=-0.05"
    vignette = "vignette=angle=PI/4"
    noise = "noise=alls=10:allf=t+u"
    
    # Video filter chain
    video_filter = f"{color},{vignette},{noise},{shake}"
    # Audio filter for echo/reverb effect
    audio_filter = "aecho=0.8:0.8:40:0.3,lowpass=f=3000"
    
    # FFmpeg command
    command = [
        "ffmpeg", "-y",
        "-i", input_path,
        "-vf", video_filter,
        "-af", audio_filter,
        "-c:v", "libx264", "-preset", "ultrafast", "-crf", "28",
        "-c:a", "aac", "-b:a", "128k",
        output_path
    ]
    
    subprocess.run(command, check=True)