Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * ffmpeg option parsing | ||
3 | * | ||
4 | * This file is part of FFmpeg. | ||
5 | * | ||
6 | * FFmpeg is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * FFmpeg is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with FFmpeg; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include "config.h" | ||
22 | |||
23 | #include <stdint.h> | ||
24 | |||
25 | #if HAVE_SYS_RESOURCE_H | ||
26 | #include <sys/time.h> | ||
27 | #include <sys/resource.h> | ||
28 | #endif | ||
29 | |||
30 | #include "ffmpeg.h" | ||
31 | #include "cmdutils.h" | ||
32 | #include "opt_common.h" | ||
33 | #include "sync_queue.h" | ||
34 | |||
35 | #include "libavformat/avformat.h" | ||
36 | |||
37 | #include "libavcodec/avcodec.h" | ||
38 | #include "libavcodec/bsf.h" | ||
39 | |||
40 | #include "libavfilter/avfilter.h" | ||
41 | |||
42 | #include "libavutil/avassert.h" | ||
43 | #include "libavutil/avstring.h" | ||
44 | #include "libavutil/avutil.h" | ||
45 | #include "libavutil/bprint.h" | ||
46 | #include "libavutil/channel_layout.h" | ||
47 | #include "libavutil/display.h" | ||
48 | #include "libavutil/intreadwrite.h" | ||
49 | #include "libavutil/fifo.h" | ||
50 | #include "libavutil/mathematics.h" | ||
51 | #include "libavutil/opt.h" | ||
52 | #include "libavutil/parseutils.h" | ||
53 | #include "libavutil/pixdesc.h" | ||
54 | #include "libavutil/pixfmt.h" | ||
55 | |||
56 | const char *const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL}; | ||
57 | const char *const opt_name_frame_rates[] = {"r", NULL}; | ||
58 | const char *const opt_name_codec_tags[] = {"tag", "atag", "vtag", "stag", NULL}; | ||
59 | const char *const opt_name_top_field_first[] = {"top", NULL}; | ||
60 | |||
61 | HWDevice *filter_hw_device; | ||
62 | |||
63 | char *vstats_filename; | ||
64 | char *sdp_filename; | ||
65 | |||
66 | float audio_drift_threshold = 0.1; | ||
67 | float dts_delta_threshold = 10; | ||
68 | float dts_error_threshold = 3600*30; | ||
69 | |||
70 | enum VideoSyncMethod video_sync_method = VSYNC_AUTO; | ||
71 | float frame_drop_threshold = 0; | ||
72 | int do_benchmark = 0; | ||
73 | int do_benchmark_all = 0; | ||
74 | int do_hex_dump = 0; | ||
75 | int do_pkt_dump = 0; | ||
76 | int copy_ts = 0; | ||
77 | int start_at_zero = 0; | ||
78 | int copy_tb = -1; | ||
79 | int debug_ts = 0; | ||
80 | int exit_on_error = 0; | ||
81 | int abort_on_flags = 0; | ||
82 | int print_stats = -1; | ||
83 | int qp_hist = 0; | ||
84 | int stdin_interaction = 1; | ||
85 | float max_error_rate = 2.0/3; | ||
86 | char *filter_nbthreads; | ||
87 | int filter_complex_nbthreads = 0; | ||
88 | int vstats_version = 2; | ||
89 | int auto_conversion_filters = 1; | ||
90 | int64_t stats_period = 500000; | ||
91 | |||
92 | |||
93 | static int file_overwrite = 0; | ||
94 | static int no_file_overwrite = 0; | ||
95 | #if FFMPEG_OPT_PSNR | ||
96 | int do_psnr = 0; | ||
97 | #endif | ||
98 | int ignore_unknown_streams = 0; | ||
99 | int copy_unknown_streams = 0; | ||
100 | int recast_media = 0; | ||
101 | |||
102 | 12990 | static void uninit_options(OptionsContext *o) | |
103 | { | ||
104 | 12990 | const OptionDef *po = options; | |
105 | int i; | ||
106 | |||
107 | /* all OPT_SPEC and OPT_STRING can be freed in generic way */ | ||
108 |
2/2✓ Branch 0 taken 2481090 times.
✓ Branch 1 taken 12990 times.
|
2494080 | while (po->name) { |
109 | 2481090 | void *dst = (uint8_t*)o + po->u.off; | |
110 | |||
111 |
2/2✓ Branch 0 taken 818370 times.
✓ Branch 1 taken 1662720 times.
|
2481090 | if (po->flags & OPT_SPEC) { |
112 | 818370 | SpecifierOpt **so = dst; | |
113 | 818370 | int i, *count = (int*)(so + 1); | |
114 |
2/2✓ Branch 0 taken 26322 times.
✓ Branch 1 taken 818370 times.
|
844692 | for (i = 0; i < *count; i++) { |
115 | 26322 | av_freep(&(*so)[i].specifier); | |
116 |
2/2✓ Branch 0 taken 21234 times.
✓ Branch 1 taken 5088 times.
|
26322 | if (po->flags & OPT_STRING) |
117 | 21234 | av_freep(&(*so)[i].u.str); | |
118 | } | ||
119 | 818370 | av_freep(so); | |
120 | 818370 | *count = 0; | |
121 |
4/4✓ Branch 0 taken 324750 times.
✓ Branch 1 taken 1337970 times.
✓ Branch 2 taken 12990 times.
✓ Branch 3 taken 311760 times.
|
1662720 | } else if (po->flags & OPT_OFFSET && po->flags & OPT_STRING) |
122 | 12990 | av_freep(dst); | |
123 | 2481090 | po++; | |
124 | } | ||
125 | |||
126 |
2/2✓ Branch 0 taken 236 times.
✓ Branch 1 taken 12990 times.
|
13226 | for (i = 0; i < o->nb_stream_maps; i++) |
127 | 236 | av_freep(&o->stream_maps[i].linklabel); | |
128 | 12990 | av_freep(&o->stream_maps); | |
129 | #if FFMPEG_OPT_MAP_CHANNEL | ||
130 | 12990 | av_freep(&o->audio_channel_maps); | |
131 | #endif | ||
132 | 12990 | av_freep(&o->streamid_map); | |
133 | 12990 | av_freep(&o->attachments); | |
134 | 12990 | } | |
135 | |||
136 | 12990 | static void init_options(OptionsContext *o) | |
137 | { | ||
138 | 12990 | memset(o, 0, sizeof(*o)); | |
139 | |||
140 | 12990 | o->stop_time = INT64_MAX; | |
141 | 12990 | o->mux_max_delay = 0.7; | |
142 | 12990 | o->start_time = AV_NOPTS_VALUE; | |
143 | 12990 | o->start_time_eof = AV_NOPTS_VALUE; | |
144 | 12990 | o->recording_time = INT64_MAX; | |
145 | 12990 | o->limit_filesize = INT64_MAX; | |
146 | 12990 | o->chapters_input_file = INT_MAX; | |
147 | 12990 | o->accurate_seek = 1; | |
148 | 12990 | o->thread_queue_size = -1; | |
149 | 12990 | o->input_sync_ref = -1; | |
150 | 12990 | o->find_stream_info = 1; | |
151 | 12990 | o->shortest_buf_duration = 10.f; | |
152 | 12990 | } | |
153 | |||
154 | ✗ | static int show_hwaccels(void *optctx, const char *opt, const char *arg) | |
155 | { | ||
156 | ✗ | enum AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE; | |
157 | |||
158 | ✗ | printf("Hardware acceleration methods:\n"); | |
159 | ✗ | while ((type = av_hwdevice_iterate_types(type)) != | |
160 | AV_HWDEVICE_TYPE_NONE) | ||
161 | ✗ | printf("%s\n", av_hwdevice_get_type_name(type)); | |
162 | ✗ | printf("\n"); | |
163 | ✗ | return 0; | |
164 | } | ||
165 | |||
166 | /* return a copy of the input with the stream specifiers removed from the keys */ | ||
167 | 12990 | AVDictionary *strip_specifiers(const AVDictionary *dict) | |
168 | { | ||
169 | 12990 | const AVDictionaryEntry *e = NULL; | |
170 | 12990 | AVDictionary *ret = NULL; | |
171 | |||
172 |
2/2✓ Branch 1 taken 36862 times.
✓ Branch 2 taken 12990 times.
|
49852 | while ((e = av_dict_iterate(dict, e))) { |
173 | 36862 | char *p = strchr(e->key, ':'); | |
174 | |||
175 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 36646 times.
|
36862 | if (p) |
176 | 216 | *p = 0; | |
177 | 36862 | av_dict_set(&ret, e->key, e->value, 0); | |
178 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 36646 times.
|
36862 | if (p) |
179 | 216 | *p = ':'; | |
180 | } | ||
181 | 12990 | return ret; | |
182 | } | ||
183 | |||
184 | 496 | int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global) | |
185 | { | ||
186 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 2 taken 490 times.
|
496 | if (!av_strcasecmp(arg, "cfr")) *vsync_var = VSYNC_CFR; |
187 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 489 times.
|
490 | else if (!av_strcasecmp(arg, "vfr")) *vsync_var = VSYNC_VFR; |
188 |
1/2✓ Branch 1 taken 489 times.
✗ Branch 2 not taken.
|
489 | else if (!av_strcasecmp(arg, "passthrough")) *vsync_var = VSYNC_PASSTHROUGH; |
189 | ✗ | else if (!av_strcasecmp(arg, "drop")) *vsync_var = VSYNC_DROP; | |
190 | ✗ | else if (!is_global && !av_strcasecmp(arg, "auto")) *vsync_var = VSYNC_AUTO; | |
191 | ✗ | else if (!is_global) { | |
192 | ✗ | av_log(NULL, AV_LOG_FATAL, "Invalid value %s specified for fps_mode of #%d:%d.\n", arg, file_idx, st_idx); | |
193 | ✗ | exit_program(1); | |
194 | } | ||
195 | |||
196 |
2/4✓ Branch 0 taken 496 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 496 times.
|
496 | if (is_global && *vsync_var == VSYNC_AUTO) { |
197 | ✗ | video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR); | |
198 | ✗ | av_log(NULL, AV_LOG_WARNING, "Passing a number to -vsync is deprecated," | |
199 | " use a string argument as described in the manual.\n"); | ||
200 | } | ||
201 | 496 | return 0; | |
202 | } | ||
203 | |||
204 | /* Correct input file start times based on enabled streams */ | ||
205 | 6477 | static void correct_input_start_times(void) | |
206 | { | ||
207 |
2/2✓ Branch 0 taken 6511 times.
✓ Branch 1 taken 6477 times.
|
12988 | for (int i = 0; i < nb_input_files; i++) { |
208 | 6511 | InputFile *ifile = input_files[i]; | |
209 | 6511 | AVFormatContext *is = ifile->ctx; | |
210 | 6511 | int64_t new_start_time = INT64_MAX, diff, abs_start_seek; | |
211 | |||
212 | 6511 | ifile->start_time_effective = is->start_time; | |
213 | |||
214 |
2/2✓ Branch 0 taken 4946 times.
✓ Branch 1 taken 1565 times.
|
6511 | if (is->start_time == AV_NOPTS_VALUE || |
215 |
2/2✓ Branch 0 taken 4841 times.
✓ Branch 1 taken 105 times.
|
4946 | !(is->iformat->flags & AVFMT_TS_DISCONT)) |
216 | 6406 | continue; | |
217 | |||
218 |
2/2✓ Branch 0 taken 155 times.
✓ Branch 1 taken 105 times.
|
260 | for (int j = 0; j < is->nb_streams; j++) { |
219 | 155 | AVStream *st = is->streams[j]; | |
220 |
3/4✓ Branch 0 taken 120 times.
✓ Branch 1 taken 35 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 120 times.
|
155 | if(st->discard == AVDISCARD_ALL || st->start_time == AV_NOPTS_VALUE) |
221 | 35 | continue; | |
222 |
2/2✓ Branch 0 taken 117 times.
✓ Branch 1 taken 3 times.
|
120 | new_start_time = FFMIN(new_start_time, av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q)); |
223 | } | ||
224 | |||
225 | 105 | diff = new_start_time - is->start_time; | |
226 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 102 times.
|
105 | if (diff) { |
227 | 3 | av_log(NULL, AV_LOG_VERBOSE, "Correcting start time of Input #%d by %"PRId64" us.\n", i, diff); | |
228 | 3 | ifile->start_time_effective = new_start_time; | |
229 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3 | if (copy_ts && start_at_zero) |
230 | ✗ | ifile->ts_offset = -new_start_time; | |
231 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | else if (!copy_ts) { |
232 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | abs_start_seek = is->start_time + (ifile->start_time != AV_NOPTS_VALUE) ? ifile->start_time : 0; |
233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | ifile->ts_offset = abs_start_seek > new_start_time ? -abs_start_seek : -new_start_time; |
234 | ✗ | } else if (copy_ts) | |
235 | ✗ | ifile->ts_offset = 0; | |
236 | |||
237 | 3 | ifile->ts_offset += ifile->input_ts_offset; | |
238 | } | ||
239 | } | ||
240 | 6477 | } | |
241 | |||
242 | 6477 | static int apply_sync_offsets(void) | |
243 | { | ||
244 |
2/2✓ Branch 0 taken 6511 times.
✓ Branch 1 taken 6477 times.
|
12988 | for (int i = 0; i < nb_input_files; i++) { |
245 | 6511 | InputFile *ref, *self = input_files[i]; | |
246 | int64_t adjustment; | ||
247 | int64_t self_start_time, ref_start_time, self_seek_start, ref_seek_start; | ||
248 | 6511 | int start_times_set = 1; | |
249 | |||
250 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6511 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6511 | if (self->input_sync_ref == -1 || self->input_sync_ref == i) continue; |
251 | ✗ | if (self->input_sync_ref >= nb_input_files || self->input_sync_ref < -1) { | |
252 | ✗ | av_log(NULL, AV_LOG_FATAL, "-isync for input %d references non-existent input %d.\n", i, self->input_sync_ref); | |
253 | ✗ | exit_program(1); | |
254 | } | ||
255 | |||
256 | ✗ | if (copy_ts && !start_at_zero) { | |
257 | ✗ | av_log(NULL, AV_LOG_FATAL, "Use of -isync requires that start_at_zero be set if copyts is set.\n"); | |
258 | ✗ | exit_program(1); | |
259 | } | ||
260 | |||
261 | ✗ | ref = input_files[self->input_sync_ref]; | |
262 | ✗ | if (ref->input_sync_ref != -1 && ref->input_sync_ref != self->input_sync_ref) { | |
263 | ✗ | av_log(NULL, AV_LOG_ERROR, "-isync for input %d references a resynced input %d. Sync not set.\n", i, self->input_sync_ref); | |
264 | ✗ | continue; | |
265 | } | ||
266 | |||
267 | ✗ | if (self->ctx->start_time_realtime != AV_NOPTS_VALUE && ref->ctx->start_time_realtime != AV_NOPTS_VALUE) { | |
268 | ✗ | self_start_time = self->ctx->start_time_realtime; | |
269 | ✗ | ref_start_time = ref->ctx->start_time_realtime; | |
270 | ✗ | } else if (self->start_time_effective != AV_NOPTS_VALUE && ref->start_time_effective != AV_NOPTS_VALUE) { | |
271 | ✗ | self_start_time = self->start_time_effective; | |
272 | ✗ | ref_start_time = ref->start_time_effective; | |
273 | } else { | ||
274 | ✗ | start_times_set = 0; | |
275 | } | ||
276 | |||
277 | ✗ | if (start_times_set) { | |
278 | ✗ | self_seek_start = self->start_time == AV_NOPTS_VALUE ? 0 : self->start_time; | |
279 | ✗ | ref_seek_start = ref->start_time == AV_NOPTS_VALUE ? 0 : ref->start_time; | |
280 | |||
281 | ✗ | adjustment = (self_start_time - ref_start_time) + !copy_ts*(self_seek_start - ref_seek_start) + ref->input_ts_offset; | |
282 | |||
283 | ✗ | self->ts_offset += adjustment; | |
284 | |||
285 | ✗ | av_log(NULL, AV_LOG_INFO, "Adjusted ts offset for Input #%d by %"PRId64" us to sync with Input #%d.\n", i, adjustment, self->input_sync_ref); | |
286 | } else { | ||
287 | ✗ | av_log(NULL, AV_LOG_INFO, "Unable to identify start times for Inputs #%d and %d both. No sync adjustment made.\n", i, self->input_sync_ref); | |
288 | } | ||
289 | } | ||
290 | |||
291 | 6477 | return 0; | |
292 | } | ||
293 | |||
294 | 314 | static int opt_filter_threads(void *optctx, const char *opt, const char *arg) | |
295 | { | ||
296 | 314 | av_free(filter_nbthreads); | |
297 | 314 | filter_nbthreads = av_strdup(arg); | |
298 | 314 | return 0; | |
299 | } | ||
300 | |||
301 | ✗ | static int opt_abort_on(void *optctx, const char *opt, const char *arg) | |
302 | { | ||
303 | static const AVOption opts[] = { | ||
304 | { "abort_on" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, | ||
305 | { "empty_output" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT }, .unit = "flags" }, | ||
306 | { "empty_output_stream", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM }, .unit = "flags" }, | ||
307 | { NULL }, | ||
308 | }; | ||
309 | static const AVClass class = { | ||
310 | .class_name = "", | ||
311 | .item_name = av_default_item_name, | ||
312 | .option = opts, | ||
313 | .version = LIBAVUTIL_VERSION_INT, | ||
314 | }; | ||
315 | ✗ | const AVClass *pclass = &class; | |
316 | |||
317 | ✗ | return av_opt_eval_flags(&pclass, &opts[0], arg, &abort_on_flags); | |
318 | } | ||
319 | |||
320 | ✗ | static int opt_stats_period(void *optctx, const char *opt, const char *arg) | |
321 | { | ||
322 | ✗ | int64_t user_stats_period = parse_time_or_die(opt, arg, 1); | |
323 | |||
324 | ✗ | if (user_stats_period <= 0) { | |
325 | ✗ | av_log(NULL, AV_LOG_ERROR, "stats_period %s must be positive.\n", arg); | |
326 | ✗ | return AVERROR(EINVAL); | |
327 | } | ||
328 | |||
329 | ✗ | stats_period = user_stats_period; | |
330 | ✗ | av_log(NULL, AV_LOG_INFO, "ffmpeg stats and -progress period set to %s.\n", arg); | |
331 | |||
332 | ✗ | return 0; | |
333 | } | ||
334 | |||
335 | 14 | static int opt_audio_codec(void *optctx, const char *opt, const char *arg) | |
336 | { | ||
337 | 14 | OptionsContext *o = optctx; | |
338 | 14 | return parse_option(o, "codec:a", arg, options); | |
339 | } | ||
340 | |||
341 | 4575 | static int opt_video_codec(void *optctx, const char *opt, const char *arg) | |
342 | { | ||
343 | 4575 | OptionsContext *o = optctx; | |
344 | 4575 | return parse_option(o, "codec:v", arg, options); | |
345 | } | ||
346 | |||
347 | 2 | static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg) | |
348 | { | ||
349 | 2 | OptionsContext *o = optctx; | |
350 | 2 | return parse_option(o, "codec:s", arg, options); | |
351 | } | ||
352 | |||
353 | ✗ | static int opt_data_codec(void *optctx, const char *opt, const char *arg) | |
354 | { | ||
355 | ✗ | OptionsContext *o = optctx; | |
356 | ✗ | return parse_option(o, "codec:d", arg, options); | |
357 | } | ||
358 | |||
359 | 171 | static int opt_map(void *optctx, const char *opt, const char *arg) | |
360 | { | ||
361 | 171 | OptionsContext *o = optctx; | |
362 | 171 | StreamMap *m = NULL; | |
363 | 171 | int i, negative = 0, file_idx, disabled = 0; | |
364 | #if FFMPEG_OPT_MAP_SYNC | ||
365 | char *sync; | ||
366 | #endif | ||
367 | char *map, *p; | ||
368 | char *allow_unused; | ||
369 | |||
370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 171 times.
|
171 | if (*arg == '-') { |
371 | ✗ | negative = 1; | |
372 | ✗ | arg++; | |
373 | } | ||
374 | 171 | map = av_strdup(arg); | |
375 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 171 times.
|
171 | if (!map) |
376 | ✗ | return AVERROR(ENOMEM); | |
377 | |||
378 | #if FFMPEG_OPT_MAP_SYNC | ||
379 | /* parse sync stream first, just pick first matching stream */ | ||
380 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 171 times.
|
171 | if (sync = strchr(map, ',')) { |
381 | ✗ | *sync = 0; | |
382 | ✗ | av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n"); | |
383 | } | ||
384 | #endif | ||
385 | |||
386 | |||
387 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 152 times.
|
171 | if (map[0] == '[') { |
388 | /* this mapping refers to lavfi output */ | ||
389 | 19 | const char *c = map + 1; | |
390 | 19 | GROW_ARRAY(o->stream_maps, o->nb_stream_maps); | |
391 | 19 | m = &o->stream_maps[o->nb_stream_maps - 1]; | |
392 | 19 | m->linklabel = av_get_token(&c, "]"); | |
393 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
|
19 | if (!m->linklabel) { |
394 | ✗ | av_log(NULL, AV_LOG_ERROR, "Invalid output link label: %s.\n", map); | |
395 | ✗ | exit_program(1); | |
396 | } | ||
397 | } else { | ||
398 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 152 times.
|
152 | if (allow_unused = strchr(map, '?')) |
399 | ✗ | *allow_unused = 0; | |
400 | 152 | file_idx = strtol(map, &p, 0); | |
401 |
2/4✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 152 times.
|
152 | if (file_idx >= nb_input_files || file_idx < 0) { |
402 | ✗ | av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx); | |
403 | ✗ | exit_program(1); | |
404 | } | ||
405 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 152 times.
|
152 | if (negative) |
406 | /* disable some already defined maps */ | ||
407 | ✗ | for (i = 0; i < o->nb_stream_maps; i++) { | |
408 | ✗ | m = &o->stream_maps[i]; | |
409 | ✗ | if (file_idx == m->file_index && | |
410 | ✗ | check_stream_specifier(input_files[m->file_index]->ctx, | |
411 | ✗ | input_files[m->file_index]->ctx->streams[m->stream_index], | |
412 | ✗ | *p == ':' ? p + 1 : p) > 0) | |
413 | ✗ | m->disabled = 1; | |
414 | } | ||
415 | else | ||
416 |
2/2✓ Branch 0 taken 345 times.
✓ Branch 1 taken 152 times.
|
497 | for (i = 0; i < input_files[file_idx]->nb_streams; i++) { |
417 |
2/2✓ Branch 1 taken 128 times.
✓ Branch 2 taken 217 times.
|
345 | if (check_stream_specifier(input_files[file_idx]->ctx, input_files[file_idx]->ctx->streams[i], |
418 |
2/2✓ Branch 0 taken 194 times.
✓ Branch 1 taken 151 times.
|
345 | *p == ':' ? p + 1 : p) <= 0) |
419 | 128 | continue; | |
420 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 217 times.
|
217 | if (input_files[file_idx]->streams[i]->user_set_discard == AVDISCARD_ALL) { |
421 | ✗ | disabled = 1; | |
422 | ✗ | continue; | |
423 | } | ||
424 | 217 | GROW_ARRAY(o->stream_maps, o->nb_stream_maps); | |
425 | 217 | m = &o->stream_maps[o->nb_stream_maps - 1]; | |
426 | |||
427 | 217 | m->file_index = file_idx; | |
428 | 217 | m->stream_index = i; | |
429 | } | ||
430 | } | ||
431 | |||
432 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 171 times.
|
171 | if (!m) { |
433 | ✗ | if (allow_unused) { | |
434 | ✗ | av_log(NULL, AV_LOG_VERBOSE, "Stream map '%s' matches no streams; ignoring.\n", arg); | |
435 | ✗ | } else if (disabled) { | |
436 | ✗ | av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches disabled streams.\n" | |
437 | "To ignore this, add a trailing '?' to the map.\n", arg); | ||
438 | ✗ | exit_program(1); | |
439 | } else { | ||
440 | ✗ | av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n" | |
441 | "To ignore this, add a trailing '?' to the map.\n", arg); | ||
442 | ✗ | exit_program(1); | |
443 | } | ||
444 | } | ||
445 | |||
446 | 171 | av_freep(&map); | |
447 | 171 | return 0; | |
448 | } | ||
449 | |||
450 | 1 | static int opt_attach(void *optctx, const char *opt, const char *arg) | |
451 | { | ||
452 | 1 | OptionsContext *o = optctx; | |
453 | 1 | GROW_ARRAY(o->attachments, o->nb_attachments); | |
454 | 1 | o->attachments[o->nb_attachments - 1] = arg; | |
455 | 1 | return 0; | |
456 | } | ||
457 | |||
458 | #if FFMPEG_OPT_MAP_CHANNEL | ||
459 | 10 | static int opt_map_channel(void *optctx, const char *opt, const char *arg) | |
460 | { | ||
461 | 10 | OptionsContext *o = optctx; | |
462 | int n; | ||
463 | AVStream *st; | ||
464 | AudioChannelMap *m; | ||
465 | char *allow_unused; | ||
466 | char *mapchan; | ||
467 | |||
468 | 10 | av_log(NULL, AV_LOG_WARNING, | |
469 | "The -%s option is deprecated and will be removed. " | ||
470 | "It can be replaced by the 'pan' filter, or in some cases by " | ||
471 | "combinations of 'channelsplit', 'channelmap', 'amerge' filters.\n", opt); | ||
472 | |||
473 | 10 | mapchan = av_strdup(arg); | |
474 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (!mapchan) |
475 | ✗ | return AVERROR(ENOMEM); | |
476 | |||
477 | 10 | GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps); | |
478 | 10 | m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1]; | |
479 | |||
480 | /* muted channel syntax */ | ||
481 | 10 | n = sscanf(arg, "%d:%d.%d", &m->channel_idx, &m->ofile_idx, &m->ostream_idx); | |
482 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 9 times.
|
10 | if ((n == 1 || n == 3) && m->channel_idx == -1) { |
483 | 1 | m->file_idx = m->stream_idx = -1; | |
484 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (n == 1) |
485 | 1 | m->ofile_idx = m->ostream_idx = -1; | |
486 | 1 | av_free(mapchan); | |
487 | 1 | return 0; | |
488 | } | ||
489 | |||
490 | /* normal syntax */ | ||
491 | 9 | n = sscanf(arg, "%d.%d.%d:%d.%d", | |
492 | &m->file_idx, &m->stream_idx, &m->channel_idx, | ||
493 | &m->ofile_idx, &m->ostream_idx); | ||
494 | |||
495 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
9 | if (n != 3 && n != 5) { |
496 | ✗ | av_log(NULL, AV_LOG_FATAL, "Syntax error, mapchan usage: " | |
497 | "[file.stream.channel|-1][:syncfile:syncstream]\n"); | ||
498 | ✗ | exit_program(1); | |
499 | } | ||
500 | |||
501 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | if (n != 5) // only file.stream.channel specified |
502 | 9 | m->ofile_idx = m->ostream_idx = -1; | |
503 | |||
504 | /* check input */ | ||
505 |
2/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
|
9 | if (m->file_idx < 0 || m->file_idx >= nb_input_files) { |
506 | ✗ | av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file index: %d\n", | |
507 | m->file_idx); | ||
508 | ✗ | exit_program(1); | |
509 | } | ||
510 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | if (m->stream_idx < 0 || |
511 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | m->stream_idx >= input_files[m->file_idx]->nb_streams) { |
512 | ✗ | av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file stream index #%d.%d\n", | |
513 | m->file_idx, m->stream_idx); | ||
514 | ✗ | exit_program(1); | |
515 | } | ||
516 | 9 | st = input_files[m->file_idx]->ctx->streams[m->stream_idx]; | |
517 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) { |
518 | ✗ | av_log(NULL, AV_LOG_FATAL, "mapchan: stream #%d.%d is not an audio stream.\n", | |
519 | m->file_idx, m->stream_idx); | ||
520 | ✗ | exit_program(1); | |
521 | } | ||
522 | /* allow trailing ? to map_channel */ | ||
523 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7 times.
|
9 | if (allow_unused = strchr(mapchan, '?')) |
524 | 2 | *allow_unused = 0; | |
525 |
3/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 1 times.
|
9 | if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->ch_layout.nb_channels || |
526 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | input_files[m->file_idx]->streams[m->stream_idx]->user_set_discard == AVDISCARD_ALL) { |
527 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (allow_unused) { |
528 | 1 | av_log(NULL, AV_LOG_VERBOSE, "mapchan: invalid audio channel #%d.%d.%d\n", | |
529 | m->file_idx, m->stream_idx, m->channel_idx); | ||
530 | } else { | ||
531 | ✗ | av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n" | |
532 | "To ignore this, add a trailing '?' to the map_channel.\n", | ||
533 | m->file_idx, m->stream_idx, m->channel_idx); | ||
534 | ✗ | exit_program(1); | |
535 | } | ||
536 | |||
537 | } | ||
538 | 9 | av_free(mapchan); | |
539 | 9 | return 0; | |
540 | } | ||
541 | #endif | ||
542 | |||
543 | ✗ | static int opt_sdp_file(void *optctx, const char *opt, const char *arg) | |
544 | { | ||
545 | ✗ | av_free(sdp_filename); | |
546 | ✗ | sdp_filename = av_strdup(arg); | |
547 | ✗ | return 0; | |
548 | } | ||
549 | |||
550 | #if CONFIG_VAAPI | ||
551 | ✗ | static int opt_vaapi_device(void *optctx, const char *opt, const char *arg) | |
552 | { | ||
553 | ✗ | const char *prefix = "vaapi:"; | |
554 | char *tmp; | ||
555 | int err; | ||
556 | ✗ | tmp = av_asprintf("%s%s", prefix, arg); | |
557 | ✗ | if (!tmp) | |
558 | ✗ | return AVERROR(ENOMEM); | |
559 | ✗ | err = hw_device_init_from_string(tmp, NULL); | |
560 | ✗ | av_free(tmp); | |
561 | ✗ | return err; | |
562 | } | ||
563 | #endif | ||
564 | |||
565 | #if CONFIG_QSV | ||
566 | static int opt_qsv_device(void *optctx, const char *opt, const char *arg) | ||
567 | { | ||
568 | const char *prefix = "qsv=__qsv_device:hw_any,child_device="; | ||
569 | int err; | ||
570 | char *tmp = av_asprintf("%s%s", prefix, arg); | ||
571 | |||
572 | if (!tmp) | ||
573 | return AVERROR(ENOMEM); | ||
574 | |||
575 | err = hw_device_init_from_string(tmp, NULL); | ||
576 | av_free(tmp); | ||
577 | |||
578 | return err; | ||
579 | } | ||
580 | #endif | ||
581 | |||
582 | ✗ | static int opt_init_hw_device(void *optctx, const char *opt, const char *arg) | |
583 | { | ||
584 | ✗ | if (!strcmp(arg, "list")) { | |
585 | ✗ | enum AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE; | |
586 | ✗ | printf("Supported hardware device types:\n"); | |
587 | ✗ | while ((type = av_hwdevice_iterate_types(type)) != | |
588 | AV_HWDEVICE_TYPE_NONE) | ||
589 | ✗ | printf("%s\n", av_hwdevice_get_type_name(type)); | |
590 | ✗ | printf("\n"); | |
591 | ✗ | exit_program(0); | |
592 | } else { | ||
593 | ✗ | return hw_device_init_from_string(arg, NULL); | |
594 | } | ||
595 | } | ||
596 | |||
597 | ✗ | static int opt_filter_hw_device(void *optctx, const char *opt, const char *arg) | |
598 | { | ||
599 | ✗ | if (filter_hw_device) { | |
600 | ✗ | av_log(NULL, AV_LOG_ERROR, "Only one filter device can be used.\n"); | |
601 | ✗ | return AVERROR(EINVAL); | |
602 | } | ||
603 | ✗ | filter_hw_device = hw_device_get_by_name(arg); | |
604 | ✗ | if (!filter_hw_device) { | |
605 | ✗ | av_log(NULL, AV_LOG_ERROR, "Invalid filter device %s.\n", arg); | |
606 | ✗ | return AVERROR(EINVAL); | |
607 | } | ||
608 | ✗ | return 0; | |
609 | } | ||
610 | |||
611 | ✗ | static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg) | |
612 | { | ||
613 | ✗ | OptionsContext *o = optctx; | |
614 | char buf[128]; | ||
615 | ✗ | int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6; | |
616 | ✗ | struct tm time = *gmtime((time_t*)&recording_timestamp); | |
617 | ✗ | if (!strftime(buf, sizeof(buf), "creation_time=%Y-%m-%dT%H:%M:%S%z", &time)) | |
618 | ✗ | return -1; | |
619 | ✗ | parse_option(o, "metadata", buf, options); | |
620 | |||
621 | ✗ | av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata " | |
622 | "tag instead.\n", opt); | ||
623 | ✗ | return 0; | |
624 | } | ||
625 | |||
626 | 11408 | const AVCodec *find_codec_or_die(void *logctx, const char *name, | |
627 | enum AVMediaType type, int encoder) | ||
628 | { | ||
629 | const AVCodecDescriptor *desc; | ||
630 |
2/2✓ Branch 0 taken 3466 times.
✓ Branch 1 taken 7942 times.
|
11408 | const char *codec_string = encoder ? "encoder" : "decoder"; |
631 | const AVCodec *codec; | ||
632 | |||
633 | 11408 | codec = encoder ? | |
634 |
2/2✓ Branch 0 taken 3466 times.
✓ Branch 1 taken 7942 times.
|
11408 | avcodec_find_encoder_by_name(name) : |
635 | 7942 | avcodec_find_decoder_by_name(name); | |
636 | |||
637 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 11407 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
11408 | if (!codec && (desc = avcodec_descriptor_get_by_name(name))) { |
638 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | codec = encoder ? avcodec_find_encoder(desc->id) : |
639 | ✗ | avcodec_find_decoder(desc->id); | |
640 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (codec) |
641 | 1 | av_log(logctx, AV_LOG_VERBOSE, "Matched %s '%s' for codec '%s'.\n", | |
642 | 1 | codec_string, codec->name, desc->name); | |
643 | } | ||
644 | |||
645 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11408 times.
|
11408 | if (!codec) { |
646 | ✗ | av_log(logctx, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); | |
647 | ✗ | exit_program(1); | |
648 | } | ||
649 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 11408 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
11408 | if (codec->type != type && !recast_media) { |
650 | ✗ | av_log(logctx, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name); | |
651 | ✗ | exit_program(1); | |
652 | } | ||
653 | 11408 | return codec; | |
654 | } | ||
655 | |||
656 | 6399 | void assert_file_overwrite(const char *filename) | |
657 | { | ||
658 | 6399 | const char *proto_name = avio_find_protocol_name(filename); | |
659 | |||
660 |
3/4✓ Branch 0 taken 1737 times.
✓ Branch 1 taken 4662 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1737 times.
|
6399 | if (file_overwrite && no_file_overwrite) { |
661 | ✗ | fprintf(stderr, "Error, both -y and -n supplied. Exiting.\n"); | |
662 | ✗ | exit_program(1); | |
663 | } | ||
664 | |||
665 |
2/2✓ Branch 0 taken 4662 times.
✓ Branch 1 taken 1737 times.
|
6399 | if (!file_overwrite) { |
666 |
2/6✓ Branch 0 taken 4662 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4662 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
4662 | if (proto_name && !strcmp(proto_name, "file") && avio_check(filename, 0) == 0) { |
667 | ✗ | if (stdin_interaction && !no_file_overwrite) { | |
668 | ✗ | fprintf(stderr,"File '%s' already exists. Overwrite? [y/N] ", filename); | |
669 | ✗ | fflush(stderr); | |
670 | ✗ | term_exit(); | |
671 | ✗ | signal(SIGINT, SIG_DFL); | |
672 | ✗ | if (!read_yesno()) { | |
673 | ✗ | av_log(NULL, AV_LOG_FATAL, "Not overwriting - exiting\n"); | |
674 | ✗ | exit_program(1); | |
675 | } | ||
676 | ✗ | term_init(); | |
677 | } | ||
678 | else { | ||
679 | ✗ | av_log(NULL, AV_LOG_FATAL, "File '%s' already exists. Exiting.\n", filename); | |
680 | ✗ | exit_program(1); | |
681 | } | ||
682 | } | ||
683 | } | ||
684 | |||
685 |
3/4✓ Branch 0 taken 6399 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1601 times.
✓ Branch 3 taken 4798 times.
|
6399 | if (proto_name && !strcmp(proto_name, "file")) { |
686 |
2/2✓ Branch 0 taken 1647 times.
✓ Branch 1 taken 1601 times.
|
3248 | for (int i = 0; i < nb_input_files; i++) { |
687 | 1647 | InputFile *file = input_files[i]; | |
688 |
2/2✓ Branch 0 taken 86 times.
✓ Branch 1 taken 1561 times.
|
1647 | if (file->ctx->iformat->flags & AVFMT_NOFILE) |
689 | 86 | continue; | |
690 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1561 times.
|
1561 | if (!strcmp(filename, file->ctx->url)) { |
691 | ✗ | av_log(NULL, AV_LOG_FATAL, "Output %s same as Input #%d - exiting\n", filename, i); | |
692 | ✗ | av_log(NULL, AV_LOG_WARNING, "FFmpeg cannot edit existing files in-place.\n"); | |
693 | ✗ | exit_program(1); | |
694 | } | ||
695 | } | ||
696 | } | ||
697 | 6399 | } | |
698 | |||
699 | /* read file contents into a string */ | ||
700 | 34 | char *file_read(const char *filename) | |
701 | { | ||
702 | 34 | AVIOContext *pb = NULL; | |
703 | 34 | int ret = avio_open(&pb, filename, AVIO_FLAG_READ); | |
704 | AVBPrint bprint; | ||
705 | char *str; | ||
706 | |||
707 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
|
34 | if (ret < 0) { |
708 | ✗ | av_log(NULL, AV_LOG_ERROR, "Error opening file %s.\n", filename); | |
709 | ✗ | return NULL; | |
710 | } | ||
711 | |||
712 | 34 | av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED); | |
713 | 34 | ret = avio_read_to_bprint(pb, &bprint, SIZE_MAX); | |
714 | 34 | avio_closep(&pb); | |
715 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
|
34 | if (ret < 0) { |
716 | ✗ | av_bprint_finalize(&bprint, NULL); | |
717 | ✗ | return NULL; | |
718 | } | ||
719 | 34 | ret = av_bprint_finalize(&bprint, &str); | |
720 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
|
34 | if (ret < 0) |
721 | ✗ | return NULL; | |
722 | 34 | return str; | |
723 | } | ||
724 | |||
725 | /* arg format is "output-stream-index:streamid-value". */ | ||
726 | ✗ | static int opt_streamid(void *optctx, const char *opt, const char *arg) | |
727 | { | ||
728 | ✗ | OptionsContext *o = optctx; | |
729 | int idx; | ||
730 | char *p; | ||
731 | char idx_str[16]; | ||
732 | |||
733 | ✗ | av_strlcpy(idx_str, arg, sizeof(idx_str)); | |
734 | ✗ | p = strchr(idx_str, ':'); | |
735 | ✗ | if (!p) { | |
736 | ✗ | av_log(NULL, AV_LOG_FATAL, | |
737 | "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", | ||
738 | arg, opt); | ||
739 | ✗ | exit_program(1); | |
740 | } | ||
741 | ✗ | *p++ = '\0'; | |
742 | ✗ | idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); | |
743 | ✗ | o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); | |
744 | ✗ | o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); | |
745 | ✗ | return 0; | |
746 | } | ||
747 | |||
748 | 6477 | static int init_complex_filters(void) | |
749 | { | ||
750 | 6477 | int i, ret = 0; | |
751 | |||
752 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 6477 times.
|
6577 | for (i = 0; i < nb_filtergraphs; i++) { |
753 | 100 | ret = init_complex_filtergraph(filtergraphs[i]); | |
754 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if (ret < 0) |
755 | ✗ | return ret; | |
756 | } | ||
757 | 6477 | return 0; | |
758 | } | ||
759 | |||
760 | ✗ | static int opt_target(void *optctx, const char *opt, const char *arg) | |
761 | { | ||
762 | ✗ | OptionsContext *o = optctx; | |
763 | ✗ | enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN; | |
764 | static const char *const frame_rates[] = { "25", "30000/1001", "24000/1001" }; | ||
765 | |||
766 | ✗ | if (!strncmp(arg, "pal-", 4)) { | |
767 | ✗ | norm = PAL; | |
768 | ✗ | arg += 4; | |
769 | ✗ | } else if (!strncmp(arg, "ntsc-", 5)) { | |
770 | ✗ | norm = NTSC; | |
771 | ✗ | arg += 5; | |
772 | ✗ | } else if (!strncmp(arg, "film-", 5)) { | |
773 | ✗ | norm = FILM; | |
774 | ✗ | arg += 5; | |
775 | } else { | ||
776 | /* Try to determine PAL/NTSC by peeking in the input files */ | ||
777 | ✗ | if (nb_input_files) { | |
778 | int i, j; | ||
779 | ✗ | for (j = 0; j < nb_input_files; j++) { | |
780 | ✗ | for (i = 0; i < input_files[j]->nb_streams; i++) { | |
781 | ✗ | AVStream *st = input_files[j]->ctx->streams[i]; | |
782 | int64_t fr; | ||
783 | ✗ | if (st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) | |
784 | ✗ | continue; | |
785 | ✗ | fr = st->time_base.den * 1000LL / st->time_base.num; | |
786 | ✗ | if (fr == 25000) { | |
787 | ✗ | norm = PAL; | |
788 | ✗ | break; | |
789 | ✗ | } else if ((fr == 29970) || (fr == 23976)) { | |
790 | ✗ | norm = NTSC; | |
791 | ✗ | break; | |
792 | } | ||
793 | } | ||
794 | ✗ | if (norm != UNKNOWN) | |
795 | ✗ | break; | |
796 | } | ||
797 | } | ||
798 | ✗ | if (norm != UNKNOWN) | |
799 | ✗ | av_log(NULL, AV_LOG_INFO, "Assuming %s for target.\n", norm == PAL ? "PAL" : "NTSC"); | |
800 | } | ||
801 | |||
802 | ✗ | if (norm == UNKNOWN) { | |
803 | ✗ | av_log(NULL, AV_LOG_FATAL, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n"); | |
804 | ✗ | av_log(NULL, AV_LOG_FATAL, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n"); | |
805 | ✗ | av_log(NULL, AV_LOG_FATAL, "or set a framerate with \"-r xxx\".\n"); | |
806 | ✗ | exit_program(1); | |
807 | } | ||
808 | |||
809 | ✗ | if (!strcmp(arg, "vcd")) { | |
810 | ✗ | opt_video_codec(o, "c:v", "mpeg1video"); | |
811 | ✗ | opt_audio_codec(o, "c:a", "mp2"); | |
812 | ✗ | parse_option(o, "f", "vcd", options); | |
813 | |||
814 | ✗ | parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options); | |
815 | ✗ | parse_option(o, "r", frame_rates[norm], options); | |
816 | ✗ | opt_default(NULL, "g", norm == PAL ? "15" : "18"); | |
817 | |||
818 | ✗ | opt_default(NULL, "b:v", "1150000"); | |
819 | ✗ | opt_default(NULL, "maxrate:v", "1150000"); | |
820 | ✗ | opt_default(NULL, "minrate:v", "1150000"); | |
821 | ✗ | opt_default(NULL, "bufsize:v", "327680"); // 40*1024*8; | |
822 | |||
823 | ✗ | opt_default(NULL, "b:a", "224000"); | |
824 | ✗ | parse_option(o, "ar", "44100", options); | |
825 | ✗ | parse_option(o, "ac", "2", options); | |
826 | |||
827 | ✗ | opt_default(NULL, "packetsize", "2324"); | |
828 | ✗ | opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8; | |
829 | |||
830 | /* We have to offset the PTS, so that it is consistent with the SCR. | ||
831 | SCR starts at 36000, but the first two packs contain only padding | ||
832 | and the first pack from the other stream, respectively, may also have | ||
833 | been written before. | ||
834 | So the real data starts at SCR 36000+3*1200. */ | ||
835 | ✗ | o->mux_preload = (36000 + 3 * 1200) / 90000.0; // 0.44 | |
836 | ✗ | } else if (!strcmp(arg, "svcd")) { | |
837 | |||
838 | ✗ | opt_video_codec(o, "c:v", "mpeg2video"); | |
839 | ✗ | opt_audio_codec(o, "c:a", "mp2"); | |
840 | ✗ | parse_option(o, "f", "svcd", options); | |
841 | |||
842 | ✗ | parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options); | |
843 | ✗ | parse_option(o, "r", frame_rates[norm], options); | |
844 | ✗ | parse_option(o, "pix_fmt", "yuv420p", options); | |
845 | ✗ | opt_default(NULL, "g", norm == PAL ? "15" : "18"); | |
846 | |||
847 | ✗ | opt_default(NULL, "b:v", "2040000"); | |
848 | ✗ | opt_default(NULL, "maxrate:v", "2516000"); | |
849 | ✗ | opt_default(NULL, "minrate:v", "0"); // 1145000; | |
850 | ✗ | opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8; | |
851 | ✗ | opt_default(NULL, "scan_offset", "1"); | |
852 | |||
853 | ✗ | opt_default(NULL, "b:a", "224000"); | |
854 | ✗ | parse_option(o, "ar", "44100", options); | |
855 | |||
856 | ✗ | opt_default(NULL, "packetsize", "2324"); | |
857 | |||
858 | ✗ | } else if (!strcmp(arg, "dvd")) { | |
859 | |||
860 | ✗ | opt_video_codec(o, "c:v", "mpeg2video"); | |
861 | ✗ | opt_audio_codec(o, "c:a", "ac3"); | |
862 | ✗ | parse_option(o, "f", "dvd", options); | |
863 | |||
864 | ✗ | parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options); | |
865 | ✗ | parse_option(o, "r", frame_rates[norm], options); | |
866 | ✗ | parse_option(o, "pix_fmt", "yuv420p", options); | |
867 | ✗ | opt_default(NULL, "g", norm == PAL ? "15" : "18"); | |
868 | |||
869 | ✗ | opt_default(NULL, "b:v", "6000000"); | |
870 | ✗ | opt_default(NULL, "maxrate:v", "9000000"); | |
871 | ✗ | opt_default(NULL, "minrate:v", "0"); // 1500000; | |
872 | ✗ | opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8; | |
873 | |||
874 | ✗ | opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack. | |
875 | ✗ | opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8 | |
876 | |||
877 | ✗ | opt_default(NULL, "b:a", "448000"); | |
878 | ✗ | parse_option(o, "ar", "48000", options); | |
879 | |||
880 | ✗ | } else if (!strncmp(arg, "dv", 2)) { | |
881 | |||
882 | ✗ | parse_option(o, "f", "dv", options); | |
883 | |||
884 | ✗ | parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options); | |
885 | ✗ | parse_option(o, "pix_fmt", !strncmp(arg, "dv50", 4) ? "yuv422p" : | |
886 | ✗ | norm == PAL ? "yuv420p" : "yuv411p", options); | |
887 | ✗ | parse_option(o, "r", frame_rates[norm], options); | |
888 | |||
889 | ✗ | parse_option(o, "ar", "48000", options); | |
890 | ✗ | parse_option(o, "ac", "2", options); | |
891 | |||
892 | } else { | ||
893 | ✗ | av_log(NULL, AV_LOG_ERROR, "Unknown target: %s\n", arg); | |
894 | ✗ | return AVERROR(EINVAL); | |
895 | } | ||
896 | |||
897 | ✗ | av_dict_copy(&o->g->codec_opts, codec_opts, AV_DICT_DONT_OVERWRITE); | |
898 | ✗ | av_dict_copy(&o->g->format_opts, format_opts, AV_DICT_DONT_OVERWRITE); | |
899 | |||
900 | ✗ | return 0; | |
901 | } | ||
902 | |||
903 | ✗ | static int opt_vstats_file(void *optctx, const char *opt, const char *arg) | |
904 | { | ||
905 | ✗ | av_free (vstats_filename); | |
906 | ✗ | vstats_filename = av_strdup (arg); | |
907 | ✗ | return 0; | |
908 | } | ||
909 | |||
910 | ✗ | static int opt_vstats(void *optctx, const char *opt, const char *arg) | |
911 | { | ||
912 | char filename[40]; | ||
913 | ✗ | time_t today2 = time(NULL); | |
914 | ✗ | struct tm *today = localtime(&today2); | |
915 | |||
916 | ✗ | if (!today) { // maybe tomorrow | |
917 | ✗ | av_log(NULL, AV_LOG_FATAL, "Unable to get current time: %s\n", strerror(errno)); | |
918 | ✗ | exit_program(1); | |
919 | } | ||
920 | |||
921 | ✗ | snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, | |
922 | today->tm_sec); | ||
923 | ✗ | return opt_vstats_file(NULL, opt, filename); | |
924 | } | ||
925 | |||
926 | ✗ | static int opt_video_frames(void *optctx, const char *opt, const char *arg) | |
927 | { | ||
928 | ✗ | OptionsContext *o = optctx; | |
929 | ✗ | return parse_option(o, "frames:v", arg, options); | |
930 | } | ||
931 | |||
932 | ✗ | static int opt_audio_frames(void *optctx, const char *opt, const char *arg) | |
933 | { | ||
934 | ✗ | OptionsContext *o = optctx; | |
935 | ✗ | return parse_option(o, "frames:a", arg, options); | |
936 | } | ||
937 | |||
938 | ✗ | static int opt_data_frames(void *optctx, const char *opt, const char *arg) | |
939 | { | ||
940 | ✗ | OptionsContext *o = optctx; | |
941 | ✗ | return parse_option(o, "frames:d", arg, options); | |
942 | } | ||
943 | |||
944 | ✗ | static int opt_default_new(OptionsContext *o, const char *opt, const char *arg) | |
945 | { | ||
946 | int ret; | ||
947 | ✗ | AVDictionary *cbak = codec_opts; | |
948 | ✗ | AVDictionary *fbak = format_opts; | |
949 | ✗ | codec_opts = NULL; | |
950 | ✗ | format_opts = NULL; | |
951 | |||
952 | ✗ | ret = opt_default(NULL, opt, arg); | |
953 | |||
954 | ✗ | av_dict_copy(&o->g->codec_opts , codec_opts, 0); | |
955 | ✗ | av_dict_copy(&o->g->format_opts, format_opts, 0); | |
956 | ✗ | av_dict_free(&codec_opts); | |
957 | ✗ | av_dict_free(&format_opts); | |
958 | ✗ | codec_opts = cbak; | |
959 | ✗ | format_opts = fbak; | |
960 | |||
961 | ✗ | return ret; | |
962 | } | ||
963 | |||
964 | ✗ | static int opt_preset(void *optctx, const char *opt, const char *arg) | |
965 | { | ||
966 | ✗ | OptionsContext *o = optctx; | |
967 | ✗ | FILE *f=NULL; | |
968 | char filename[1000], line[1000], tmp_line[1000]; | ||
969 | ✗ | const char *codec_name = NULL; | |
970 | |||
971 | ✗ | tmp_line[0] = *opt; | |
972 | ✗ | tmp_line[1] = 0; | |
973 | ✗ | MATCH_PER_TYPE_OPT(codec_names, str, codec_name, NULL, tmp_line); | |
974 | |||
975 | ✗ | if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { | |
976 | ✗ | if(!strncmp(arg, "libx264-lossless", strlen("libx264-lossless"))){ | |
977 | ✗ | av_log(NULL, AV_LOG_FATAL, "Please use -preset <speed> -qp 0\n"); | |
978 | }else | ||
979 | ✗ | av_log(NULL, AV_LOG_FATAL, "File for preset '%s' not found\n", arg); | |
980 | ✗ | exit_program(1); | |
981 | } | ||
982 | |||
983 | ✗ | while (fgets(line, sizeof(line), f)) { | |
984 | ✗ | char *key = tmp_line, *value, *endptr; | |
985 | |||
986 | ✗ | if (strcspn(line, "#\n\r") == 0) | |
987 | ✗ | continue; | |
988 | ✗ | av_strlcpy(tmp_line, line, sizeof(tmp_line)); | |
989 | ✗ | if (!av_strtok(key, "=", &value) || | |
990 | ✗ | !av_strtok(value, "\r\n", &endptr)) { | |
991 | ✗ | av_log(NULL, AV_LOG_FATAL, "%s: Invalid syntax: '%s'\n", filename, line); | |
992 | ✗ | exit_program(1); | |
993 | } | ||
994 | ✗ | av_log(NULL, AV_LOG_DEBUG, "ffpreset[%s]: set '%s' = '%s'\n", filename, key, value); | |
995 | |||
996 | ✗ | if (!strcmp(key, "acodec")) opt_audio_codec (o, key, value); | |
997 | ✗ | else if (!strcmp(key, "vcodec")) opt_video_codec (o, key, value); | |
998 | ✗ | else if (!strcmp(key, "scodec")) opt_subtitle_codec(o, key, value); | |
999 | ✗ | else if (!strcmp(key, "dcodec")) opt_data_codec (o, key, value); | |
1000 | ✗ | else if (opt_default_new(o, key, value) < 0) { | |
1001 | ✗ | av_log(NULL, AV_LOG_FATAL, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", | |
1002 | filename, line, key, value); | ||
1003 | ✗ | exit_program(1); | |
1004 | } | ||
1005 | } | ||
1006 | |||
1007 | ✗ | fclose(f); | |
1008 | |||
1009 | ✗ | return 0; | |
1010 | } | ||
1011 | |||
1012 | 3 | static int opt_old2new(void *optctx, const char *opt, const char *arg) | |
1013 | { | ||
1014 | 3 | OptionsContext *o = optctx; | |
1015 | int ret; | ||
1016 | 3 | char *s = av_asprintf("%s:%c", opt + 1, *opt); | |
1017 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (!s) |
1018 | ✗ | return AVERROR(ENOMEM); | |
1019 | 3 | ret = parse_option(o, s, arg, options); | |
1020 | 3 | av_free(s); | |
1021 | 3 | return ret; | |
1022 | } | ||
1023 | |||
1024 | 166 | static int opt_bitrate(void *optctx, const char *opt, const char *arg) | |
1025 | { | ||
1026 | 166 | OptionsContext *o = optctx; | |
1027 | |||
1028 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 165 times.
|
166 | if(!strcmp(opt, "ab")){ |
1029 | 1 | av_dict_set(&o->g->codec_opts, "b:a", arg, 0); | |
1030 | 1 | return 0; | |
1031 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 122 times.
|
165 | } else if(!strcmp(opt, "b")){ |
1032 | 43 | av_log(NULL, AV_LOG_WARNING, "Please use -b:a or -b:v, -b is ambiguous\n"); | |
1033 | 43 | av_dict_set(&o->g->codec_opts, "b:v", arg, 0); | |
1034 | 43 | return 0; | |
1035 | } | ||
1036 | 122 | av_dict_set(&o->g->codec_opts, opt, arg, 0); | |
1037 | 122 | return 0; | |
1038 | } | ||
1039 | |||
1040 | 280 | static int opt_qscale(void *optctx, const char *opt, const char *arg) | |
1041 | { | ||
1042 | 280 | OptionsContext *o = optctx; | |
1043 | char *s; | ||
1044 | int ret; | ||
1045 |
2/2✓ Branch 0 taken 239 times.
✓ Branch 1 taken 41 times.
|
280 | if(!strcmp(opt, "qscale")){ |
1046 | 239 | av_log(NULL, AV_LOG_WARNING, "Please use -q:a or -q:v, -qscale is ambiguous\n"); | |
1047 | 239 | return parse_option(o, "q:v", arg, options); | |
1048 | } | ||
1049 | 41 | s = av_asprintf("q%s", opt + 6); | |
1050 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 41 times.
|
41 | if (!s) |
1051 | ✗ | return AVERROR(ENOMEM); | |
1052 | 41 | ret = parse_option(o, s, arg, options); | |
1053 | 41 | av_free(s); | |
1054 | 41 | return ret; | |
1055 | } | ||
1056 | |||
1057 | 45 | static int opt_profile(void *optctx, const char *opt, const char *arg) | |
1058 | { | ||
1059 | 45 | OptionsContext *o = optctx; | |
1060 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 41 times.
|
45 | if(!strcmp(opt, "profile")){ |
1061 | 4 | av_log(NULL, AV_LOG_WARNING, "Please use -profile:a or -profile:v, -profile is ambiguous\n"); | |
1062 | 4 | av_dict_set(&o->g->codec_opts, "profile:v", arg, 0); | |
1063 | 4 | return 0; | |
1064 | } | ||
1065 | 41 | av_dict_set(&o->g->codec_opts, opt, arg, 0); | |
1066 | 41 | return 0; | |
1067 | } | ||
1068 | |||
1069 | 2717 | static int opt_video_filters(void *optctx, const char *opt, const char *arg) | |
1070 | { | ||
1071 | 2717 | OptionsContext *o = optctx; | |
1072 | 2717 | return parse_option(o, "filter:v", arg, options); | |
1073 | } | ||
1074 | |||
1075 | 555 | static int opt_audio_filters(void *optctx, const char *opt, const char *arg) | |
1076 | { | ||
1077 | 555 | OptionsContext *o = optctx; | |
1078 | 555 | return parse_option(o, "filter:a", arg, options); | |
1079 | } | ||
1080 | |||
1081 | 496 | static int opt_vsync(void *optctx, const char *opt, const char *arg) | |
1082 | { | ||
1083 | 496 | av_log(NULL, AV_LOG_WARNING, "-vsync is deprecated. Use -fps_mode\n"); | |
1084 | 496 | parse_and_set_vsync(arg, &video_sync_method, -1, -1, 1); | |
1085 | 496 | return 0; | |
1086 | } | ||
1087 | |||
1088 | 15 | static int opt_timecode(void *optctx, const char *opt, const char *arg) | |
1089 | { | ||
1090 | 15 | OptionsContext *o = optctx; | |
1091 | int ret; | ||
1092 | 15 | char *tcr = av_asprintf("timecode=%s", arg); | |
1093 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
15 | if (!tcr) |
1094 | ✗ | return AVERROR(ENOMEM); | |
1095 | 15 | ret = parse_option(o, "metadata:g", tcr, options); | |
1096 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | if (ret >= 0) |
1097 | 15 | ret = av_dict_set(&o->g->codec_opts, "gop_timecode", arg, 0); | |
1098 | 15 | av_free(tcr); | |
1099 | 15 | return ret; | |
1100 | } | ||
1101 | |||
1102 | ✗ | static int opt_audio_qscale(void *optctx, const char *opt, const char *arg) | |
1103 | { | ||
1104 | ✗ | OptionsContext *o = optctx; | |
1105 | ✗ | return parse_option(o, "q:a", arg, options); | |
1106 | } | ||
1107 | |||
1108 | 74 | static int opt_filter_complex(void *optctx, const char *opt, const char *arg) | |
1109 | { | ||
1110 | 74 | FilterGraph *fg = ALLOC_ARRAY_ELEM(filtergraphs, nb_filtergraphs); | |
1111 | |||
1112 | 74 | fg->index = nb_filtergraphs - 1; | |
1113 | 74 | fg->graph_desc = av_strdup(arg); | |
1114 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
|
74 | if (!fg->graph_desc) |
1115 | ✗ | return AVERROR(ENOMEM); | |
1116 | |||
1117 | 74 | return 0; | |
1118 | } | ||
1119 | |||
1120 | 26 | static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg) | |
1121 | { | ||
1122 | FilterGraph *fg; | ||
1123 | 26 | char *graph_desc = file_read(arg); | |
1124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
|
26 | if (!graph_desc) |
1125 | ✗ | return AVERROR(EINVAL); | |
1126 | |||
1127 | 26 | fg = ALLOC_ARRAY_ELEM(filtergraphs, nb_filtergraphs); | |
1128 | 26 | fg->index = nb_filtergraphs - 1; | |
1129 | 26 | fg->graph_desc = graph_desc; | |
1130 | |||
1131 | 26 | return 0; | |
1132 | } | ||
1133 | |||
1134 | ✗ | void show_help_default(const char *opt, const char *arg) | |
1135 | { | ||
1136 | /* per-file options have at least one of those set */ | ||
1137 | ✗ | const int per_file = OPT_SPEC | OPT_OFFSET | OPT_PERFILE; | |
1138 | ✗ | int show_advanced = 0, show_avoptions = 0; | |
1139 | |||
1140 | ✗ | if (opt && *opt) { | |
1141 | ✗ | if (!strcmp(opt, "long")) | |
1142 | ✗ | show_advanced = 1; | |
1143 | ✗ | else if (!strcmp(opt, "full")) | |
1144 | ✗ | show_advanced = show_avoptions = 1; | |
1145 | else | ||
1146 | ✗ | av_log(NULL, AV_LOG_ERROR, "Unknown help option '%s'.\n", opt); | |
1147 | } | ||
1148 | |||
1149 | ✗ | show_usage(); | |
1150 | |||
1151 | ✗ | printf("Getting help:\n" | |
1152 | " -h -- print basic options\n" | ||
1153 | " -h long -- print more options\n" | ||
1154 | " -h full -- print all options (including all format and codec specific options, very long)\n" | ||
1155 | " -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol\n" | ||
1156 | " See man %s for detailed description of the options.\n" | ||
1157 | "\n", program_name); | ||
1158 | |||
1159 | ✗ | show_help_options(options, "Print help / information / capabilities:", | |
1160 | OPT_EXIT, 0, 0); | ||
1161 | |||
1162 | ✗ | show_help_options(options, "Global options (affect whole program " | |
1163 | "instead of just one file):", | ||
1164 | 0, per_file | OPT_EXIT | OPT_EXPERT, 0); | ||
1165 | ✗ | if (show_advanced) | |
1166 | ✗ | show_help_options(options, "Advanced global options:", OPT_EXPERT, | |
1167 | per_file | OPT_EXIT, 0); | ||
1168 | |||
1169 | ✗ | show_help_options(options, "Per-file main options:", 0, | |
1170 | OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | | ||
1171 | OPT_EXIT, per_file); | ||
1172 | ✗ | if (show_advanced) | |
1173 | ✗ | show_help_options(options, "Advanced per-file options:", | |
1174 | OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE, per_file); | ||
1175 | |||
1176 | ✗ | show_help_options(options, "Video options:", | |
1177 | OPT_VIDEO, OPT_EXPERT | OPT_AUDIO, 0); | ||
1178 | ✗ | if (show_advanced) | |
1179 | ✗ | show_help_options(options, "Advanced Video options:", | |
1180 | OPT_EXPERT | OPT_VIDEO, OPT_AUDIO, 0); | ||
1181 | |||
1182 | ✗ | show_help_options(options, "Audio options:", | |
1183 | OPT_AUDIO, OPT_EXPERT | OPT_VIDEO, 0); | ||
1184 | ✗ | if (show_advanced) | |
1185 | ✗ | show_help_options(options, "Advanced Audio options:", | |
1186 | OPT_EXPERT | OPT_AUDIO, OPT_VIDEO, 0); | ||
1187 | ✗ | show_help_options(options, "Subtitle options:", | |
1188 | OPT_SUBTITLE, 0, 0); | ||
1189 | ✗ | printf("\n"); | |
1190 | |||
1191 | ✗ | if (show_avoptions) { | |
1192 | ✗ | int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM; | |
1193 | ✗ | show_help_children(avcodec_get_class(), flags); | |
1194 | ✗ | show_help_children(avformat_get_class(), flags); | |
1195 | #if CONFIG_SWSCALE | ||
1196 | ✗ | show_help_children(sws_get_class(), flags); | |
1197 | #endif | ||
1198 | #if CONFIG_SWRESAMPLE | ||
1199 | ✗ | show_help_children(swr_get_class(), AV_OPT_FLAG_AUDIO_PARAM); | |
1200 | #endif | ||
1201 | ✗ | show_help_children(avfilter_get_class(), AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM); | |
1202 | ✗ | show_help_children(av_bsf_get_class(), AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_BSF_PARAM); | |
1203 | } | ||
1204 | } | ||
1205 | |||
1206 | ✗ | void show_usage(void) | |
1207 | { | ||
1208 | ✗ | av_log(NULL, AV_LOG_INFO, "Hyper fast Audio and Video encoder\n"); | |
1209 | ✗ | av_log(NULL, AV_LOG_INFO, "usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name); | |
1210 | ✗ | av_log(NULL, AV_LOG_INFO, "\n"); | |
1211 | } | ||
1212 | |||
1213 | enum OptGroup { | ||
1214 | GROUP_OUTFILE, | ||
1215 | GROUP_INFILE, | ||
1216 | }; | ||
1217 | |||
1218 | static const OptionGroupDef groups[] = { | ||
1219 | [GROUP_OUTFILE] = { "output url", NULL, OPT_OUTPUT }, | ||
1220 | [GROUP_INFILE] = { "input url", "i", OPT_INPUT }, | ||
1221 | }; | ||
1222 | |||
1223 | 12954 | static int open_files(OptionGroupList *l, const char *inout, | |
1224 | int (*open_file)(const OptionsContext*, const char*)) | ||
1225 | { | ||
1226 | int i, ret; | ||
1227 | |||
1228 |
2/2✓ Branch 0 taken 12990 times.
✓ Branch 1 taken 12954 times.
|
25944 | for (i = 0; i < l->nb_groups; i++) { |
1229 | 12990 | OptionGroup *g = &l->groups[i]; | |
1230 | OptionsContext o; | ||
1231 | |||
1232 | 12990 | init_options(&o); | |
1233 | 12990 | o.g = g; | |
1234 | |||
1235 | 12990 | ret = parse_optgroup(&o, g); | |
1236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12990 times.
|
12990 | if (ret < 0) { |
1237 | ✗ | av_log(NULL, AV_LOG_ERROR, "Error parsing options for %s file " | |
1238 | "%s.\n", inout, g->arg); | ||
1239 | ✗ | uninit_options(&o); | |
1240 | ✗ | return ret; | |
1241 | } | ||
1242 | |||
1243 | 12990 | av_log(NULL, AV_LOG_DEBUG, "Opening an %s file: %s.\n", inout, g->arg); | |
1244 | 12990 | ret = open_file(&o, g->arg); | |
1245 | 12990 | uninit_options(&o); | |
1246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12990 times.
|
12990 | if (ret < 0) { |
1247 | ✗ | av_log(NULL, AV_LOG_ERROR, "Error opening %s file %s.\n", | |
1248 | inout, g->arg); | ||
1249 | ✗ | return ret; | |
1250 | } | ||
1251 | 12990 | av_log(NULL, AV_LOG_DEBUG, "Successfully opened the file.\n"); | |
1252 | } | ||
1253 | |||
1254 | 12954 | return 0; | |
1255 | } | ||
1256 | |||
1257 | 6478 | int ffmpeg_parse_options(int argc, char **argv) | |
1258 | { | ||
1259 | OptionParseContext octx; | ||
1260 | int ret; | ||
1261 | |||
1262 | 6478 | memset(&octx, 0, sizeof(octx)); | |
1263 | |||
1264 | /* split the commandline into an internal representation */ | ||
1265 | 6478 | ret = split_commandline(&octx, argc, argv, options, groups, | |
1266 | FF_ARRAY_ELEMS(groups)); | ||
1267 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6478 times.
|
6478 | if (ret < 0) { |
1268 | ✗ | av_log(NULL, AV_LOG_FATAL, "Error splitting the argument list: "); | |
1269 | ✗ | goto fail; | |
1270 | } | ||
1271 | |||
1272 | /* apply global options */ | ||
1273 | 6478 | ret = parse_optgroup(NULL, &octx.global_opts); | |
1274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6477 times.
|
6477 | if (ret < 0) { |
1275 | ✗ | av_log(NULL, AV_LOG_FATAL, "Error parsing global options: "); | |
1276 | ✗ | goto fail; | |
1277 | } | ||
1278 | |||
1279 | /* configure terminal and setup signal handlers */ | ||
1280 | 6477 | term_init(); | |
1281 | |||
1282 | /* open input files */ | ||
1283 | 6477 | ret = open_files(&octx.groups[GROUP_INFILE], "input", ifile_open); | |
1284 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6477 times.
|
6477 | if (ret < 0) { |
1285 | ✗ | av_log(NULL, AV_LOG_FATAL, "Error opening input files: "); | |
1286 | ✗ | goto fail; | |
1287 | } | ||
1288 | |||
1289 | /* create the complex filtergraphs */ | ||
1290 | 6477 | ret = init_complex_filters(); | |
1291 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6477 times.
|
6477 | if (ret < 0) { |
1292 | ✗ | av_log(NULL, AV_LOG_FATAL, "Error initializing complex filters.\n"); | |
1293 | ✗ | goto fail; | |
1294 | } | ||
1295 | |||
1296 | /* open output files */ | ||
1297 | 6477 | ret = open_files(&octx.groups[GROUP_OUTFILE], "output", of_open); | |
1298 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6477 times.
|
6477 | if (ret < 0) { |
1299 | ✗ | av_log(NULL, AV_LOG_FATAL, "Error opening output files: "); | |
1300 | ✗ | goto fail; | |
1301 | } | ||
1302 | |||
1303 | 6477 | correct_input_start_times(); | |
1304 | |||
1305 | 6477 | apply_sync_offsets(); | |
1306 | |||
1307 | 6477 | check_filter_outputs(); | |
1308 | |||
1309 | 6477 | fail: | |
1310 | 6477 | uninit_parse_context(&octx); | |
1311 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6477 times.
|
6477 | if (ret < 0) { |
1312 | ✗ | av_log(NULL, AV_LOG_FATAL, "%s\n", av_err2str(ret)); | |
1313 | } | ||
1314 | 6477 | return ret; | |
1315 | } | ||
1316 | |||
1317 | ✗ | static int opt_progress(void *optctx, const char *opt, const char *arg) | |
1318 | { | ||
1319 | ✗ | AVIOContext *avio = NULL; | |
1320 | int ret; | ||
1321 | |||
1322 | ✗ | if (!strcmp(arg, "-")) | |
1323 | ✗ | arg = "pipe:"; | |
1324 | ✗ | ret = avio_open2(&avio, arg, AVIO_FLAG_WRITE, &int_cb, NULL); | |
1325 | ✗ | if (ret < 0) { | |
1326 | ✗ | av_log(NULL, AV_LOG_ERROR, "Failed to open progress URL \"%s\": %s\n", | |
1327 | ✗ | arg, av_err2str(ret)); | |
1328 | ✗ | return ret; | |
1329 | } | ||
1330 | ✗ | progress_avio = avio; | |
1331 | ✗ | return 0; | |
1332 | } | ||
1333 | |||
1334 | ✗ | int opt_timelimit(void *optctx, const char *opt, const char *arg) | |
1335 | { | ||
1336 | #if HAVE_SETRLIMIT | ||
1337 | ✗ | int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); | |
1338 | ✗ | struct rlimit rl = { lim, lim + 1 }; | |
1339 | ✗ | if (setrlimit(RLIMIT_CPU, &rl)) | |
1340 | ✗ | perror("setrlimit"); | |
1341 | #else | ||
1342 | av_log(NULL, AV_LOG_WARNING, "-%s not implemented on this OS\n", opt); | ||
1343 | #endif | ||
1344 | ✗ | return 0; | |
1345 | } | ||
1346 | |||
1347 | #define OFFSET(x) offsetof(OptionsContext, x) | ||
1348 | const OptionDef options[] = { | ||
1349 | /* main options */ | ||
1350 | CMDUTILS_COMMON_OPTIONS | ||
1351 | { "f", HAS_ARG | OPT_STRING | OPT_OFFSET | | ||
1352 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(format) }, | ||
1353 | "force format", "fmt" }, | ||
1354 | { "y", OPT_BOOL, { &file_overwrite }, | ||
1355 | "overwrite output files" }, | ||
1356 | { "n", OPT_BOOL, { &no_file_overwrite }, | ||
1357 | "never overwrite output files" }, | ||
1358 | { "ignore_unknown", OPT_BOOL, { &ignore_unknown_streams }, | ||
1359 | "Ignore unknown stream types" }, | ||
1360 | { "copy_unknown", OPT_BOOL | OPT_EXPERT, { ©_unknown_streams }, | ||
1361 | "Copy unknown stream types" }, | ||
1362 | { "recast_media", OPT_BOOL | OPT_EXPERT, { &recast_media }, | ||
1363 | "allow recasting stream type in order to force a decoder of different media type" }, | ||
1364 | { "c", HAS_ARG | OPT_STRING | OPT_SPEC | | ||
1365 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(codec_names) }, | ||
1366 | "codec name", "codec" }, | ||
1367 | { "codec", HAS_ARG | OPT_STRING | OPT_SPEC | | ||
1368 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(codec_names) }, | ||
1369 | "codec name", "codec" }, | ||
1370 | { "pre", HAS_ARG | OPT_STRING | OPT_SPEC | | ||
1371 | OPT_OUTPUT, { .off = OFFSET(presets) }, | ||
1372 | "preset name", "preset" }, | ||
1373 | { "map", HAS_ARG | OPT_EXPERT | OPT_PERFILE | | ||
1374 | OPT_OUTPUT, { .func_arg = opt_map }, | ||
1375 | "set input stream mapping", | ||
1376 | "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" }, | ||
1377 | #if FFMPEG_OPT_MAP_CHANNEL | ||
1378 | { "map_channel", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_map_channel }, | ||
1379 | "map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" }, | ||
1380 | #endif | ||
1381 | { "map_metadata", HAS_ARG | OPT_STRING | OPT_SPEC | | ||
1382 | OPT_OUTPUT, { .off = OFFSET(metadata_map) }, | ||
1383 | "set metadata information of outfile from infile", | ||
1384 | "outfile[,metadata]:infile[,metadata]" }, | ||
1385 | { "map_chapters", HAS_ARG | OPT_INT | OPT_EXPERT | OPT_OFFSET | | ||
1386 | OPT_OUTPUT, { .off = OFFSET(chapters_input_file) }, | ||
1387 | "set chapters mapping", "input_file_index" }, | ||
1388 | { "t", HAS_ARG | OPT_TIME | OPT_OFFSET | | ||
1389 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(recording_time) }, | ||
1390 | "record or transcode \"duration\" seconds of audio/video", | ||
1391 | "duration" }, | ||
1392 | { "to", HAS_ARG | OPT_TIME | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(stop_time) }, | ||
1393 | "record or transcode stop time", "time_stop" }, | ||
1394 | { "fs", HAS_ARG | OPT_INT64 | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(limit_filesize) }, | ||
1395 | "set the limit file size in bytes", "limit_size" }, | ||
1396 | { "ss", HAS_ARG | OPT_TIME | OPT_OFFSET | | ||
1397 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(start_time) }, | ||
1398 | "set the start time offset", "time_off" }, | ||
1399 | { "sseof", HAS_ARG | OPT_TIME | OPT_OFFSET | | ||
1400 | OPT_INPUT, { .off = OFFSET(start_time_eof) }, | ||
1401 | "set the start time offset relative to EOF", "time_off" }, | ||
1402 | { "seek_timestamp", HAS_ARG | OPT_INT | OPT_OFFSET | | ||
1403 | OPT_INPUT, { .off = OFFSET(seek_timestamp) }, | ||
1404 | "enable/disable seeking by timestamp with -ss" }, | ||
1405 | { "accurate_seek", OPT_BOOL | OPT_OFFSET | OPT_EXPERT | | ||
1406 | OPT_INPUT, { .off = OFFSET(accurate_seek) }, | ||
1407 | "enable/disable accurate seeking with -ss" }, | ||
1408 | { "isync", HAS_ARG | OPT_INT | OPT_OFFSET | | ||
1409 | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_sync_ref) }, | ||
1410 | "Indicate the input index for sync reference", "sync ref" }, | ||
1411 | { "itsoffset", HAS_ARG | OPT_TIME | OPT_OFFSET | | ||
1412 | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_ts_offset) }, | ||
1413 | "set the input ts offset", "time_off" }, | ||
1414 | { "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC | | ||
1415 | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(ts_scale) }, | ||
1416 | "set the input ts scale", "scale" }, | ||
1417 | { "timestamp", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_recording_timestamp }, | ||
1418 | "set the recording timestamp ('now' to set the current time)", "time" }, | ||
1419 | { "metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) }, | ||
1420 | "add metadata", "string=string" }, | ||
1421 | { "program", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(program) }, | ||
1422 | "add program with specified streams", "title=string:st=number..." }, | ||
1423 | { "dframes", HAS_ARG | OPT_PERFILE | OPT_EXPERT | | ||
1424 | OPT_OUTPUT, { .func_arg = opt_data_frames }, | ||
1425 | "set the number of data frames to output", "number" }, | ||
1426 | { "benchmark", OPT_BOOL | OPT_EXPERT, { &do_benchmark }, | ||
1427 | "add timings for benchmarking" }, | ||
1428 | { "benchmark_all", OPT_BOOL | OPT_EXPERT, { &do_benchmark_all }, | ||
1429 | "add timings for each task" }, | ||
1430 | { "progress", HAS_ARG | OPT_EXPERT, { .func_arg = opt_progress }, | ||
1431 | "write program-readable progress information", "url" }, | ||
1432 | { "stdin", OPT_BOOL | OPT_EXPERT, { &stdin_interaction }, | ||
1433 | "enable or disable interaction on standard input" }, | ||
1434 | { "timelimit", HAS_ARG | OPT_EXPERT, { .func_arg = opt_timelimit }, | ||
1435 | "set max runtime in seconds in CPU user time", "limit" }, | ||
1436 | { "dump", OPT_BOOL | OPT_EXPERT, { &do_pkt_dump }, | ||
1437 | "dump each input packet" }, | ||
1438 | { "hex", OPT_BOOL | OPT_EXPERT, { &do_hex_dump }, | ||
1439 | "when dumping packets, also dump the payload" }, | ||
1440 | { "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET | | ||
1441 | OPT_INPUT, { .off = OFFSET(rate_emu) }, | ||
1442 | "read input at native frame rate; equivalent to -readrate 1", "" }, | ||
1443 | { "readrate", HAS_ARG | OPT_FLOAT | OPT_OFFSET | | ||
1444 | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate) }, | ||
1445 | "read input at specified rate", "speed" }, | ||
1446 | { "target", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_target }, | ||
1447 | "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" " | ||
1448 | "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" }, | ||
1449 | { "vsync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vsync }, | ||
1450 | "set video sync method globally; deprecated, use -fps_mode", "" }, | ||
1451 | { "frame_drop_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold }, | ||
1452 | "frame drop threshold", "" }, | ||
1453 | { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &audio_drift_threshold }, | ||
1454 | "audio drift threshold", "threshold" }, | ||
1455 | { "copyts", OPT_BOOL | OPT_EXPERT, { ©_ts }, | ||
1456 | "copy timestamps" }, | ||
1457 | { "start_at_zero", OPT_BOOL | OPT_EXPERT, { &start_at_zero }, | ||
1458 | "shift input timestamps to start at 0 when using copyts" }, | ||
1459 | { "copytb", HAS_ARG | OPT_INT | OPT_EXPERT, { ©_tb }, | ||
1460 | "copy input stream time base when stream copying", "mode" }, | ||
1461 | { "shortest", OPT_BOOL | OPT_EXPERT | OPT_OFFSET | | ||
1462 | OPT_OUTPUT, { .off = OFFSET(shortest) }, | ||
1463 | "finish encoding within shortest input" }, | ||
1464 | { "shortest_buf_duration", HAS_ARG | OPT_FLOAT | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(shortest_buf_duration) }, | ||
1465 | "maximum buffering duration (in seconds) for the -shortest option" }, | ||
1466 | { "bitexact", OPT_BOOL | OPT_EXPERT | OPT_OFFSET | | ||
1467 | OPT_OUTPUT | OPT_INPUT, { .off = OFFSET(bitexact) }, | ||
1468 | "bitexact mode" }, | ||
1469 | { "apad", OPT_STRING | HAS_ARG | OPT_SPEC | | ||
1470 | OPT_OUTPUT, { .off = OFFSET(apad) }, | ||
1471 | "audio pad", "" }, | ||
1472 | { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &dts_delta_threshold }, | ||
1473 | "timestamp discontinuity delta threshold", "threshold" }, | ||
1474 | { "dts_error_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &dts_error_threshold }, | ||
1475 | "timestamp error delta threshold", "threshold" }, | ||
1476 | { "xerror", OPT_BOOL | OPT_EXPERT, { &exit_on_error }, | ||
1477 | "exit on error", "error" }, | ||
1478 | { "abort_on", HAS_ARG | OPT_EXPERT, { .func_arg = opt_abort_on }, | ||
1479 | "abort on the specified condition flags", "flags" }, | ||
1480 | { "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC | | ||
1481 | OPT_OUTPUT, { .off = OFFSET(copy_initial_nonkeyframes) }, | ||
1482 | "copy initial non-keyframes" }, | ||
1483 | { "copypriorss", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(copy_prior_start) }, | ||
1484 | "copy or discard frames before start time" }, | ||
1485 | { "frames", OPT_INT64 | HAS_ARG | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(max_frames) }, | ||
1486 | "set the number of frames to output", "number" }, | ||
1487 | { "tag", OPT_STRING | HAS_ARG | OPT_SPEC | | ||
1488 | OPT_EXPERT | OPT_OUTPUT | OPT_INPUT, { .off = OFFSET(codec_tags) }, | ||
1489 | "force codec tag/fourcc", "fourcc/tag" }, | ||
1490 | { "q", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | | ||
1491 | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(qscale) }, | ||
1492 | "use fixed quality scale (VBR)", "q" }, | ||
1493 | { "qscale", HAS_ARG | OPT_EXPERT | OPT_PERFILE | | ||
1494 | OPT_OUTPUT, { .func_arg = opt_qscale }, | ||
1495 | "use fixed quality scale (VBR)", "q" }, | ||
1496 | { "profile", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_profile }, | ||
1497 | "set profile", "profile" }, | ||
1498 | { "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) }, | ||
1499 | "set stream filtergraph", "filter_graph" }, | ||
1500 | { "filter_threads", HAS_ARG, { .func_arg = opt_filter_threads }, | ||
1501 | "number of non-complex filter threads" }, | ||
1502 | { "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) }, | ||
1503 | "read stream filtergraph description from a file", "filename" }, | ||
1504 | { "reinit_filter", HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(reinit_filters) }, | ||
1505 | "reinit filtergraph on input parameter changes", "" }, | ||
1506 | { "filter_complex", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex }, | ||
1507 | "create a complex filtergraph", "graph_description" }, | ||
1508 | { "filter_complex_threads", HAS_ARG | OPT_INT, { &filter_complex_nbthreads }, | ||
1509 | "number of threads for -filter_complex" }, | ||
1510 | { "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex }, | ||
1511 | "create a complex filtergraph", "graph_description" }, | ||
1512 | { "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script }, | ||
1513 | "read complex filtergraph description from a file", "filename" }, | ||
1514 | { "auto_conversion_filters", OPT_BOOL | OPT_EXPERT, { &auto_conversion_filters }, | ||
1515 | "enable automatic conversion filters globally" }, | ||
1516 | { "stats", OPT_BOOL, { &print_stats }, | ||
1517 | "print progress report during encoding", }, | ||
1518 | { "stats_period", HAS_ARG | OPT_EXPERT, { .func_arg = opt_stats_period }, | ||
1519 | "set the period at which ffmpeg updates stats and -progress output", "time" }, | ||
1520 | { "attach", HAS_ARG | OPT_PERFILE | OPT_EXPERT | | ||
1521 | OPT_OUTPUT, { .func_arg = opt_attach }, | ||
1522 | "add an attachment to the output file", "filename" }, | ||
1523 | { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC | | ||
1524 | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(dump_attachment) }, | ||
1525 | "extract an attachment into a file", "filename" }, | ||
1526 | { "stream_loop", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_INPUT | | ||
1527 | OPT_OFFSET, { .off = OFFSET(loop) }, "set number of times input stream shall be looped", "loop count" }, | ||
1528 | { "debug_ts", OPT_BOOL | OPT_EXPERT, { &debug_ts }, | ||
1529 | "print timestamp debugging info" }, | ||
1530 | { "max_error_rate", HAS_ARG | OPT_FLOAT, { &max_error_rate }, | ||
1531 | "ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.", "maximum error rate" }, | ||
1532 | { "discard", OPT_STRING | HAS_ARG | OPT_SPEC | | ||
1533 | OPT_INPUT, { .off = OFFSET(discard) }, | ||
1534 | "discard", "" }, | ||
1535 | { "disposition", OPT_STRING | HAS_ARG | OPT_SPEC | | ||
1536 | OPT_OUTPUT, { .off = OFFSET(disposition) }, | ||
1537 | "disposition", "" }, | ||
1538 | { "thread_queue_size", HAS_ARG | OPT_INT | OPT_OFFSET | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT, | ||
1539 | { .off = OFFSET(thread_queue_size) }, | ||
1540 | "set the maximum number of queued packets from the demuxer" }, | ||
1541 | { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(find_stream_info) }, | ||
1542 | "read and decode the streams to fill missing information with heuristics" }, | ||
1543 | { "bits_per_raw_sample", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, | ||
1544 | { .off = OFFSET(bits_per_raw_sample) }, | ||
1545 | "set the number of bits per raw sample", "number" }, | ||
1546 | |||
1547 | { "stats_enc_pre", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre) }, | ||
1548 | "write encoding stats before encoding" }, | ||
1549 | { "stats_enc_post", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post) }, | ||
1550 | "write encoding stats after encoding" }, | ||
1551 | { "stats_mux_pre", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats) }, | ||
1552 | "write packets stats before muxing" }, | ||
1553 | { "stats_enc_pre_fmt", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_pre_fmt) }, | ||
1554 | "format of the stats written with -stats_enc_pre" }, | ||
1555 | { "stats_enc_post_fmt", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(enc_stats_post_fmt) }, | ||
1556 | "format of the stats written with -stats_enc_post" }, | ||
1557 | { "stats_mux_pre_fmt", HAS_ARG | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT | OPT_STRING, { .off = OFFSET(mux_stats_fmt) }, | ||
1558 | "format of the stats written with -stats_mux_pre" }, | ||
1559 | |||
1560 | /* video options */ | ||
1561 | { "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames }, | ||
1562 | "set the number of video frames to output", "number" }, | ||
1563 | { "r", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC | | ||
1564 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_rates) }, | ||
1565 | "set frame rate (Hz value, fraction or abbreviation)", "rate" }, | ||
1566 | { "fpsmax", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC | | ||
1567 | OPT_OUTPUT, { .off = OFFSET(max_frame_rates) }, | ||
1568 | "set max frame rate (Hz value, fraction or abbreviation)", "rate" }, | ||
1569 | { "s", OPT_VIDEO | HAS_ARG | OPT_SUBTITLE | OPT_STRING | OPT_SPEC | | ||
1570 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_sizes) }, | ||
1571 | "set frame size (WxH or abbreviation)", "size" }, | ||
1572 | { "aspect", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC | | ||
1573 | OPT_OUTPUT, { .off = OFFSET(frame_aspect_ratios) }, | ||
1574 | "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" }, | ||
1575 | { "pix_fmt", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | | ||
1576 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_pix_fmts) }, | ||
1577 | "set pixel format", "format" }, | ||
1578 | { "display_rotation", OPT_VIDEO | HAS_ARG | OPT_DOUBLE | OPT_SPEC | | ||
1579 | OPT_INPUT, { .off = OFFSET(display_rotations) }, | ||
1580 | "set pure counter-clockwise rotation in degrees for stream(s)", | ||
1581 | "angle" }, | ||
1582 | { "display_hflip", OPT_VIDEO | OPT_BOOL | OPT_SPEC | OPT_INPUT, { .off = OFFSET(display_hflips) }, | ||
1583 | "set display horizontal flip for stream(s) " | ||
1584 | "(overrides any display rotation if it is not set)"}, | ||
1585 | { "display_vflip", OPT_VIDEO | OPT_BOOL | OPT_SPEC | OPT_INPUT, { .off = OFFSET(display_vflips) }, | ||
1586 | "set display vertical flip for stream(s) " | ||
1587 | "(overrides any display rotation if it is not set)"}, | ||
1588 | { "vn", OPT_VIDEO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(video_disable) }, | ||
1589 | "disable video" }, | ||
1590 | { "rc_override", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | | ||
1591 | OPT_OUTPUT, { .off = OFFSET(rc_overrides) }, | ||
1592 | "rate control override for specific intervals", "override" }, | ||
1593 | { "vcodec", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_INPUT | | ||
1594 | OPT_OUTPUT, { .func_arg = opt_video_codec }, | ||
1595 | "force video codec ('copy' to copy stream)", "codec" }, | ||
1596 | { "timecode", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_timecode }, | ||
1597 | "set initial TimeCode value.", "hh:mm:ss[:;.]ff" }, | ||
1598 | { "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT | OPT_OUTPUT, { .off = OFFSET(pass) }, | ||
1599 | "select the pass number (1 to 3)", "n" }, | ||
1600 | { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | | ||
1601 | OPT_OUTPUT, { .off = OFFSET(passlogfiles) }, | ||
1602 | "select two pass log file name prefix", "prefix" }, | ||
1603 | #if FFMPEG_OPT_PSNR | ||
1604 | { "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr }, | ||
1605 | "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" }, | ||
1606 | #endif | ||
1607 | { "vstats", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_vstats }, | ||
1608 | "dump video coding statistics to file" }, | ||
1609 | { "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_vstats_file }, | ||
1610 | "dump video coding statistics to file", "file" }, | ||
1611 | { "vstats_version", OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT , { &vstats_version }, | ||
1612 | "Version of the vstats format to use."}, | ||
1613 | { "vf", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_filters }, | ||
1614 | "set video filters", "filter_graph" }, | ||
1615 | { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | | ||
1616 | OPT_OUTPUT, { .off = OFFSET(intra_matrices) }, | ||
1617 | "specify intra matrix coeffs", "matrix" }, | ||
1618 | { "inter_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | | ||
1619 | OPT_OUTPUT, { .off = OFFSET(inter_matrices) }, | ||
1620 | "specify inter matrix coeffs", "matrix" }, | ||
1621 | { "chroma_intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | | ||
1622 | OPT_OUTPUT, { .off = OFFSET(chroma_intra_matrices) }, | ||
1623 | "specify intra matrix coeffs", "matrix" }, | ||
1624 | { "top", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_INT| OPT_SPEC | | ||
1625 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) }, | ||
1626 | "top=1/bottom=0/auto=-1 field first", "" }, | ||
1627 | { "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | | ||
1628 | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_old2new }, | ||
1629 | "force video tag/fourcc", "fourcc/tag" }, | ||
1630 | { "qphist", OPT_VIDEO | OPT_BOOL | OPT_EXPERT , { &qp_hist }, | ||
1631 | "show QP histogram" }, | ||
1632 | { "fps_mode", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | | ||
1633 | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fps_mode) }, | ||
1634 | "set framerate mode for matching video streams; overrides vsync" }, | ||
1635 | { "force_fps", OPT_VIDEO | OPT_BOOL | OPT_EXPERT | OPT_SPEC | | ||
1636 | OPT_OUTPUT, { .off = OFFSET(force_fps) }, | ||
1637 | "force the selected framerate, disable the best supported framerate selection" }, | ||
1638 | { "streamid", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | | ||
1639 | OPT_OUTPUT, { .func_arg = opt_streamid }, | ||
1640 | "set the value of an outfile streamid", "streamIndex:value" }, | ||
1641 | { "force_key_frames", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | | ||
1642 | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(forced_key_frames) }, | ||
1643 | "force key frames at specified timestamps", "timestamps" }, | ||
1644 | { "b", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_bitrate }, | ||
1645 | "video bitrate (please use -b:v)", "bitrate" }, | ||
1646 | { "hwaccel", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | | ||
1647 | OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccels) }, | ||
1648 | "use HW accelerated decoding", "hwaccel name" }, | ||
1649 | { "hwaccel_device", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | | ||
1650 | OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_devices) }, | ||
1651 | "select a device for HW acceleration", "devicename" }, | ||
1652 | { "hwaccel_output_format", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | | ||
1653 | OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_output_formats) }, | ||
1654 | "select output format used with HW accelerated decoding", "format" }, | ||
1655 | { "hwaccels", OPT_EXIT, { .func_arg = show_hwaccels }, | ||
1656 | "show available HW acceleration methods" }, | ||
1657 | { "autorotate", HAS_ARG | OPT_BOOL | OPT_SPEC | | ||
1658 | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(autorotate) }, | ||
1659 | "automatically insert correct rotate filters" }, | ||
1660 | { "autoscale", HAS_ARG | OPT_BOOL | OPT_SPEC | | ||
1661 | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(autoscale) }, | ||
1662 | "automatically insert a scale filter at the end of the filter graph" }, | ||
1663 | { "fix_sub_duration_heartbeat", OPT_VIDEO | OPT_BOOL | OPT_EXPERT | | ||
1664 | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fix_sub_duration_heartbeat) }, | ||
1665 | "set this video output stream to be a heartbeat stream for " | ||
1666 | "fix_sub_duration, according to which subtitles should be split at " | ||
1667 | "random access points" }, | ||
1668 | |||
1669 | /* audio options */ | ||
1670 | { "aframes", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_frames }, | ||
1671 | "set the number of audio frames to output", "number" }, | ||
1672 | { "aq", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_qscale }, | ||
1673 | "set audio quality (codec-specific)", "quality", }, | ||
1674 | { "ar", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | | ||
1675 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_sample_rate) }, | ||
1676 | "set audio sampling rate (in Hz)", "rate" }, | ||
1677 | { "ac", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | | ||
1678 | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_channels) }, | ||
1679 | "set number of audio channels", "channels" }, | ||
1680 | { "an", OPT_AUDIO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(audio_disable) }, | ||
1681 | "disable audio" }, | ||
1682 | { "acodec", OPT_AUDIO | HAS_ARG | OPT_PERFILE | | ||
1683 | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_audio_codec }, | ||
1684 | "force audio codec ('copy' to copy stream)", "codec" }, | ||
1685 | { "ab", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_bitrate }, | ||
1686 | "audio bitrate (please use -b:a)", "bitrate" }, | ||
1687 | { "atag", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | | ||
1688 | OPT_OUTPUT, { .func_arg = opt_old2new }, | ||
1689 | "force audio tag/fourcc", "fourcc/tag" }, | ||
1690 | { "sample_fmt", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC | | ||
1691 | OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(sample_fmts) }, | ||
1692 | "set sample format", "format" }, | ||
1693 | { "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC | | ||
1694 | OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) }, | ||
1695 | "set channel layout", "layout" }, | ||
1696 | { "ch_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC | | ||
1697 | OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) }, | ||
1698 | "set channel layout", "layout" }, | ||
1699 | { "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_filters }, | ||
1700 | "set audio filters", "filter_graph" }, | ||
1701 | { "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) }, | ||
1702 | "set the maximum number of channels to try to guess the channel layout" }, | ||
1703 | |||
1704 | /* subtitle options */ | ||
1705 | { "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(subtitle_disable) }, | ||
1706 | "disable subtitle" }, | ||
1707 | { "scodec", OPT_SUBTITLE | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_subtitle_codec }, | ||
1708 | "force subtitle codec ('copy' to copy stream)", "codec" }, | ||
1709 | { "stag", OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new } | ||
1710 | , "force subtitle tag/fourcc", "fourcc/tag" }, | ||
1711 | { "fix_sub_duration", OPT_BOOL | OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT, { .off = OFFSET(fix_sub_duration) }, | ||
1712 | "fix subtitles duration" }, | ||
1713 | { "canvas_size", OPT_SUBTITLE | HAS_ARG | OPT_STRING | OPT_SPEC | OPT_INPUT, { .off = OFFSET(canvas_sizes) }, | ||
1714 | "set canvas size (WxH or abbreviation)", "size" }, | ||
1715 | |||
1716 | /* muxer options */ | ||
1717 | { "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_max_delay) }, | ||
1718 | "set the maximum demux-decode delay", "seconds" }, | ||
1719 | { "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_preload) }, | ||
1720 | "set the initial demux-decode delay", "seconds" }, | ||
1721 | { "sdp_file", HAS_ARG | OPT_EXPERT | OPT_OUTPUT, { .func_arg = opt_sdp_file }, | ||
1722 | "specify a file in which to print sdp information", "file" }, | ||
1723 | |||
1724 | { "time_base", HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(time_bases) }, | ||
1725 | "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)", "ratio" }, | ||
1726 | { "enc_time_base", HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(enc_time_bases) }, | ||
1727 | "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). " | ||
1728 | "two special values are defined - " | ||
1729 | "0 = use frame rate (video) or sample rate (audio)," | ||
1730 | "-1 = match source time base", "ratio" }, | ||
1731 | |||
1732 | { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(bitstream_filters) }, | ||
1733 | "A comma-separated list of bitstream filters", "bitstream_filters" }, | ||
1734 | { "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new }, | ||
1735 | "deprecated", "audio bitstream_filters" }, | ||
1736 | { "vbsf", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new }, | ||
1737 | "deprecated", "video bitstream_filters" }, | ||
1738 | |||
1739 | { "apre", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset }, | ||
1740 | "set the audio options to the indicated preset", "preset" }, | ||
1741 | { "vpre", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset }, | ||
1742 | "set the video options to the indicated preset", "preset" }, | ||
1743 | { "spre", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset }, | ||
1744 | "set the subtitle options to the indicated preset", "preset" }, | ||
1745 | { "fpre", HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset }, | ||
1746 | "set options from indicated preset file", "filename" }, | ||
1747 | |||
1748 | { "max_muxing_queue_size", HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(max_muxing_queue_size) }, | ||
1749 | "maximum number of packets that can be buffered while waiting for all streams to initialize", "packets" }, | ||
1750 | { "muxing_queue_data_threshold", HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(muxing_queue_data_threshold) }, | ||
1751 | "set the threshold after which max_muxing_queue_size is taken into account", "bytes" }, | ||
1752 | |||
1753 | /* data codec support */ | ||
1754 | { "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_data_codec }, | ||
1755 | "force data codec ('copy' to copy stream)", "codec" }, | ||
1756 | { "dn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(data_disable) }, | ||
1757 | "disable data" }, | ||
1758 | |||
1759 | #if CONFIG_VAAPI | ||
1760 | { "vaapi_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vaapi_device }, | ||
1761 | "set VAAPI hardware device (DRM path or X11 display name)", "device" }, | ||
1762 | #endif | ||
1763 | |||
1764 | #if CONFIG_QSV | ||
1765 | { "qsv_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_qsv_device }, | ||
1766 | "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)", "device"}, | ||
1767 | #endif | ||
1768 | |||
1769 | { "init_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_init_hw_device }, | ||
1770 | "initialise hardware device", "args" }, | ||
1771 | { "filter_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_hw_device }, | ||
1772 | "set hardware device used when filtering", "device" }, | ||
1773 | |||
1774 | { NULL, }, | ||
1775 | }; | ||
1776 |