Skip to content

Instantly share code, notes, and snippets.

@AARomanov1985
Last active July 9, 2025 09:29
Show Gist options
  • Save AARomanov1985/4d52d2b803eaa06fbf83158ec6095292 to your computer and use it in GitHub Desktop.
Save AARomanov1985/4d52d2b803eaa06fbf83158ec6095292 to your computer and use it in GitHub Desktop.
Create VHS Effect with Ffmpeg
# This command performs video and audio processing using FFmpeg.
# Video Processing:
# - Scale the video to a width of 480 pixels, maintaining the aspect ratio.
# - Adjust the color saturation to 0.8 times the original value.
# - Add noise to the video with an intensity of 20, using a temporal and spatial noise pattern.
# Audio Processing:
# - Add a delay to the noise audio to synchronize it with the original audio.
# - Adjust the volume of the noise audio to 0.1 times the original volume.
# - Apply a highpass and lowpass filter to the original audio, cutting frequencies outside the range of 100-3000 Hz to remove unwanted noise.
# - Mix the filtered audio with the noise audio, blending them into a single audio stream.
# Additional Parameters:
# - Output video format: YUV420p
# - Video codec: libx264 with a bitrate of 2000 kbps
# - Audio codec: AAC with a sample rate of 16000 Hz and 2 channels (stereo)
# - Ensure the output duration matches the shortest input file.
# Adjustment:
# - To adjust the video scaling, change the width parameter in the scale filter.
# - Modify the saturation value to change the color intensity.
# - Adjust the noise intensity by modifying the 'alls' parameter.
# - Change the delay timings and noise volume for audio synchronization and adjustment.
# - Modify the highpass and lowpass filter frequencies to adjust the frequency range cut-off.
# - Adjust the video and audio codecs, bitrate, sample rate, and channel configuration as needed.
# - Remove the 'shortest' option if you want the output duration to match the longer input file.
ffmpeg -i input.mp4 -i noise.wav -vf "scale=480:trunc(ow/a/2)*2,setsar=1:1,eq=saturation=0.8,noise=alls=20:allf=t+u" -filter_complex "[1:a]adelay=delays=0|1000|2000|3000:all=1,volume=0.1[audio];[0:a]highpass=f=100,lowpass=f=3000[audio_cut];[audio_cut][audio]amix=inputs=2" -pix_fmt yuv420p -c:v libx264 -b:v 2000k -c:a aac -ar 16000 -ac 2 -shortest output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment