Skip to content

CLI tool for processing Dolby Vision videos, with a focus on CMv4.0 + P7 CMv2.9 hybrid creation

License

Notifications You must be signed in to change notification settings

bbeny123/remuxer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

remuxer

remuxer is a CLI tool for processing Dolby Vision videos, with a focus on CMv4.0 + P7 CMv2.9 hybrid creation.

The script is partially based on DoVi_Scripts


Prerequisites

Shell

Requirements: Bash 4.1+ and GNU coreutils

  • On Unix-based systems (Linux, macOS), these are typically pre-installed.
  • On Windows, Git Bash provides a compatible environment.

The script was primarily tested on Windows (using Git Bash), but should also work on other platforms with compatible external tool binaries.

External Tools

All required external tools must be downloaded and placed in the directory specified by the TOOLS_DIR variable.

Note: If a non-default directory or tool names are used, update TOOLS_DIR variable and the corresponding alias definitions at the top of the script.

The versions listed above are those with which remuxer was tested.
Other versions may work, but compatibility is not guaranteed.

Tab Completion (Optional)

To enable tab-completion, run:

source remuxer_complete.sh

By default, completion is configured for the remuxer alias.
If you're using a different alias or command name, either modify the last line in remuxer_complete.sh, or run:

source remuxer_complete.sh
complete -F _remuxer_complete <your_alias>

To enable completion permanently, add the appropriate lines to ~/.bash_profile or ~/.bashrc.

Note: Use absolute paths in shell profiles — relative paths may not resolve correctly.


Configuration

The script’s default behavior can be customized using variables defined at the top of the script.
Most of these variables can also be overridden at runtime using the corresponding CLI options.

Variable
CLI option
Description Allowed values
OUT_DIR
--out-dir
Output directory <path>
Default: working dir
TMP_DIR
--tmp-dir
Temporary directory for intermediate files
Will be auto-removed if created by the script
<path>
Default: auto‑created in working dir
PLOTS_DIR L1 plots output directory <path>
Default: same as OUT_DIR
RPU_LEVELS
--levels
RPU levels used by inject command
Valid RPU levels: 1-6, 8-11, 254, 255
<comma-separated RPU levels list>
Default: 3,8,9,11,254 (CMv4.0 levels)
INFO_INTERMEDIATE
--info
Intermediate info commands 0 - disabled
1 - enabled (default)
PLOT_DEFAULT
--plot
Default plotting mode
Valid values:
0 / nonenone
1 / allall available
L1L1 Dynamic Brightness
L2[_NITS]L2 Trims
L8T[_NITS]L8 Trims
L8S[_NITS]L8 Saturation Vectors
L8H[_NITS]L8 Hue Vectors
NITS - 100 (default), 600, 1000 or MAX
<comma-separated list>
Default: L1,L2,L2_MAX,L8T
FIX_CUTS_FIRST
--cuts-first
Force first frame as scene-cut 0 - disabled
1 - enabled (default)
FIX_CUTS_CONSEC
--cuts-consecutive
Consecutive scene-cuts fixing 0 - disabled
1 - enabled (default)
CLEAN_FILENAMES
--clean-filenames
Clean output filenames
Examples:
  • Show.S01E01.HDR → Show S01E01
  • A.Movie.2025.2160p.DV → A Movie
