Skip to content

Commit 0203138

Browse files
committed
fix: update completions
1 parent 02fba8e commit 0203138

2 files changed

Lines changed: 36 additions & 6 deletions

File tree

completions/ffmpeg-normalize-shtab.bash

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33

44

5-
_shtab_ffmpeg_normalize_option_strings=('-h' '--help' '-o' '--output' '-of' '--output-folder' '-f' '--force' '-d' '--debug' '-v' '--verbose' '-q' '--quiet' '-n' '--dry-run' '-pr' '--progress' '--version' '-nt' '--normalization-type' '-t' '--target-level' '-p' '--print-stats' '-lrt' '--loudness-range-target' '--keep-loudness-range-target' '--keep-lra-above-loudness-range-target' '-tp' '--true-peak' '--offset' '--lower-only' '--auto-lower-loudness-target' '--dual-mono' '--dynamic' '-c:a' '--audio-codec' '-b:a' '--audio-bitrate' '-ar' '--sample-rate' '-ac' '--audio-channels' '-koa' '--keep-original-audio' '-prf' '--pre-filter' '-pof' '--post-filter' '-vn' '--video-disable' '-c:v' '--video-codec' '-sn' '--subtitle-disable' '-mn' '--metadata-disable' '-cn' '--chapters-disable' '-ei' '--extra-input-options' '-e' '--extra-output-options' '-ofmt' '--output-format' '-ext' '--extension')
5+
_shtab_ffmpeg_normalize_option_strings=('-h' '--help' '--input-list' '-o' '--output' '-of' '--output-folder' '-f' '--force' '-d' '--debug' '-v' '--verbose' '-q' '--quiet' '-n' '--dry-run' '-pr' '--progress' '--version' '-nt' '--normalization-type' '-t' '--target-level' '-p' '--print-stats' '--replaygain' '-lrt' '--loudness-range-target' '--keep-loudness-range-target' '--keep-lra-above-loudness-range-target' '-tp' '--true-peak' '--offset' '--lower-only' '--auto-lower-loudness-target' '--dual-mono' '--dynamic' '-as' '--audio-streams' '--audio-default-only' '--keep-other-audio' '-c:a' '--audio-codec' '-b:a' '--audio-bitrate' '-ar' '--sample-rate' '-ac' '--audio-channels' '-koa' '--keep-original-audio' '-prf' '--pre-filter' '-pof' '--post-filter' '-vn' '--video-disable' '-c:v' '--video-codec' '-sn' '--subtitle-disable' '-mn' '--metadata-disable' '-cn' '--chapters-disable' '-ei' '--extra-input-options' '-e' '--extra-output-options' '-ofmt' '--output-format' '-ext' '--extension')
66

77

88

99
_shtab_ffmpeg_normalize__nt_choices=('ebu' 'rms' 'peak')
1010
_shtab_ffmpeg_normalize___normalization_type_choices=('ebu' 'rms' 'peak')
1111

12-
_shtab_ffmpeg_normalize_pos_0_nargs=+
12+
_shtab_ffmpeg_normalize_pos_0_nargs=*
1313
_shtab_ffmpeg_normalize__h_nargs=0
1414
_shtab_ffmpeg_normalize___help_nargs=0
1515
_shtab_ffmpeg_normalize__o_nargs=+
@@ -29,12 +29,15 @@ _shtab_ffmpeg_normalize___progress_nargs=0
2929
_shtab_ffmpeg_normalize___version_nargs=0
3030
_shtab_ffmpeg_normalize__p_nargs=0
3131
_shtab_ffmpeg_normalize___print_stats_nargs=0
32+
_shtab_ffmpeg_normalize___replaygain_nargs=0
3233
_shtab_ffmpeg_normalize___keep_loudness_range_target_nargs=0
3334
_shtab_ffmpeg_normalize___keep_lra_above_loudness_range_target_nargs=0
3435
_shtab_ffmpeg_normalize___lower_only_nargs=0
3536
_shtab_ffmpeg_normalize___auto_lower_loudness_target_nargs=0
3637
_shtab_ffmpeg_normalize___dual_mono_nargs=0
3738
_shtab_ffmpeg_normalize___dynamic_nargs=0
39+
_shtab_ffmpeg_normalize___audio_default_only_nargs=0
40+
_shtab_ffmpeg_normalize___keep_other_audio_nargs=0
3841
_shtab_ffmpeg_normalize__koa_nargs=0
3942
_shtab_ffmpeg_normalize___keep_original_audio_nargs=0
4043
_shtab_ffmpeg_normalize__vn_nargs=0
@@ -108,6 +111,7 @@ _set_new_action() {
108111
# ${!x} -> ${hello} -> "world"
109112
_shtab_ffmpeg_normalize() {
110113
local completing_word="${COMP_WORDS[COMP_CWORD]}"
114+
local previous_word="${COMP_WORDS[COMP_CWORD-1]}"
111115
local completed_positional_actions
112116
local current_action
113117
local current_action_args_start_index
@@ -164,6 +168,10 @@ _shtab_ffmpeg_normalize() {
164168
if [[ $pos_only = 0 && "${completing_word}" == -* ]]; then
165169
# optional argument started: use option strings
166170
COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") )
171+
elif [[ "${previous_word}" == ">" || "${previous_word}" == ">>" ||
172+
"${previous_word}" =~ ^[12]">" || "${previous_word}" =~ ^[12]">>" ]]; then
173+
# handle redirection operators
174+
COMPREPLY=( $(compgen -f -- "${completing_word}") )
167175
else
168176
# use choices & compgen
169177
local IFS=$'\n' # items may contain spaces, so delimit using newline

completions/ffmpeg-normalize-shtab.zsh

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ _shtab_ffmpeg_normalize_commands() {
1212

1313
_shtab_ffmpeg_normalize_options=(
1414
"(- : *)"{-h,--help}"[show this help message and exit]"
15+
"--input-list[Path to a text file containing a line-separated list of input files]:input_list:"
1516
{-o,--output}"[Output file names. Will be applied per input file.
1617
1718
If no output file name is specified for an input file, the output files
@@ -50,6 +51,10 @@ in LUFS. The range is -70.0 - -5.0.
5051
Otherwise, the range is -99 to 0.
5152
]:target_level:"
5253
{-p,--print-stats}"[Print loudness statistics for both passes formatted as JSON to stdout.]"
54+
"--replaygain[Write ReplayGain tags to the original file without normalizing.
55+
This mode will overwrite the input file and ignore other options.
56+
Only works with EBU normalization, and only with .mp3, .mp4\/.m4a, .ogg, .opus for now.
57+
]"
5358
{-lrt,--loudness-range-target}"[EBU Loudness Range Target in LUFS (default\: 7.0).
5459
Range is 1.0 - 50.0.
5560
]:loudness_range_target:"
@@ -69,14 +74,17 @@ Range is -99.0 - \+99.0.
6974
"--lower-only[Whether the audio should not increase in loudness.
7075
7176
If the measured loudness from the first pass is lower than the target
72-
loudness then normalization pass will be skipped for the measured audio
73-
source.
77+
loudness then normalization will be skipped for the audio source.
78+
79+
For EBU normalization, this compares input integrated loudness to the target level.
80+
For peak normalization, this compares the input peak level to the target level.
81+
For RMS normalization, this compares the input RMS level to the target level.
7482
]"
7583
"--auto-lower-loudness-target[Automatically lower EBU Integrated Loudness Target to prevent falling
7684
back to dynamic filtering.
7785
7886
Makes sure target loudness is lower than measured loudness minus peak
79-
loudness (input_i - input_tp) by a small amount.
87+
loudness (input_i - input_tp) by a small amount (0.1 LUFS).
8088
]"
8189
"--dual-mono[Treat mono input files as \"dual-mono\".
8290
@@ -92,6 +100,20 @@ normalization. This is not usually recommended.
92100
93101
Dynamic mode will automatically change the sample rate to 192 kHz. Use
94102
-ar\/--sample-rate to specify a different output sample rate.
103+
]"
104+
{-as,--audio-streams}"[Select specific audio streams to normalize by stream index (comma-separated).
105+
Example\: --audio-streams 0,2 will normalize only streams 0 and 2.
106+
107+
By default, all audio streams are normalized.
108+
]:audio_streams:"
109+
"--audio-default-only[Only normalize audio streams with the \'default\' disposition flag.
110+
This is useful for files with multiple audio tracks where only the main track
111+
should be normalized (e.g., keeping commentary tracks unchanged).
112+
]"
113+
"--keep-other-audio[Keep non-selected audio streams in the output file (copy without normalization).
114+
Only applies when --audio-streams or --audio-default-only is used.
115+
116+
By default, only selected streams are included in the output.
95117
]"
96118
{-c:a,--audio-codec}"[Audio codec to use for output files.
97119
See \`ffmpeg -encoders\` for a list.
@@ -169,7 +191,7 @@ extension will govern the format (see \'--extension\' option).
169191
{-ext,--extension}"[Output file extension to use for output files that were not explicitly
170192
specified. (Default\: \`mkv\`)
171193
]:extension:"
172-
"(*):Input media file(s):"
194+
"(*)::Input media file(s):"
173195
)
174196

175197

0 commit comments

Comments
 (0)