https://github.com/smalls1652/pwsh-video-converter
A wrapper script for MP4 video conversion.
https://github.com/smalls1652/pwsh-video-converter
ffmpeg powershell
Last synced: 3 months ago
JSON representation
A wrapper script for MP4 video conversion.
- Host: GitHub
- URL: https://github.com/smalls1652/pwsh-video-converter
- Owner: Smalls1652
- Created: 2021-03-09T04:59:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-23T01:58:28.000Z (over 4 years ago)
- Last Synced: 2025-07-14T03:55:43.967Z (4 months ago)
- Topics: ffmpeg, powershell
- Language: PowerShell
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PowerShell wrapper script MP4 video conversions through ffmpeg
This is a script I have been working on for automating my video conversions to the `mp4` container through `ffmpeg`. This is really just a personal script I started creating since it can be cumbersome to remember all of the individual `ffmpeg` arguments. This helps me batch multiple encodes through a scripting language I know best: PowerShell.
## Things to note
- `ffmpeg` will need to have `libx265` and `libfdk_aac` enabled during build for this script to work. It's what I'm using to convert videos from one container to a `mp4` container.
- Using the `-SubtitleStream` parameter is currently set to **burn-in** the subtitles. The subtitles I'm working with aren't text-based subtitles, but rather image-based. I'll probably have a need to rework that to support text-based subtitles.
- This can be ran on any platform that supports PowerShell 7.0 and `ffmpeg`. I've been making this on macOS.
## Sample Usage
### Usage 01
- Convert the first video stream and audio stream
- CRF value is set to 16
- Encoding preset is set to fast
```powershell
./Convert-VideoToMP4.ps1 -VideoFile "./path/to/video" -OutputDir "./" -VideoStream 0 -AudioStream 0 -VideoConstantRateFactor 16 -VideoEncodingSpeed fast
```
### Usage 02
- Convert the first video stream
- Copy the audio stream
- CRF value is set to 16
- Encoding preset is set to fast
```powershell
./Convert-VideoToMP4.ps1 -VideoFile "./path/to/video" -OutputDir "./" -VideoStream 0 -AudioStream 0 -CopyAudioStream -VideoConstantRateFactor 16 -VideoEncodingSpeed fast
```
### Usage 03
- Convert the first video stream and audio stream
- The first subtitle stream will also be burned into the video stream
- CRF value is set to 12
```powershell
./Convert-VideoToMP4.ps1 -VideoFile "./path/to/video" -OutputDir "./" -VideoStream 0 -AudioStream 0 -SubtitleStream -VideoConstantRateFactor 12
```
### Usage 04
- Convert the first video stream and audio stream
- The first subtitle stream will also be burned into the video stream
- CRF value is set to 12
```powershell
./Convert-VideoToMP4.ps1 -VideoFile "./path/to/video" -OutputDir "./" -VideoStream 0 -AudioStream 0 -SubtitleStream 0 -VideoConstantRateFactor 12
```
### Usage 05
- Convert the first video stream and audio stream
- The first subtitle stream will also be burned into the video stream
- _Not supplying the `-VideoStream` and `-AudioStream` parameters will imply that the first stream will be used._
- CRF value is set to 12
- Will only encode a 69 seconds of the video starting at the `4 minutes and 20 seconds` timestamp.
```powershell
./Convert-VideoToMP4.ps1 -VideoFile "./path/to/video" -OutputDir "./" -SubtitleStream 0 -VideoConstantRateFactor 12 -TestConversionStartTime "00:04:20" -TestConversionDuration 69
```