Skip to content

aTrapDeer/video-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebM to MP4 Video Converter

A Python script that converts all WebM video files in a folder to MP4 format at the highest possible resolution.

Features

  • 🎥 Converts WebM files to MP4 at highest quality (visually lossless)
  • 📁 Automatically creates an mp4 subfolder for output files
  • 🔧 Preserves original video resolution and quality
  • 💾 Option to keep or delete original files
  • 🖥️ Windows CMD/PowerShell compatible
  • 📊 Shows conversion progress and summary

Requirements

1. Python 3.6+

Download and install Python from python.org

2. FFmpeg

FFmpeg is required for video conversion. Choose one installation method:

Option A: Using winget (Windows 10/11)

winget install ffmpeg

Option B: Manual installation

  1. Download FFmpeg from ffmpeg.org/download.html
  2. Extract the files to a folder (e.g., C:\ffmpeg)
  3. Add the bin folder to your system PATH environment variable

Option C: Using Chocolatey

choco install ffmpeg

Installation

  1. Download all files to a folder
  2. No additional Python packages required (uses standard library)

Usage

Method 1: Double-click the batch file (Easiest)

  1. Double-click convert_videos.bat
  2. Enter the folder path containing WebM files when prompted
  3. Wait for conversion to complete

Method 2: Command line with folder path

python video_converter.py "C:\Path\To\Your\WebM\Files"

Method 3: Interactive mode

python video_converter.py

Then enter the folder path when prompted.

Method 4: Keep original files

python video_converter.py "C:\Path\To\Your\WebM\Files" --keep-original

How it works

  1. Input: You provide a folder path containing WebM files
  2. Processing: The script finds all .webm files in the folder
  3. Output: Creates a new mp4 subfolder and saves converted files there
  4. Cleanup: Optionally deletes original WebM files (default behavior)

Example

Your folder structure:
C:\Videos\
├── video1.webm
├── video2.webm
└── video3.webm

After conversion:
C:\Videos\
├── mp4\
│   ├── video1.mp4
│   ├── video2.mp4
│   └── video3.mp4

Conversion Settings

The script uses these FFmpeg settings for highest quality:

  • Video codec: H.264 (libx264)
  • Quality: CRF 18 (visually lossless)
  • Preset: Slow (better compression)
  • Audio codec: AAC at 192k bitrate
  • Optimization: Fast start for streaming

Troubleshooting

"ffmpeg is not installed or not found in PATH"

  • Install FFmpeg using one of the methods above
  • Restart your command prompt/PowerShell after installation
  • Make sure FFmpeg is in your system PATH

"No WebM files found"

  • Check that the folder path is correct
  • Ensure files have .webm extension (case insensitive)
  • Make sure you have read permissions for the folder

Conversion fails

  • Check that you have write permissions in the target folder
  • Ensure there's enough disk space
  • Try with a different WebM file to isolate the issue

Creating an Executable (Optional)

To create a standalone .exe file:

  1. Install PyInstaller:
pip install pyinstaller
  1. Create the executable:
pyinstaller --onefile --console video_converter.py
  1. The .exe file will be in the dist folder

License

This project is free to use and modify.

Support

If you encounter issues:

  1. Check that Python and FFmpeg are properly installed
  2. Verify the folder path is correct
  3. Ensure you have proper file permissions
  4. Try running the script with a single test file first

About

I use with yt-dlp to convert youtube downloaded videos

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors