https://github.com/milewski/handbrake-loader
Use HandBrake to Encode/Transcode Video files with Webpack.
https://github.com/milewski/handbrake-loader
encoder handbrake transcoder webpack webpack-loader x264 x265
Last synced: 2 months ago
JSON representation
Use HandBrake to Encode/Transcode Video files with Webpack.
- Host: GitHub
- URL: https://github.com/milewski/handbrake-loader
- Owner: milewski
- License: mit
- Created: 2017-04-04T15:53:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-07-29T12:13:13.000Z (almost 2 years ago)
- Last Synced: 2025-03-11T17:51:40.207Z (3 months ago)
- Topics: encoder, handbrake, transcoder, webpack, webpack-loader, x264, x265
- Language: TypeScript
- Homepage:
- Size: 8.42 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# handbrake-loader
[](https://badge.fury.io/js/handbrake-loader)
[](https://www.npmjs.com/package/handbrake-loader)Use HandBrake to Encode/Transcode Video files with Webpack.
## Install
```bash
$ npm install handbrake-loader --save
```## Usage
In your `webpack.config.js` add the handbrake-loader, chained with the [file-loader](https://github.com/webpack/file-loader), [url-loader](https://github.com/webpack/url-loader) or [raw-loader](https://github.com/webpack/raw-loader):
```js
{
test: /\.(mov|mkv|avi|mp4)$/,
use: [
/** file-loader | url-loader | raw-loader **/
{ loader: 'file-loader' },
{
loader: 'handbrake-loader',
options: {
enable: process.env.NODE_ENV === 'production',
format: 'mp4',
srtFile: path.resolve(__dirname, 'sample-files/subtitle.srt'),
srtLang: 'eng',
srtBurn: 1,
preset: 'Very Fast 1080p30',
optimize: true
}
}
]
}
```# Options
#### preset [string]
Select preset by name (case-sensitive) Enclose names containing spaces in double quotation marks (e.g. "Preset Name")
General
- Very Fast 1080p30
- Small H.264 video (up to 1080p30) and AAC stereo audio, in an MP4 container.
- Very Fast 720p30
- Small H.264 video (up to 720p30) and AAC stereo audio, in an MP4 container.
- Very Fast 576p25
- Small H.264 video (up to 576p25) and AAC stereo audio, in an MP4 container.
- Very Fast 480p30
- Small H.264 video (up to 480p30) and AAC stereo audio, in an MP4 container.
- Fast 1080p30
- H.264 video (up to 1080p30) and AAC stereo audio, in an MP4 container.
- Fast 720p30
- H.264 video (up to 720p30) and AAC stereo audio, in an MP4 container.
- Fast 576p25
- H.264 video (up to 576p25) and AAC stereo audio, in an MP4 container.
- Fast 480p30
- H.264 video (up to 480p30) and AAC stereo audio, in an MP4 container.
- HQ 1080p30 Surround
- High quality H.264 video (up to 1080p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container.
- HQ 720p30 Surround
- High quality H.264 video (up to 720p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container.
- HQ 576p25 Surround
- High quality H.264 video (up to 576p25), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container.
- HQ 480p30 Surround
- High quality H.264 video (up to 480p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container.
- Super HQ 1080p30 Surround
- Super high quality H.264 video (up to 1080p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container.
- Super HQ 720p30 Surround
- Super high quality H.264 video (up to 720p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container.
- Super HQ 576p25 Surround
- Super high quality H.264 video (up to 576p25), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container.
- Super HQ 480p30 Surround
- Super high quality H.264 video (up to 480p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container.
Web
- Gmail Large 3 Minutes 720p30
- Encode up to 3 minutes of video in large size for Gmail (25 MB or less). H.264 video (up to 720p30) and AAC stereo audio, in an MP4 container.
- Gmail Medium 5 Minutes 480p30
- Encode up to 5 minutes of video in medium size for Gmail (25 MB or less). H.264 video (up to 480p30) and AAC stereo audio, in an MP4 container.
- Gmail Small 10 Minutes 288p30
- Encode up to 10 minutes of video in small size for Gmail (25 MB or less). H.264 video (up to 288p30) and AAC mono audio, in an MP4 container.
Devices
- Android 1080p30
- H.264 video (up to 1080p30) and AAC stereo audio, in an MP4 container. Compatible with Android devices.
- Android 720p30
- H.264 video (up to 720p30) and AAC stereo audio, in an MP4 container. Compatible with Android devices.
- Android 576p25
- H.264 video (up to 576p25) and AAC stereo audio, in an MP4 container. Compatible with Android devices.
- Android 480p30
- H.264 video (up to 480p30) and AAC stereo audio, in an MP4 container. Compatible with Android devices.
- Apple 1080p60
- Surround H.264 video (up to 1080p60), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Apple iPad Pro; iPad Air; iPad mini 2nd, 3rd Generation and later; Apple TV 4th Generation and later.
- Apple 1080p30
- Surround H.264 video (up to 1080p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Apple iPhone 5, 5S, 6, 6s, and later; iPod touch 6th Generation and later; iPad Pro; iPad Air; iPad 3rd, 4th Generation and later; iPad mini; Apple TV 3rd Generation and later.
- Apple 720p30
- Surround H.264 video (up to 720p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Apple iPhone 4 and later; iPod touch 4th, 5th Generation and later; Apple TV 2nd Generation and later.
- Apple 540p30
- Surround H.264 video (up to 540p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Apple iPhone 1st Generation, 3G, 3GS, and later; iPod touch 1st, 2nd, 3rd Generation and later; iPod Classic; Apple TV 1st Generation and later.
- Apple 240p30
- H.264 video (up to 240p30) and AAC stereo audio, in an MP4 container. Compatible with Apple iPod 5th Generation and later.
- Chromecast 1080p30
- Surround H.264 video (up to 1080p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Google Chromecast.
- Fire TV 1080p30
- Surround H.264 video (up to 1080p30), AAC stereo audio, and Dolby Digital (AC-3) audio, in an MP4 container. Compatible with Amazon Fire TV.
- Playstation 1080p30
- Surround H.264 video (up to 1080p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Playstation 3 and 4.
- Playstation 720p30
- H.264 video (up to 720p30) and AAC stereo audio, in an MP4 container. Compatible with Playstation Vita TV.
- Playstation 540p30
- H.264 video (up to 540p30) and AAC stereo audio, in an MP4 container. Compatible with Playstation Vita.
- Roku 2160p60 4K
- Surround H.265 video (up to 2160p60), AAC stereo audio, and surround audio, in an MKV container. Compatible with Roku 4.
- Roku 2160p30 4K
- Surround H.265 video (up to 2160p30), AAC stereo audio, and surround audio, in an MKV container. Compatible with Roku 4.
- Roku 1080p30
- Surround H.264 video (up to 1080p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Roku 1080p models.
- Roku 720p30
- Surround H.264 video (up to 720p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Roku 720p models.
- Roku 576p25
- H.264 video (up to 576p25) and AAC stereo audio, in an MP4 container. Compatible with Roku standard definition models.
- Roku 480p30
- H.264 video (up to 480p30) and AAC stereo audio, in an MP4 container. Compatible with Roku standard definition models.
- Windows Mobile 1080p30
- H.264 video (up to 1080p30) and AAC stereo audio, in an MP4 container. Compatible with Windows Mobile devices with Qualcomm Snapdragon 800 (MSM8974), S4 (MSM8x30, MSM8960), and better CPUs.
- Windows Mobile 720p30
- H.264 video (up to 720p30) and AAC stereo audio, in an MP4 container. Compatible with Windows Mobile devices with Qualcomm Snapdragon S4 (MSM8x27), S2 (MSM8x55), S1 (MSM8x50), and better CPUs.
- Windows Mobile 540p30
- H.264 video (up to 540p30) and AAC stereo audio, in an MP4 container. Compatible with Windows Mobile devices with Qualcomm Snapdragon 200 (MSM8210, MSM8212) and better CPUs.
- Windows Mobile 480p30
- H.264 video (up to 480p30) and AAC stereo audio, in an MP4 container. Compatible with Windows Mobile devices with Qualcomm Snapdragon S1 (MSM7x27a) and better CPUs.
- Xbox 1080p30
- Surround H.264 video (up to 1080p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Xbox One.
- Xbox Legacy 1080p30
- Surround H.264 video (up to 1080p30), AAC stereo audio, and Dolby Digital (AC-3) surround audio, in an MP4 container. Compatible with Xbox 360.
Matroska
- H.264 MKV 1080p30
- H.264 video (up to 1080p30) and AAC stereo audio, in an MKV container.
- H.264 MKV 720p30
- H.264 video (up to 720p30) and AAC stereo audio, in an MKV container.
- H.264 MKV 576p25
- H.264 video (up to 576p25) and AAC stereo audio, in an MKV container.
- H.264 MKV 480p30
- H.264 video (up to 480p30) and AAC stereo audio, in an MKV container.
- H.265 MKV 1080p30
- H.265 video (up to 1080p30) and AAC stereo audio, in an MKV container.
- H.265 MKV 720p30
- H.265 video (up to 720p30) and AAC stereo audio, in an MKV container.
- H.265 MKV 576p25
- H.265 video (up to 576p25) and AAC stereo audio, in an MKV container.
- H.265 MKV 480p30
- H.265 video (up to 480p30) and AAC stereo audio, in an MKV container.
- VP8 MKV 1080p30
- VP8 video (up to 1080p30) and Vorbis stereo audio, in an MKV container.
- VP8 MKV 720p30
- VP8 video (up to 720p30) and Vorbis stereo audio, in an MKV container.
- VP8 MKV 576p25
- VP8 video (up to 576p25) and Vorbis stereo audio, in an MKV container.
- VP8 MKV 480p30
- VP8 video (up to 480p30) and Vorbis stereo audio, in an MKV container.
- VP9 MKV 1080p30
- VP9 video (up to 1080p30) and Opus stereo audio, in an MKV container.
- VP9 MKV 720p30
- VP9 video (up to 720p30) and Opus stereo audio, in an MKV container.
- VP9 MKV 576p25
- VP9 video (up to 576p25) and Opus stereo audio, in an MKV container.
- VP9 MKV 480p30
- VP9 video (up to 480p30) and Opus stereo audio, in an MKV container.
Legacy
- Normal
- Legacy HandBrake 0.10.x H.264 Main Profile preset.
- High Profile
- Legacy HandBrake 0.10.x H.264 High Profile preset.
- Universal
- Legacy HandBrake 0.10.x preset including Dolby Digital (AC-3) surround sound and compatible with nearly all Apple devices.
- iPod
- Legacy HandBrake 0.10.x preset compatible with Apple iPod 5th Generation and later.
- iPhone & iPod touch
- Legacy HandBrake 0.10.x preset compatible with Apple iPhone 4, iPod touch 3rd Generation, and later devices.
- iPad
- Legacy HandBrake 0.10.x preset compatible with Apple iPad (all generations).
- AppleTV
- Legacy HandBrake 0.10.x preset including Dolby Digital (AC-3) surround sound, compatible with Apple TV 1st Generation and later.
- AppleTV 2
- Legacy HandBrake 0.10.x preset including Dolby Digital (AC-3) surround sound, compatible with Apple TV 2nd Generation and later.
- AppleTV 3
- Legacy HandBrake 0.10.x preset including Dolby Digital (AC-3) surround sound, compatible with Apple TV 3rd Generation and later.
- Android
- Legacy HandBrake 0.10.x preset compatible with Android 2.3 and later handheld devices.
- Android Tablet
- Legacy HandBrake 0.10.x preset compatible with Android 2.3 and later tablets.
- Windows Phone 8
- Legacy HandBrake 0.10.x preset compatible with most Windows Phone 8 devices.
#### preset-import-file [filespec]
Import presets from a json preset file. 'filespec' may be a list of files separated by spaces, or it may use shell wildcards.
#### preset-export [string]
Create a new preset from command line options and write a json representation of the preset to the console or a file if '--preset-export-file' is specified. The required argument will be the name of the new preset.
#### preset-export-file [filename]
Write new preset generated by '--preset-export' to file 'filename'.
#### preset-export-description [string]
Add a description to the new preset created with '--preset-export'
#### no-dvdnav
Do not use dvdnav for reading DVDs
#### no-opencl
Disable use of OpenCL
#### title [number]
Select a title to encode (0 to scan all titles only, default: 1)
#### min-duration
Set the minimum title duration (in seconds). Shorter titles will be ignored (default: 10).
#### scan
Scan selected title only.
#### main-feature
Detect and select the main feature title.
#### chapters [string]
Select chapters (e.g. "1-3" for chapters 1 to 3 or "3" for chapter 3 only, default: all chapters)
#### angle [number]
Select the video angle (DVD or Blu-ray only)
#### previews [number:boolean]
Select how many preview images are generated, and whether to store to disk (0 or 1). (default: 10:0)
#### start-at-preview [number]
Start encoding at a given preview.
#### start-at [string:number]
Start encoding at a given duration (in seconds), frame, or pts (on a 90kHz clock) (e.g. duration:10, frame:300, pts:900000)
#### stop-at [string:number]
Stop encoding at a given duration (in seconds), frame, or pts (on a 90kHz clock) (e.g. duration:10, frame:300, pts:900000)
#### format [string]
Select container format `av_mp4`, `av_mkv` or `mp4`, `mkv`
#### markers
Add chapter markers
#### no-markers
Disable preset chapter markers
#### optimize
Optimize MP4 files for HTTP streaming (fast start, s.s. rewrite file to place MOOV atom at beginning)
#### no-optimize
Disable preset 'optimize'
#### ipod-atom
Add iPod 5G compatibility atom to MP4 container
#### no-ipod-atom
Disable iPod 5G atom
#### use-opencl
Use OpenCL where applicable
#### encoder [string]
Select video encoder: `x264`, `x265`, `mpeg4`, `mpeg2`, `VP8`, `VP9`, `theora`
#### encoder-preset [string]
Adjust video encoding settings for a particular speed/efficiency tradeoff (encoder-specific)
- x264
- x265
- `ultrafast`,`superfast`,`veryfast`,`faster`,`fast`,`medium`,`slow`,`slower`,`veryslow`,`placebo`
- VP8
- VP9
- `veryfast`,`faster`,`fast`,`medium`,`slow`,`slower`,`veryslow`
#### encoder-tune [string]
Adjust video encoding settings for a particular type of source or situation (encoder-specific)
- x264
- `film`,`animation`,`grain`,`stillimage`,`psnr`,`ssim`,`fastdecode`,`zerolatency`
- x265
- `psnr`,`ssim`,`grain`,`zerolatency`,`fastdecode`
#### encopts [string]
Specify advanced encoding options in the same style as mencoder (all encoders except theora): option1=value1:option2=value2
#### encoder-profile [string]
Ensure compliance with the requested codec profile (encoder-specific)
- x264
- `auto`,`high`,`main`,`baseline`
- x265
- `auto`,`main`,`mainstillpicture`
#### encoder-level [string]
Ensures compliance with the requested codec level (encoder-specific)
- x264
- `auto`,`1.0`,`1b`,`1.1`,`1.2`,`1.3`,`2.0`,`2.1`,`2.2`,`3.0`,`3.1`,`3.2`,`4.0`,`4.1`,`4.2`,`5.0`,`5.1`,`5.2`
#### quality [float]
Set video quality (e.g. 22.0)
#### vb [number]
Set video bitrate in kbit/s (default: 1000)
#### two-pass
Use two-pass mode
#### no-two-pass
Disable two-pass mode
#### turbo
When using 2-pass use "turbo" options on the first pass to improve speed (works with x264 and x265)
#### no-turbo
Disable 2-pass mode's "turbo" first pass
#### rate [float]
Set video framerate (`5`,`10`,`12`,`15`,`20`,`23.976`,`24`,`25`,`29.97`,`30`,`48`,`50`,`59.94`,`60`,`72`,`75`,`90`,`100`,`120` or a number between `1` and `1000`). Be aware that not specifying a framerate lets HandBrake preserve a source's time stamps, potentially creating variable framerate video
#### vfr, cfr, pfr
Select variable, constant or peak-limited frame rate control. VFR preserves the source timing. CFR makes the output constant rate at the rate given by the -r flag (or the source's average rate if no -r is given). PFR doesn't allow the rate to go over the rate specified with the -r flag but won't change the source timing if it's below that rate. If none of these flags are given, the default is --pfr when -r is given and --vfr otherwise
More at [https://handbrake.fr/docs/en/1.0.0/cli/cli-guide.html](https://handbrake.fr/docs/en/1.0.0/cli/cli-guide.html)
## License
[MIT](LICENSE) © [Rafael Milewski](https://rafael-milewski.com?github=readme)