- SilenceCut is a simple tool to remove silence from video files.
- It's a simple wrapper around FFmpeg.
- It's written in Python and uses the
ffmpeg-python
library. - It's a command line tool.
- Python 3.x
- FFmpeg
brew install python3
brew install ffmpeg
sudo apt update
sudo apt install python3 python3-pip ffmpeg
pip install ffmpeg-python
python3 silencecut.py -i '<path_to_input_file>' -o '<path_to_output_file>'
python3 silencecut.py -i ~/Desktop/input.mp4 -o ~/Desktop/output.mp4 --video_codec libx264 --video_bitrate 8M --video_preset medium --video_profile high --audio_codec aac --audio_bitrate 128k --audio_sample_rate 48000 --silence_level 30 --silence_duration 0.5
-i
or --input
: Path to the input video file. (Required)
-o
or --output
: Path to the output video file. (Required)
-sl
or --silence_level
: Silence level in dB. (Optional, default: 30
)
-sd
or --silence_duration
: Silence duration in seconds. (Optional, default: 0.5
)
-vc
or --video_codec
: Video codec. (Optional, default: libx264
)
-vb
or --video_bitrate
: Video bitrate. (Optional, default: 8m
)
-vp
or --video_preset
: Video preset. (Optional, default: medium
)
-vpr
or --video_profile
: Video profile. (Optional, default: high
)
-ac
or --audio_codec
: Audio codec. (Optional, default: aac
)
-ab
or --audio_bitrate
: Audio bitrate. (Optional, default: 128k
)
-asr
or --audio_sample_rate
: Audio sample rate. (Optional, default: 48000
)
- Video Codec:
libx264
- Video Bitrate: Depending on the resolution and frame rate, YouTube recommends:
- 1080p at 30fps: 8 Mbps
- 1080p at 60fps: 12 Mbps
- 1440p at 30fps: 16 Mbps
- 1440p at 60fps: 24 Mbps
- 2160p at 30fps: 35-45 Mbps
- 2160p at 60fps: 53-68 Mbps
- Video Preset:
medium
(for a balance between encoding speed and quality) - Video Profile:
high
- Audio Codec:
aac
- Audio Bitrate: 128 kbps or higher (e.g., 192 kbps or 256 kbps for better quality)
- Audio Sample Rate: 48 kHz
- Video Bitrate:
8M
- Audio Bitrate:
192k
- Silence Level:
40
(depending on the noise level in the video, adjust as needed) - Silence Duration:
0.5
(to quickly cut out short silent parts)
If you encounter issues, check the following:
- FFmpeg Not Found: Ensure FFmpeg is installed and added to your system PATH.
- Permission Denied: Ensure you have permission to read the input file and write to the output file's location.
- Invalid Input: Ensure the input file path and format are correct.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.