aboutsummaryrefslogtreecommitdiffstats
path: root/src/_bento4
blob: 12efb31c0d3b3cb2e21727224a7b079da9dfad40 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
#compdef aac2mp4 mp42aac mp42avc mp42hevc mp42hls mp42ts mp4compact mp4dash mp4dashclone mp4dcfpackager mp4decrypt mp4dump mp4edit mp4encrypt mp4extract mp4fragment mp4hls mp4iframeindex mp4info mp4mux mp4rtphintinfo mp4split mp4tag
# ------------------------------------------------------------------------------
# Copyright (c) 2026 Github zsh-users - https://github.com/zsh-users
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
#  Completion script for bento4 tools 1.6.0-641 (https://github.com/axiomatic-systems/Bento4)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
#  * Shohei Yoshida (https://github.com/syohex) <syohex@gmail.com>
#
# ------------------------------------------------------------------------------

local -a encrypt_methods=(
  OMA-PDCF-CBC OMA-PDCF-CTR MARLIN-IPMP-ACBC MARLIN-IPMP-ACGK ISMA-IAEC PIFF-CBC
  PIFF-CTR MPEG-CENC MPEG-CBC1 MPEG-CENS MPEG-CBCS
)
local -a options=()

case $service in
  (mp42aac|mp42avc|mp42hevc)
    options+=('--key[128-bit decryption key (in hex: 32 chars)]:key')
    ;;
  (mp42hls)
    options+=(
      '--verbose[enable verbose mode]'
      '--show-info[show information]'
      '--hls-version[HLS version(default: 3)]:version'
      '--pmt-pid[PID to use for the PMT(default: 0x100)]:pid'
      '--audio-pid[PID to use for audio packets(default: 0x101)]:pid'
      '--video-pid[PID to use for video packets(default: 0x102)]:pid'
      '--audio-track-id[Read audio from the given track ID(0 means no audio)]:track_id'
      '--video-track-id[Read video from the given track ID(0 means no video)]:track_id'
      '--audio-format[Format to use for audio-only segments(default: ts)]:format:(ts packed)'
      '--segment-duration[Target segment duration in seconds(default: 6)]:seconds'
      '--segment-duration-threshold[Segment duration threshold in milliseconds(default: 15)]:seconds'
      '--pcr-offset[offset in units of 90kHz(default: 1000)]:offset'
      '--index-filename[File name to use for the playlist/index(default: stream.m3u8)]:name:_files'
      '--allow-cache[set #EXT-X-ALLOW_CACHE to YES or NO]: :(YES NO)'
      '--segment-filename-template[File name pattern to use for the segment(default: segment-%d.<ext> or stream.<ext>)]:pattern'
      '--segment-url-template[URL pattern to use for segments(default: segment-%d.<ext> or stream.<ext>)]:pattern'
      '--iframe-index-filename[File name to use for the I-Frame playlist(default: iframes.m3u8)]:file:_files'
      '--output-single-file[Output all the media in a single file instead of separate segment files]'
      '--encryption-mode[Encryption mode(default: AES-128)]:mode:(AES-128 SAMPLE-AES)'
      '--encryption-key[Encryption key in hexadecimal(default: no encryption)]:key'
      '--encryption-iv-mode[Encryption IV mode(default: separate)]:mode:(sequence random fps)'
      '--encryption-key-uri[Encryption key URI, relative or absolute URI(default: key.bin)]:uri'
      '--encryption-key-format[Encryption key format(default: identity)]:format'
      '--encryption-key-format-versions[Encryption key format versions]:versions'
      '--encryption-key-line[Preformatted encryption key line]:ext_x_key_line'
    )
    ;;
  (mp42ts)
    options+=(
      '--pmt-pid[PID to use for the PMT(default: 0x100)]:pid'
      '--audio-pid[PID to use for audio packets(default: 0x101)]:pid'
      '--video-pid[PID to use for video packets(default: 0x102)]:pid'
      '--segment[Segment duration in seconds]:seconds'
      '--segment-duration-threshold[Segment duration threshold in milliseconds(default: 50)]:seconds'
      '--pcr-offset[offset in units of 90kHz(default: 1000)]:offset'
      '--verbose[enable verbose mode]'
      '--playlist[Playlist file name]:file:_files'
      '--playlist-hls-version[HLS version(default: 3)]:version'
    )
    ;;
  (mp4compact)
    options+=('--verbose[Enable verbose mode]')
    ;;
  (mp4dash)
    options+=(
      '(- *)'{-h,--help}'[Show this help message and exit]'
      '(-v --verbose)'{-v,--verbose}'[Be verbose]'
      '(-d --debug)'{-d,--debug}'[Print out debugging information]'
      '(-o --output-dir)'{-o,--output-dir=}'[Output directory]:dir:_files -/'
      '(-f --force)'{-f,--force}'[Allow output to an existing directory]'
      '--mpd-name=[MPD file name]:file:_files'
      '--profiles=[Comma-separated list of one or more profile(s)]:profiles'
      '--no-media[Do not output media files (MPD/Manifests only)]'
      '--rename-media[Use a file name pattern instead of the base name of input files]'
      '--media-prefix=[Use this prefix for prefixed media file names(default: media)]:prefix'
      '--init-segment=[Initialization segment name]:file:_files'
      '--no-split[Do not split the file into individual segment files]'
      '--use-segment-list[Use segment lists instead of segment templates]'
      '--use-segment-template-number-padding[Use padded numbers in segment URL/filename templates]'
      '--use-segment-timeline[Use segment timelines]'
      '--min-buffer-time=[Minimum buffer time in seconds]:seconds'
      '--max-playout-rate=[Max Playout Rate setting strategy for trick-play support]:strategy:(lowest:X)'
      '--language-map=[Remap language code <lang_from> to <lang_to>]:from_to_list'
      '--always-output-lang[Always output an @lang attribute for audio tracks]'
      '--subtitles[Enable Subtitles]'
      *'--attributes=[Specify the attributes of a set of tracks]:attribute'
      '--smooth[Produce an output compatible with Smooth Streaming]'
      '--smooth-client-manifest-name=[Smooth Streaming Client Manifest file name]:file:_files'
      '--smooth-server-manifest-name=[Smooth Streaming Server Manifest file name]:file:_files'
      '--smooth-h264-fourcc=[Smooth Streaming FourCC value for H.264 video(default H264)]:fourcc'
      '--hls[Output HLS playlists in addition to MPEG DASH]'
      '--hls-key-url=[HLS key URL (default: key.bin)]:url'
      '--hls-master-playlist-name=[HLS master playlist name (default: master.m3u8)]:file:_files'
      '--hls-media-playlist-name=[HLS media playlist name (default: media.m3u8)]:file:_files'
      '--hls-iframes-playlist-name=[HLS I-Frames playlist name (default: iframes.m3u8)]'
      '--hippo[Produce an output compatible with the Hippo Media Server]'
      '--hippo-server-manifest-name=[Hippo Media Server Manifest file name]:file:_files'
      '--use-compat-namespace[Use the original DASH MPD namespace]'
      '--use-legacy-audio-channel-config-uri[Use the legacy DASH namespace URI]'
      '--encryption-key=[Encryption key specifications]:key_spec'
      '--encryption-cenc-scheme=[MPEG Common Encryption scheme(default: cenc)]:scheme:(cenc cbc1 cens cbcs)'
      '--encryption-args=[Pass additional command line arguments to mp4encrypt]:args'
      '--eme-signaling=[Add EME-compliant signaling in the MPD and PSSH boxes]:type:(pssh-v0 pssh-v1)'
      '--merge-keys[Merge all keys in a single set used for all ContentProtection elements]'
      '--marlin[Add Marlin signaling to the MPD]'
      '--marlin-add-pssh[Add an (optional) Marlin "pssh" box in the init segment(s)]'
      '--playready[Add PlayReady signaling to the MPD]'
      '--playready-version=[PlayReady version to use]:version:(4.0 4.1 4.2 4.3)'
      '--playready-header=[Add a PlayReady PRO element in the MPD and a PlayReady PSSH box in the init segments]:header'
      '--playready-no-pssh[Do not store the PlayReady header in a "pssh" box in the init segment(s)]'
      '--widevine[Add Widevine signaling to the MPD]'
      '--widevine-header=[Add a Widevine entry in the MPD, and a Widevine PSSH box in the init segments]:header'
      '--primetime[Add Primetime signaling to the MPD]'
      '--primetime-metadata=[Add Primetime metadata in a PSSH box in the init segments]:metadata'
      '--fairplay-key-uri=[Specify the key URI to use for FairPlay Streaming key delivery]:uri'
      '--clearkey[Add Clear Key signaling to the MPD]'
      '--clearkey-license-uri=[Specify the license/key URI to use for Clear Key]'
      '--exec-dir=[Directory where the Bento4 executables are located]:dir:_files -/'
    )
    ;;
  (mp4dashclone)
    options+=(
      '(- *)'{-h,--help}'[Show this help message and exit]'
      '--quiet[Be quiet]'
      '--encrypt=[Encrypt the media with KID and KEY specified in HEX(32 characters each)]:key'
      '--exec-dir=[Directory where the Bento4 executables are located]:dir:_files -/'
    )
    ;;
  (mp4dcfpackager)
    options+=(
      '--method[method name]:method:(NULL CBC CTR)'
      '--content-type[Content MIME type]:mime_type'
      '--content-id[Content ID]:id'
      '--rights-issuer[rights issuer URL]:url'
      '--key[Specify the key to use for encryption]:key'
      *'--textual-header[Specify a textual header]:header'
    )
    ;;
  (mp4decrypt)
    options+=(
      '--show-progress[Show progress details]'
      '--key[Specify the key to use for decryption]:key'
      '--fragments-info[File to decrypt the fragments read from]:file:_files'
    )
    ;;
  (mp4dump)
    options+=(
      '--verbosity[Set the verbosity level]:level:(0 1 2 3)'
      '--track[Write the track data into a file]:file:_files'
      '--format[Format to use for the output(default: text)]:format:(text json)'
    )
    ;;
  (mp4edit)
    options+=(
      '--insert[insert atom data]:atom_path_and_source_and_position'
      '--remove[remove atom data]:atom_path'
      '--replace[replace atom data]:atom_path_and_source'
    )
    ;;
  (mp4encrypt)
    options+=(
      '--method=[Encryption method]:method:($encrypt_methods)'
      '--show-progress[Show progress details]'
      '--fragments-info[Encrypt the fragments read from <input> with track info read from the given file]:file:_files'
      '--multi[Encrypt multiple individual fragment files]'
      '--key[Specify the key to use for a track (or group key)]:key_spec'
      '--strict[Fail if there is a warning]'
      *'--property[Specify a named string property for a track]:property'
      '--global-option[Set the global option]:option'
      '--pssh[Add a "pssh" atom for this system ID with the payload]:pssh'
      '--pssh-v1[Same as --pssh but generates a version=1 "pssh" atom]:pssh'
      '--kms-uri[Specify the KMS URI for the ISMA-IAEC method]:uri'
    )
    ;;
  (mp4extract)
    options+=(
      '--payload-only[Omit the atom header]'
    )
    ;;
  (mp4fragment)
    options+=(
      '--verbosity[Set the verbosity level]:level:(0 1 2 3)'
      '--debug[Enable debugging information output]'
      '--quiet[Do not print out notice messages]'
      '--fragment-duration[Fragment duration in milliseconds(default: automatic)]:msecs'
      '--timescale[Time scale]:time_scale'
      '--track[Specify track ID or type only include media from one track]:id_or_type:(audio video subtitles)'
      '--index[(Re)create the segment index]'
      '--trim[Trim excess media in longer tracks]'
      '--no-tfdt[Do not add "tfdt boxes in the fragments"]'
      '--tfdt-start[Set start value of the first tfdt timestamp]:start'
      '--sequence-number-start[Set start value of the first segment sequence number(default: 1)]:number'
      '--force-i-frame-sync[Treat all I-frames as sync samples]:type:(auto all)'
      '--copy-udta[Copy the moov/udta atom from input to output]'
      '--no-zero-elst[Do not set the last edit list entry to 0 duration]'
      '--trun-version-zero[Set the "trun" box version to zero(default version: 1)]'
    )
    ;;
  (mp4hls)
    options+=(
      '(- *)'{-h,--help}'[Show this help message and exit]'
      '(-v --verbose)'{-v,--verbose}'[Be verbose]'
      '(-d --debug)'{-d,--debug}'[Print out debugging information]'
      '(-o --output-dir)'{-o,--output-dir=}'[Output directory]:dir:_files -/'
      '(-f --force)'{-f,--force}'[Allow output to an existing directory]'
      '--hls-version=[HLS version]:version'
      '--master-playlist-name=[Master Playlist name]:file:_files'
      '--media-playlist-name=[Media Playlist name]:file:_files'
      '--iframe-playlist-name=[I-frame Playlist name]:name'
      '--output-single-file[Store segment data in a single output file per input file]'
      '--audio-format=[Format for audio segments]:format:(packed ts)'
      '--segment-duration=[Segment duration(default: 6)]:duration'
      '--encryption-mode=[Encryption mode(default: AES-128)]:mode:(AES-128 SAMPLE-AES)'
      '--encryption-key=[Encryption key in hexadecimal]:key'
      '--encryption-iv-mode=[Encryption IV mode]:mode:(sequence random fps)'
      '--encryption-key-uri=[Encryption key URI(default: key.bin)]:uri'
      '--encryption-key-format=[Encryption key format (default: identity)]:mode:(identity)'
      '--encryption-key-format-versions=[Encryption key format versions]:versions'
      '--signal-session-key[Signal an #EXT-X-SESSION-KEY tag in the master playlist]'
      '--fairplay=[Enable FairPlay Key Delivery and set parameters]:parameters'
      '--widevine=[Enable Widevine Key Delivery and set parameters]:parameters'
      '--output-encryption-key[Output the encryption key to a file]'
      '--exec-dir=[Directory where the Bento4 executables are located]:dir:_files -/'
      '--base-url=[The base URL for the Media Playlists and TS files listed in the playlists]:uri'
    )
    ;;
  (mp4iframeindex)
    options+=(
      '--track[ID of the video track]:id'
    )
    ;;
  (mp4info)
    options+=(
      '--verbose[Show extended information when available]'
      '--format[Display the information in this format(default: text)]:format:(text json)'
      '--show-layout[Show sample layout]'
      '--show-samples[Show sample details]'
      '--show-sample-data[Show sample data]'
      '--fast[Skip some details that are slow to compute]'
    )
    ;;
  (mp4mux)
    options+=(
      *'--track=[Track type, input, parameters]:track'
      '--verbose[Show more details]'
    )
    ;;
  (mp4rtphintinfo)
    options+=(
      '--trackid[Hint track ID]:id'
    )
    ;;
  (mp4split)
    options+=(
      '--verbose[Print verbose information when running]'
      '--init-segment[Name of init segment(default: init.mp4)]:file:_files'
      '--init-only[Only output the init segment(no media segments)]'
      '--media-segment[Segment file name pattern(default: segment-%llu.%04llu.m4s)]:pattern'
      '--start-number[Start numbering segments at n(default=1)]:number'
      '--pattern-parameters[One or more selector letter(default: IN)]:params'
      '--track-id[Only output segments with this track ID]:id'
      '--audio[Only output audio segments]'
      '--video[Only output video segments]'
    )
    ;;
  (mp4tag)
    options+=(
      '--help[Print this usage information]'
      '--show-tags[Show tags found in the input file]'
      '--list-symbols[List all the builtin symbols]'
      '--list-keys[List all the builtin symbolic key names]'
      '--set[Set a tag]:tag'
      '--add[Set/Add a tag]:tag'
      '--remove[Remove a tag]:key'
      '--extract[extract the value of a tag and save it to a file]:key_file'
    )
    ;;
esac

_arguments \
  $options[@] \
  "*::file:_files"

# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et