0 - disabled
1 - enabled (default)
SUBS_AUTODETECTION
--subs-find
Additional subtitles auto-detection 0 - disabled
1 - enabled (default)
TITLE_SHOWS_AUTO
--title-auto
Generation of TV shows metadata title
(based on input's filename)
0 - disabled (default)
1 - enabled
TITLE_MOVIES_AUTO
--title-auto
Generation of movies metadata title
(based on input's filename)
0 - disabled
1 - enabled (default)
TRACK_NAMES_AUTO
--tracks-auto
Generation of some metadata track names
Examples:
  • audio: TrueHD Atmos 7.1
  • subs: Polish
0 - disabled
1 - enabled (default)
AUDIO_COPY_MODE
--audio-copy
Input's audio tracks copy mode 1 - 1st track only
2 - 1st + compatibility if 1st is TrueHD
3 - all (default)
SUBS_COPY_MODE
--subs-copy
Input's subtitle tracks copy mode 0 - none
1 - all (default)
<lng> - ISO 639-2 lang code based
SUBS_LANG_CODES
--lang
Subtitle language ISO 639-2 codes to extract
(subs command only)
<comma-separated ISO 639-2 codes>
Default: all
TOPSUBS_LANG_CODES
--lang
Subtitle language ISO 639-2 codes to process
(topsubs command only)
<comma-separated ISO 639-2 codes>
Default: all
TOPSUBS_MAX_OFFSET
--max-y
Y offset to consider subs as top-positioned
(topsubs command only)
<offset in pixels>
Default: 600
PRORES_PROFILE
PRORES_MACOS
--profile
Default ProRes encoding profile by encoder:
  • PRORES_PROFILE → prores_ks
  • PRORES_MACOS → prores_videotoolbox
0 - 422 Proxy
1 - 422 LT
2 - 422 (default PRORES_MACOS)
3 - 422 HQ (default PRORES_PROFILE)
4 - 4444
5 - 4444 XQ
L1_TUNING
--tuning
Dolby Vision L1 analysis tuning 0 / legacy - Legacy CM4
1 / most - Most Highlight Detail
2 / more - More Highlight Detail
3 / balanced - Balanced (default)
4 / less - Less Highlight Detail
5 / least - Least Highlight Detail
EXTRACT_SHORT_SEC Sample duration in seconds
(related with --sample option)
<duration in seconds>
Default: 23
FFMPEG_STRICT Controls FFmpeg experimental strict mode
Note: Avoid using untrusted inputs if 1
0 - disabled
1 - enabled (default)

Usage

Usage: remuxer [OPTIONS] <COMMAND>

Commands:
  info           Show Dolby Vision information
  plot           Plot L1/L2/L8 metadata
  shift          Calculate frame shift
  sync           Synchronize Dolby Vision RPU files
  fix            Fix or adjust Dolby Vision RPU(s)
  generate       Generate Dolby Vision P8 RPU for HDR10 video(s)
  inject         Sync & Inject Dolby Vision RPU
  remux          Remux video file(s)
  extract        Extract RPU(s) or base layer(s), or convert to ProRes
  cuts           Extract scene-cut frame list(s)
  subs           Extract .srt subtitles
  png            Extract video frame(s) as PNG image(s)
  mp3            Extract audio track(s) as MP3 file(s)
  edl            Convert scene-cut list between .txt and .edl

Options:
  -h, --help     Show help (use '--help' for a detailed version)
  -v, --version  Show version

For more information about a command, run:
  remuxer <COMMAND> --help

Common Options

The following options are available for all commands:

Options:
      --out-dir <DIR>  Output files dir path
      --tmp-dir <DIR>  Temp files dir path [will be removed if created]
  -h, --help           Show help (use '--help' for a detailed version)

info command

Description: Show Dolby Vision information

Usage: remuxer info [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>       Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>  Filter files by format in dir inputs
  -t, --input-type <TYPE>   Filter files by type in dir inputs
  -o, --output <OUTPUT>     Output file path [default: <print to console>]
  -u, --frames <F1[,...]>   Print RPU info for given frames
  -s, --sample [<SECONDS>]  Process only the first N seconds of input
  -p, --plot <P1[,...]>     Controls L1/L2/L8 intermediate plotting

plot command

Description: Plot L1/L2/L8 metadata

Usage: remuxer plot [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>       Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>  Filter files by format in dir inputs
  -t, --input-type <TYPE>   Filter files by type in dir inputs
  -o, --output <OUTPUT>     Output file path [default: generated]
  -s, --sample [<SECONDS>]  Process only the first N seconds of input
  -p, --plot <P1[,...]>     Controls L1/L2/L8 plotting

shift command

Description: Calculate frame shift of <input> relative to <base-input>

Usage: remuxer shift [OPTIONS] --base-input <BASE-INPUT> [INPUT]

Options:
  -i, --input <INPUT>       Input file path
  -b, --base-input <INPUT>  Base input file path [required]

sync command

Description: Synchronize RPU of <input> to align with RPU of <base-input>

Usage: remuxer sync [OPTIONS] --base-input <BASE-INPUT> [INPUT]

Options:
  -i, --input <INPUT>       Input file path
  -b, --base-input <INPUT>  Base input file path [required]
  -o, --output <OUTPUT>     Output file path [default: generated]
  -f, --shift <SHIFT>       Frame shift value [default: auto-calculated]
  -n, --info <0|1>          Controls intermediate info commands [default: 1]
  -p, --plot <P1[,...]>     Controls L1/L2/L8 intermediate plotting

fix command

Description: Fix or adjust Dolby Vision RPU(s)

Usage: remuxer fix [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>             Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>        Filter files by format in dir inputs
  -t, --input-type <TYPE>         Filter files by type in dir inputs
  -o, --output <OUTPUT>           Output file path [default: generated]
      --l5 <T,B[,L,R]>            Set Dolby Vision L5 active area offsets
      --l6 <MAX_CLL,MAX_FALL>     Set Dolby Vision L6 MaxCLL/MaxFALL
      --l6-source <FILE>          File path to use for L6 MaxCLL/FALL detection
      --cuts-clear <FS-FE[,...]>  Clear scene-cut flag in specified frame ranges
      --cuts-first <0|1>          Force first frame as scene-cut [default: 1]
      --cuts-consecutive <0|1>    Controls consecutive scene-cuts fixing [default: 1]
  -j, --json <FILE>               JSON config file path (applied before auto-fixes)
      --json-example              Show examples for --json option
  -n, --info <0|1>                Controls intermediate info commands [default: 1]

generate command

Description: Generate Dolby Vision P8 RPU for HDR10 video(s)

Usage: remuxer generate [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>            Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>       Filter files by format in dir inputs
  -t, --input-type <TYPE>        Filter files by type in dir inputs
  -o, --output <OUTPUT>          Output file path [default: generated]
      --profile <0-5>            Controls ProRes encoding profile (0 = Proxy, 5 = 4444 XQ)
      --cuts <FILE>              Scene-cuts file path [default: extracted from input]
      --tuning <0-5>             Controls L1 analysis tuning [default: balanced]
      --fps <FPS>                Frame rate [default: auto-detected]
      --mdl <MDL>                Mastering display [default: auto-detected]
      --l5 <T,B[,L,R]>           Dolby Vision L5 active area offsets
      --l5-analysis <T,B[,L,R]>  L5 active area offsets (for analysis only)
      --l5v <FILE>               Variable L5 metadata JSON config
      --l5v-analysis <FILE>      Variable L5 metadata JSON config (for analysis only)
      --l5v-example              Show example JSON for --l5v/--l5v-analysis
      --l6 <MAX_CLL,MAX_FALL>    Dolby Vision L6 MaxCLL/MaxFALL
      --cuts-first <0|1>         Force first frame as scene-cut [default: 1]
      --cuts-consecutive <0|1>   Controls consecutive scene-cuts fixing [default: 1]
  -n, --info <0|1>               Controls intermediate info commands [default: 1]
  -p, --plot <P1[,...]>          Controls L1/L2/L8 intermediate plotting

inject command

Description: Sync & Inject RPU of <input> into <base-input>

Usage: remuxer inject [OPTIONS] --base-input <BASE-INPUT> [INPUT]

Options:
  -i, --input <INPUT>             Input file path
  -b, --base-input <INPUT>        Base input file path [required]
  -o, --output <OUTPUT>           Output file path [default: generated]
  -e, --output-format <FORMAT>    Output format [default: auto-detected]
  -q, --synced                    Skip RPUs sync (assumes RPUs are already in sync)
  -f, --shift <SHIFT>             Frame shift value [default: auto-calculated]
  -l, --levels <L1[,...]>         RPU levels to inject [default: 3,8,9,11,254]
  -w, --raw-rpu                   Inject input RPU instead of transferring levels
      --l5 <T,B[,L,R]>            Set Dolby Vision L5 active area offsets
      --l6 <MAX_CLL,MAX_FALL>     Set Dolby Vision L6 MaxCLL/MaxFALL
      --cuts-clear <FS-FE[,...]>  Clear scene-cut flag in specified frame ranges
      --cuts-first <0|1>          Force first frame as scene-cut [default: 1]
      --cuts-consecutive <0|1>    Controls consecutive scene-cuts fixing [default: 1]
  -n, --info <0|1>                Controls intermediate info commands [default: 1]
  -p, --plot <P1[,...]>           Controls L1/L2/L8 intermediate plotting

Options for .mkv / .mp4 output:
      --subs <FILE>               .srt subtitle file path to include
      --subs-find <0|1>           Controls subtitles auto-detection [default: 1]
      --subs-copy <0|1|LNG>       Controls input subtitle tracks to copy [default: 1]
      --audio-copy <1|2|3>        Controls input audio tracks to copy [default: 3]
      --title <TITLE>             Metadata title (e.g., movie name)
      --title-auto <0|1>          Controls generation of metadata title
      --tracks-auto <0|1>         Controls generation of some track names [default: 1]
  -m, --clean-filenames <0|1>     Controls output filename cleanup [default: 1]

remux command

Description: Remux .mkv, .mp4, .m2ts or .ts file(s)

Usage: remuxer remux [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>           Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>      Filter files by format in dir inputs
  -t, --input-type <TYPE>       Filter files by type in dir inputs
  -o, --output <OUTPUT>         Output file path [default: generated]
  -e, --output-format <FORMAT>  Output format [default: auto-detected]

Options for .mkv / .mp4 output:
      --subs <FILE>             .srt subtitle file path to include
      --subs-find <0|1>         Controls subtitles auto-detection [default: 1]
      --subs-copy <0|1|LNG>     Controls input subtitle tracks to copy [default: 1]
      --audio-copy <1|2|3>      Controls input audio tracks to copy [default: 3]
  -r, --hevc <FILE>             .hevc file path to replace input video track
      --title <TITLE>           Metadata title (e.g., movie name)
      --title-auto <0|1>        Controls generation of metadata title
      --tracks-auto <0|1>       Controls generation of some track names [default: 1]
  -m, --clean-filenames <0|1>   Controls output filename cleanup [default: 1]

extract command

Description: Extract Dolby Vision RPU(s) or .hevc base layer(s), or convert to ProRes (.mov)

Usage: remuxer extract [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>           Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>      Filter files by format in dir inputs
  -t, --input-type <TYPE>       Filter files by type in dir inputs
  -o, --output <OUTPUT>         Output file path [default: generated]
  -e, --output-format <FORMAT>  Output format [default: bin]
  -s, --sample [<SECONDS>]      Process only the first N seconds of input
      --profile <0-5>           Controls ProRes encoding profile (0 = Proxy, 5 = 4444 XQ)
  -n, --info <0|1>              Controls intermediate info commands [default: 1]
  -p, --plot <P1[,...]>         Controls L1/L2/L8 intermediate plotting

cuts command

Description: Extract scene-cut frame list(s)

Usage: remuxer cuts [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>       Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>  Filter files by format in dir inputs
  -t, --input-type <TYPE>   Filter files by type in dir inputs
  -o, --output <OUTPUT>     Output file path [default: generated]
  -s, --sample [<SECONDS>]  Process only the first N seconds of input

subs command

Description: Extract .srt subtitles

Usage: remuxer subs [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>          Input file/dir path [can be used multiple times]
  -t, --input-type <TYPE>      Filter files by type in dir inputs
  -o, --output <OUTPUT>        Output file path [default: generated]
  -c, --lang <C1[,...]>        ISO 639-2 lang codes of subtitle tracks to extract
  -m, --clean-filenames <0|1>  Controls output filename cleanup [default: 1]

topsubs command

Description: Extract top-positioned PGS subtitles

Usage: remuxer topsubs [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>       Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>  Filter files by format in dir inputs
  -t, --input-type <TYPE>   Filter files by type in dir inputs
  -s, --sample [<SECONDS>]  Process only the first N seconds of input
      --fps <FPS>           Frame rate [default: auto-detected]
  -c, --lang <C1[,...]>     ISO 639-2 lang codes of subtitle tracks to process
      --max-y <MAX_OFFSET>  Maximum Y offset to consider subs as top-positioned

png command

Description: Extract video frame(s) as PNG image(s)

Useful for checking Dolby Vision L5 offsets by measuring black bars (e.g., using MS Paint)

Usage: remuxer png [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>       Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>  Filter files by format in dir inputs
  -t, --input-type <TYPE>   Filter files by type in dir inputs
  -o, --output <OUTPUT>     Output file path [default: generated]
  -k, --time [<T1[,...]>]   Approx. frame timestamp(s) in [[HH:]MM:]SS format

mp3 command

Description: Extract audio track(s) as MP3 file(s)

Useful for checking audio tracks alignment (e.g., using Sonic Visualizer)

Usage: remuxer mp3 [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>       Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>  Filter files by format in dir inputs
  -t, --input-type <TYPE>   Filter files by type in dir inputs
  -o, --output <OUTPUT>     Output file path [default: generated]
  -s, --sample [<SECONDS>]  Process only the first N seconds of input

edl command

Description: Convert scene-cut list between .txt and .edl

Usage: remuxer edl [OPTIONS] [INPUT...]

Options:
  -i, --input <INPUT>       Input file/dir path [can be used multiple times]
  -x, --formats <F1[,...]>  Filter files by format in dir inputs
  -t, --input-type <TYPE>   Filter files by type in dir inputs
  -o, --output <OUTPUT>     Output file path [default: generated]
      --fps <FPS>           Frame rate [default: 23.976]

About

CLI tool for processing Dolby Vision videos, with a focus on CMv4.0 + P7 CMv2.9 hybrid creation

Topics

Resources

License

Stars

Watchers

Forks

Languages