Skip to content

Steve-D3/audio-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎞️ Audio Waveform Video Generator

This Node.js project generates a video by combining:

  • A waveform animation based on a .wav audio file
  • A static logo centered on the screen
  • A custom background and animated waveform line
  • Frame-by-frame rendering with canvas
  • Video generation using ffmpeg

The output is a .mp4 video with frame-accurate synchronization to the audio.


📁 Project Structure

.
├── config.js                      # Constants like paths, frame rate, dimensions
├── functions
│   ├── renderer.js                # Generate individual frames
│   ├── utils.js                   # File system utilities (ensure, cleanup)
│   ├── videoBuilder.js            # Compiles frames and audio into a video
│   └── waveform.js                # Extracts waveform data
├── main.js                        # Main script
├── media                           
│   ├── audio.wav                  # Input audio file
│   └── logo.png                   # Static logo to overlay
└── output
    └── final.mp4                  # Rendered video

🚀 Getting Started

1. Install Dependencies

npm install

2. Place Your Audio File and Logo in the Project Root

3. Run the Script

node main.js

4. Output

A final.mp4 file will be created in the root directory.

✏️ Customization

  • Adjust animation speed and resolution by modifying config.js:
    • FRAME_RATE
    • WIDTH / HEIGTH
  • Waveform appearance:
    • WAVE_COLOR
    • scaleX / scaleY in renderer.js/drawFrame()

⚙️ FFmpeg Encoding Options

  • .audioCodec("aac"): Encodes audio using Advanced Audio Codec (aac)
  • .videoCodec("libx264): Encodes video using H.264 codec
    • "libx265": for higher resolutions (4K)
  • .outputOptions([...]):
    • "pix_fmt ...": Ensure pixel format is compatible with most video palyers
      • "yuv420p": Standard 8-bit per channel, with 4:2:0 chroma subsampling.
      • "yuv422p": Higher color fidelity (4:2:2)
      • "yuv444p": No chroma subsampling, best color fidelity
    • "-shortest": Ensure video stops when audio ends

📦 Dependencies

Manually install (if neededd):

npm install canvas wav fluent-ffmpeg ffmpeg-static

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published