handbrake-loader
v1.0.2
Published
Encode/Transcode videos with webpack
Downloads
4
Maintainers
Readme
handbrake-loader
Use HandBrake to Encode/Transcode Video files with Webpack.
Install
$ npm install handbrake-loader --save
Usage
In your webpack.config.js
add the handbrake-loader, chained with the file-loader, url-loader or raw-loader:
{
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")
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