FFmpegKit iOS / macOS / tvOS API  4.4
fftools_ffmpeg.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 /*
20  * CHANGES 06.2020
21  * - cancel_operation() method signature updated with id
22  *
23  * CHANGES 01.2020
24  * - ffprobe support changes
25  *
26  * CHANGES 12.2019
27  * - Concurrent execution support
28  *
29  * CHANGES 03.2019
30  * --------------------------------------------------------
31  * - config.h include removed
32  *
33  * CHANGES 08.2018
34  * --------------------------------------------------------
35  * - fftools_ prefix added to file name and include guards
36  * - set_report_callback() method declared
37  * - cancel_operation() method declared
38  *
39  * CHANGES 07.2018
40  * --------------------------------------------------------
41  * - Include guards renamed
42  */
43 
44 #ifndef FFTOOLS_FFMPEG_H
45 #define FFTOOLS_FFMPEG_H
46 
47 #include <stdint.h>
48 #include <stdio.h>
49 #include <signal.h>
50 
51 #include "fftools_cmdutils.h"
52 
53 #include "libavformat/avformat.h"
54 #include "libavformat/avio.h"
55 
56 #include "libavcodec/avcodec.h"
57 
58 #include "libavfilter/avfilter.h"
59 
60 #include "libavutil/avutil.h"
61 #include "libavutil/dict.h"
62 #include "libavutil/eval.h"
63 #include "libavutil/fifo.h"
64 #include "libavutil/hwcontext.h"
65 #include "libavutil/pixfmt.h"
66 #include "libavutil/rational.h"
67 #include "libavutil/thread.h"
68 #include "libavutil/threadmessage.h"
69 
70 #include "libswresample/swresample.h"
71 
72 #define VSYNC_AUTO -1
73 #define VSYNC_PASSTHROUGH 0
74 #define VSYNC_CFR 1
75 #define VSYNC_VFR 2
76 #define VSYNC_VSCFR 0xfe
77 #define VSYNC_DROP 0xff
78 
79 #define MAX_STREAMS 1024 /* arbitrary sanity check value */
80 
81 enum HWAccelID {
87 };
88 
89 typedef struct HWAccel {
90  const char *name;
91  int (*init)(AVCodecContext *s);
92  enum HWAccelID id;
93  enum AVPixelFormat pix_fmt;
95 
96 typedef struct HWDevice {
97  const char *name;
98  enum AVHWDeviceType type;
99  AVBufferRef *device_ref;
101 
102 /* select an input stream for an output stream */
103 typedef struct StreamMap {
104  int disabled; /* 1 is this mapping is disabled by a negative map */
109  char *linklabel; /* name of an output link, for mapping lavfi outputs */
111 
112 typedef struct {
113  int file_idx, stream_idx, channel_idx; // input
114  int ofile_idx, ostream_idx; // output
116 
117 typedef struct OptionsContext {
119 
120  /* input/output options */
121  int64_t start_time;
122  int64_t start_time_eof;
124  const char *format;
125 
140 
141  /* input options */
143  int loop;
144  int rate_emu;
147 
160 
161  /* output options */
164  AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */
165  int nb_audio_channel_maps; /* number of (valid) -map_channel settings */
169  const char **attachments;
171 
173 
174  int64_t recording_time;
175  int64_t stop_time;
176  uint64_t limit_filesize;
177  float mux_preload;
179  int shortest;
180  int bitexact;
181 
186 
187  /* indexed by output file stream index */
190 
238  int nb_pass;
248  int nb_apad;
262 
263 typedef struct InputFilter {
264  AVFilterContext *filter;
265  struct InputStream *ist;
267  uint8_t *name;
268  enum AVMediaType type; // AVMEDIA_TYPE_SUBTITLE for sub2video
269 
270  AVFifoBuffer *frame_queue;
271 
272  // parameters configured for this input
273  int format;
274 
275  int width, height;
277 
279  int channels;
280  uint64_t channel_layout;
281 
282  AVBufferRef *hw_frames_ctx;
283 
284  int eof;
286 
287 typedef struct OutputFilter {
288  AVFilterContext *filter;
289  struct OutputStream *ost;
291  uint8_t *name;
292 
293  /* temporary storage until stream maps are processed */
294  AVFilterInOut *out_tmp;
295  enum AVMediaType type;
296 
297  /* desired output stream properties */
298  int width, height;
299  AVRational frame_rate;
300  int format;
302  uint64_t channel_layout;
303 
304  // those are only set if no format is specified and the encoder gives us multiple options
305  int *formats;
306  uint64_t *channel_layouts;
309 
310 typedef struct FilterGraph {
311  int index;
312  const char *graph_desc;
313 
314  AVFilterGraph *graph;
316 
322 
323 typedef struct InputStream {
325  AVStream *st;
326  int discard; /* true if stream data should be discarded */
328  int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */
329 #define DECODING_FOR_OST 1
330 #define DECODING_FOR_FILTER 2
331 
332  AVCodecContext *dec_ctx;
333  AVCodec *dec;
334  AVFrame *decoded_frame;
335  AVFrame *filter_frame; /* a ref of decoded_frame, to be sent to filters */
336 
337  int64_t start; /* time when read started */
338  /* predicted dts of the next packet read for this stream or (when there are
339  * several frames in a packet) of the next frame in current packet (in AV_TIME_BASE units) */
340  int64_t next_dts;
341  int64_t dts;
342 
343  int64_t next_pts;
344  int64_t pts;
346 
348 
349  int64_t min_pts; /* pts with the smallest value in a current stream */
350  int64_t max_pts; /* pts with the higher value in a current stream */
351 
352  // when forcing constant input framerate through -r,
353  // this contains the pts that will be given to the next decoded frame
354  int64_t cfr_next_pts;
355 
356  int64_t nb_samples; /* number of samples in the last decoded audio frame before looping */
357 
358  double ts_scale;
360  AVDictionary *decoder_opts;
361  AVRational framerate; /* framerate forced with -r */
364 
366 
368  struct { /* previous decoded subtitle and related variables */
370  int ret;
371  AVSubtitle subtitle;
373 
374  struct sub2video {
375  int64_t last_pts;
376  int64_t end_pts;
377  AVFifoBuffer *sub_queue;
378  AVFrame *frame;
379  int w, h;
380  unsigned int initialize;
382 
383  int dr1;
384 
385  /* decoded data from this stream goes into all those filters
386  * currently video and audio only */
389 
391 
392  /* hwaccel options */
393  enum HWAccelID hwaccel_id;
394  enum AVHWDeviceType hwaccel_device_type;
396  enum AVPixelFormat hwaccel_output_format;
397 
398  /* hwaccel context */
399  void *hwaccel_ctx;
400  void (*hwaccel_uninit)(AVCodecContext *s);
401  int (*hwaccel_get_buffer)(AVCodecContext *s, AVFrame *frame, int flags);
402  int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
403  enum AVPixelFormat hwaccel_pix_fmt;
404  enum AVPixelFormat hwaccel_retrieved_pix_fmt;
405  AVBufferRef *hw_frames_ctx;
406 
407  /* stats */
408  // combined size of all the packets read
409  uint64_t data_size;
410  /* number of packets successfully read for this stream */
411  uint64_t nb_packets;
412  // number of frames/samples retrieved from the decoder
413  uint64_t frames_decoded;
414  uint64_t samples_decoded;
415 
416  int64_t *dts_buffer;
418 
419  int got_output;
421 
422 typedef struct InputFile {
423  AVFormatContext *ctx;
424  int eof_reached; /* true if eof reached */
425  int eagain; /* true if last read attempt returned EAGAIN */
426  int ist_index; /* index of first stream in input_streams */
427  int loop; /* set number of times input stream should be looped */
428  int64_t duration; /* actual duration of the longest stream in a file
429  at the moment when looping happens */
430  AVRational time_base; /* time base of the duration */
432 
433  int64_t ts_offset;
434  int64_t last_ts;
435  int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */
437  int64_t recording_time;
438  int nb_streams; /* number of stream that ffmpeg is aware of; may be different
439  from ctx.nb_streams if new streams appear during av_read_frame() */
440  int nb_streams_warn; /* number of streams that the user was warned of */
441  int rate_emu;
443 
444 #if HAVE_THREADS
445  AVThreadMessageQueue *in_thread_queue;
446  pthread_t thread; /* thread reading from this file */
447  int non_blocking; /* reading packets from the thread should not block */
448  int joined; /* the thread has been joined */
449  int thread_queue_size; /* maximum number of queued packets */
450 #endif
452 
459  FKF_NB
460 };
461 
462 #define ABORT_ON_FLAG_EMPTY_OUTPUT (1 << 0)
463 #define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM (1 << 1)
464 
465 extern const char *const forced_keyframes_const_names[];
466 
467 typedef enum {
470 } OSTFinished ;
471 
472 typedef struct OutputStream {
473  int file_index; /* file index */
474  int index; /* stream index in the output file */
475  int source_index; /* InputStream index */
476  AVStream *st; /* stream in the output file */
477  int encoding_needed; /* true if encoding needed for this stream */
479  /* input pts and corresponding output pts
480  for A/V sync */
481  struct InputStream *sync_ist; /* input stream to sync against */
482  int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ // FIXME look at frame_number
483  /* pts of the first frame encoded for this stream, used for limiting
484  * recording time */
485  int64_t first_pts;
486  /* dts of the last packet sent to the muxer */
487  int64_t last_mux_dts;
488  // the timebase of the packets sent to the muxer
489  AVRational mux_timebase;
490  AVRational enc_timebase;
491 
492  AVBSFContext *bsf_ctx;
493 
494  AVCodecContext *enc_ctx;
495  AVCodecParameters *ref_par; /* associated input codec parameters with encoders options applied */
496  AVCodec *enc;
497  int64_t max_frames;
498  AVFrame *filtered_frame;
499  AVFrame *last_frame;
502 
503  void *hwaccel_ctx;
504 
505  /* video only */
506  AVRational frame_rate;
507  AVRational max_frame_rate;
508  int is_cfr;
514 
515  AVRational frame_aspect_ratio;
516 
517  /* forced key frames */
519  int64_t *forced_kf_pts;
525 
526  /* audio only */
527  int *audio_channels_map; /* list of the channels id to pick from the source stream */
528  int audio_channels_mapped; /* number of channels in audio_channels_map */
529 
531  FILE *logfile;
532 
534  char *avfilter;
535  char *filters;
537 
538  AVDictionary *encoder_opts;
539  AVDictionary *sws_dict;
540  AVDictionary *swr_opts;
541  AVDictionary *resample_opts;
542  char *apad;
543  OSTFinished finished; /* no more packets should be written for this stream */
544  int unavailable; /* true if the steram is unavailable (possibly temporarily) */
546 
547  // init_output_stream() has been called for this stream
548  // The encoder and the bitstream filters have been initialized and the stream
549  // parameters are set in the AVStream.
551 
553 
554  const char *attachment_filename;
557  char *disposition;
558 
560 
561  /* stats */
562  // combined size of all the packets written
563  uint64_t data_size;
564  // number of packets send to the muxer
565  uint64_t packets_written;
566  // number of frames/samples sent to the encoder
567  uint64_t frames_encoded;
568  uint64_t samples_encoded;
569 
570  /* packet quality factor */
571  int quality;
572 
574 
575  /* the packets are buffered here until the muxer is ready to be initialized */
576  AVFifoBuffer *muxing_queue;
577 
578  /*
579  * The size of the AVPackets' buffers in queue.
580  * Updated when a packet is either pushed or pulled from the queue.
581  */
583 
584  /* Threshold after which max_muxing_queue_size will be in effect */
586 
587  /* packet picture type */
589 
590  /* frame encode sum of squared error values */
591  int64_t error[4];
593 
594 typedef struct OutputFile {
595  AVFormatContext *ctx;
596  AVDictionary *opts;
597  int ost_index; /* index of the first stream in output_streams */
598  int64_t recording_time;
599  int64_t start_time;
600  uint64_t limit_filesize; /* filesize limit expressed in bytes */
601 
602  int shortest;
603 
606 
607 extern __thread InputStream **input_streams;
608 extern __thread int nb_input_streams;
609 extern __thread InputFile **input_files;
610 extern __thread int nb_input_files;
611 
612 extern __thread OutputStream **output_streams;
613 extern __thread int nb_output_streams;
614 extern __thread OutputFile **output_files;
615 extern __thread int nb_output_files;
616 
617 extern __thread FilterGraph **filtergraphs;
618 extern __thread int nb_filtergraphs;
619 
620 extern __thread char *vstats_filename;
621 extern __thread char *sdp_filename;
622 
623 extern __thread float audio_drift_threshold;
624 extern __thread float dts_delta_threshold;
625 extern __thread float dts_error_threshold;
626 
627 extern __thread int audio_volume;
628 extern __thread int audio_sync_method;
629 extern __thread int video_sync_method;
630 extern __thread float frame_drop_threshold;
631 extern __thread int do_benchmark;
632 extern __thread int do_benchmark_all;
633 extern __thread int do_deinterlace;
634 extern __thread int do_hex_dump;
635 extern __thread int do_pkt_dump;
636 extern __thread int copy_ts;
637 extern __thread int start_at_zero;
638 extern __thread int copy_tb;
639 extern __thread int debug_ts;
640 extern __thread int exit_on_error;
641 extern __thread int abort_on_flags;
642 extern __thread int print_stats;
643 extern __thread int64_t stats_period;
644 extern __thread int qp_hist;
645 extern __thread int stdin_interaction;
646 extern __thread int frame_bits_per_raw_sample;
647 extern __thread AVIOContext *progress_avio;
648 extern __thread float max_error_rate;
649 extern __thread char *videotoolbox_pixfmt;
650 
651 extern __thread int filter_nbthreads;
652 extern __thread int filter_complex_nbthreads;
653 extern __thread int vstats_version;
654 extern __thread int auto_conversion_filters;
655 
656 extern __thread const AVIOInterruptCB int_cb;
657 
658 extern const HWAccel hwaccels[];
659 #if CONFIG_QSV
660 extern __thread char *qsv_device;
661 #endif
662 extern __thread HWDevice *filter_hw_device;
663 
664 void term_init(void);
665 void term_exit(void);
666 
667 void reset_options(OptionsContext *o, int is_input);
668 void show_usage(void);
669 
670 void opt_output_file(void *optctx, const char *filename);
671 
672 void remove_avoptions(AVDictionary **a, AVDictionary *b);
673 void assert_avoptions(AVDictionary *m);
674 
676 
677 enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *avctx, const AVCodec *codec, enum AVPixelFormat target);
678 void choose_sample_fmt(AVStream *st, const AVCodec *codec);
679 
681 int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out);
682 void check_filter_outputs(void);
687 
688 void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub);
689 
690 int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame);
691 
692 int ffmpeg_parse_options(int argc, char **argv);
693 
694 int videotoolbox_init(AVCodecContext *s);
695 int qsv_init(AVCodecContext *s);
696 
697 HWDevice *hw_device_get_by_name(const char *name);
698 int hw_device_init_from_string(const char *arg, HWDevice **dev);
699 void hw_device_free_all(void);
700 
704 
705 int hwaccel_decode_init(AVCodecContext *avctx);
706 
707 void set_report_callback(void (*callback)(int, float, float, int64_t, int, double, double));
708 
709 void cancel_operation(long id);
710 
711 int opt_map(void *optctx, const char *opt, const char *arg);
712 int opt_map_channel(void *optctx, const char *opt, const char *arg);
713 int opt_recording_timestamp(void *optctx, const char *opt, const char *arg);
714 int opt_data_frames(void *optctx, const char *opt, const char *arg);
715 int opt_progress(void *optctx, const char *opt, const char *arg);
716 int opt_target(void *optctx, const char *opt, const char *arg);
717 int opt_vsync(void *optctx, const char *opt, const char *arg);
718 int opt_abort_on(void *optctx, const char *opt, const char *arg);
719 int opt_stats_period(void *optctx, const char *opt, const char *arg);
720 int opt_qscale(void *optctx, const char *opt, const char *arg);
721 int opt_profile(void *optctx, const char *opt, const char *arg);
722 int opt_filter_complex(void *optctx, const char *opt, const char *arg);
723 int opt_filter_complex_script(void *optctx, const char *opt, const char *arg);
724 int opt_attach(void *optctx, const char *opt, const char *arg);
725 int opt_video_frames(void *optctx, const char *opt, const char *arg);
726 int opt_video_codec(void *optctx, const char *opt, const char *arg);
727 int opt_sameq(void *optctx, const char *opt, const char *arg);
728 int opt_timecode(void *optctx, const char *opt, const char *arg);
729 
730 int opt_vstats_file(void *optctx, const char *opt, const char *arg);
731 int opt_vstats(void *optctx, const char *opt, const char *arg);
732 int opt_video_frames(void *optctx, const char *opt, const char *arg);
733 int opt_old2new(void *optctx, const char *opt, const char *arg);
734 int opt_streamid(void *optctx, const char *opt, const char *arg);
735 int opt_bitrate(void *optctx, const char *opt, const char *arg);
736 int show_hwaccels(void *optctx, const char *opt, const char *arg);
737 int opt_video_filters(void *optctx, const char *opt, const char *arg);
738 int opt_audio_frames(void *optctx, const char *opt, const char *arg);
739 int opt_audio_qscale(void *optctx, const char *opt, const char *arg);
740 int opt_audio_codec(void *optctx, const char *opt, const char *arg);
741 int opt_channel_layout(void *optctx, const char *opt, const char *arg);
742 int opt_preset(void *optctx, const char *opt, const char *arg);
743 int opt_audio_filters(void *optctx, const char *opt, const char *arg);
744 int opt_subtitle_codec(void *optctx, const char *opt, const char *arg);
745 int opt_video_channel(void *optctx, const char *opt, const char *arg);
746 int opt_video_standard(void *optctx, const char *opt, const char *arg);
747 int opt_sdp_file(void *optctx, const char *opt, const char *arg);
748 int opt_data_codec(void *optctx, const char *opt, const char *arg);
749 int opt_init_hw_device(void *optctx, const char *opt, const char *arg);
750 int opt_filter_hw_device(void *optctx, const char *opt, const char *arg);
751 void add_input_streams(OptionsContext *o, AVFormatContext *ic);
752 void assert_file_overwrite(const char *filename);
753 void dump_attachment(AVStream *st, const char *filename);
754 uint8_t *get_line(AVIOContext *s);
757 AVDictionary *strip_specifiers(AVDictionary *dict);
758 void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec);
759 int fftools_copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o);
760 AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder);
761 AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *st);
762 int open_input_file(OptionsContext *o, const char *filename);
763 int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s);
764 int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost);
765 OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type, int source_index);
766 void parse_matrix_coeffs(uint16_t *dest, const char *str);
767 uint8_t *fftools_read_file(const char *filename);
768 char *get_ost_filters(OptionsContext *o, AVFormatContext *oc, OutputStream *ost);
769 void check_streamcopy_filters(OptionsContext *o, AVFormatContext *oc, const OutputStream *ost, enum AVMediaType type);
770 OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
771 OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
772 OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
773 OutputStream *new_unknown_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
774 OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
775 OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
776 int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata);
777 void init_output_filter(OutputFilter *ofilter, OptionsContext *o, AVFormatContext *oc);
778 int init_complex_filters(void);
779 int open_output_file(OptionsContext *o, const char *filename);
780 int opt_default_new(OptionsContext *o, const char *opt, const char *arg);
781 int open_files(OptionGroupList *l, const char *inout, int (*open_file)(OptionsContext*, const char*));
782 
783 #endif /* FFTOOLS_FFMPEG_H */
__thread float dts_delta_threshold
int hw_device_setup_for_encode(OutputStream *ost)
int opt_channel_layout(void *optctx, const char *opt, const char *arg)
void uninit_options(OptionsContext *o)
int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost)
int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
struct InputFile InputFile
__thread int copy_tb
HWAccelID
@ HWACCEL_NONE
@ HWACCEL_QSV
@ HWACCEL_GENERIC
@ HWACCEL_AUTO
@ HWACCEL_VIDEOTOOLBOX
int opt_sdp_file(void *optctx, const char *opt, const char *arg)
OutputStream * new_attachment_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
__thread int frame_bits_per_raw_sample
int opt_timecode(void *optctx, const char *opt, const char *arg)
int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame)
int opt_vstats_file(void *optctx, const char *opt, const char *arg)
__thread InputStream ** input_streams
void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
OutputStream * new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
__thread const AVIOInterruptCB int_cb
void reset_options(OptionsContext *o, int is_input)
__thread int64_t stats_period
int opt_data_codec(void *optctx, const char *opt, const char *arg)
int opt_streamid(void *optctx, const char *opt, const char *arg)
__thread int nb_input_streams
void term_exit(void)
const char *const forced_keyframes_const_names[]
int opt_qscale(void *optctx, const char *opt, const char *arg)
int opt_sameq(void *optctx, const char *opt, const char *arg)
__thread OutputStream ** output_streams
OutputStream * new_subtitle_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
__thread OutputFile ** output_files
int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
__thread char * sdp_filename
int opt_filter_complex(void *optctx, const char *opt, const char *arg)
int videotoolbox_init(AVCodecContext *s)
int opt_vsync(void *optctx, const char *opt, const char *arg)
uint8_t * fftools_read_file(const char *filename)
__thread int nb_output_streams
int guess_input_channel_layout(InputStream *ist)
void opt_output_file(void *optctx, const char *filename)
__thread int print_stats
__thread int video_sync_method
__thread int filter_complex_nbthreads
__thread int abort_on_flags
__thread int nb_input_files
__thread int audio_volume
__thread float max_error_rate
__thread int nb_output_files
__thread int copy_ts
__thread int stdin_interaction
int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
__thread float dts_error_threshold
int opt_video_standard(void *optctx, const char *opt, const char *arg)
void set_report_callback(void(*callback)(int, float, float, int64_t, int, double, double))
int hwaccel_decode_init(AVCodecContext *avctx)
int open_input_file(OptionsContext *o, const char *filename)
int opt_profile(void *optctx, const char *opt, const char *arg)
OSTFinished
@ ENCODER_FINISHED
@ MUXER_FINISHED
char * get_ost_filters(OptionsContext *o, AVFormatContext *oc, OutputStream *ost)
AVCodec * find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
__thread int filter_nbthreads
int opt_abort_on(void *optctx, const char *opt, const char *arg)
void show_usage(void)
enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *avctx, const AVCodec *codec, enum AVPixelFormat target)
int opt_video_codec(void *optctx, const char *opt, const char *arg)
struct OutputFile OutputFile
int opt_data_frames(void *optctx, const char *opt, const char *arg)
uint8_t * get_line(AVIOContext *s)
int opt_video_filters(void *optctx, const char *opt, const char *arg)
struct FilterGraph FilterGraph
int opt_attach(void *optctx, const char *opt, const char *arg)
__thread int do_benchmark
int opt_filter_hw_device(void *optctx, const char *opt, const char *arg)
__thread float frame_drop_threshold
__thread int vstats_version
__thread char * vstats_filename
__thread int do_deinterlace
int opt_audio_frames(void *optctx, const char *opt, const char *arg)
int hw_device_setup_for_decode(InputStream *ist)
void hw_device_free_all(void)
int opt_target(void *optctx, const char *opt, const char *arg)
void check_streamcopy_filters(OptionsContext *o, AVFormatContext *oc, const OutputStream *ost, enum AVMediaType type)
__thread int audio_sync_method
int init_complex_filters(void)
int hw_device_setup_for_filter(FilterGraph *fg)
OutputStream * new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type, int source_index)
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
int opt_map(void *optctx, const char *opt, const char *arg)
__thread float audio_drift_threshold
void cancel_operation(long id)
__thread AVIOContext * progress_avio
__thread InputFile ** input_files
void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub)
struct OutputStream OutputStream
__thread int do_benchmark_all
int opt_vstats(void *optctx, const char *opt, const char *arg)
AVCodec * choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *st)
int opt_video_channel(void *optctx, const char *opt, const char *arg)
__thread FilterGraph ** filtergraphs
int ist_in_filtergraph(FilterGraph *fg, InputStream *ist)
__thread int start_at_zero
void parse_matrix_coeffs(uint16_t *dest, const char *str)
int open_files(OptionGroupList *l, const char *inout, int(*open_file)(OptionsContext *, const char *))
int opt_video_frames(void *optctx, const char *opt, const char *arg)
void assert_file_overwrite(const char *filename)
struct InputFilter InputFilter
int opt_audio_filters(void *optctx, const char *opt, const char *arg)
forced_keyframes_const
@ FKF_NB
@ FKF_PREV_FORCED_N
@ FKF_T
@ FKF_PREV_FORCED_T
@ FKF_N_FORCED
@ FKF_N
__thread int exit_on_error
void remove_avoptions(AVDictionary **a, AVDictionary *b)
void choose_sample_fmt(AVStream *st, const AVCodec *codec)
int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s)
int ffmpeg_parse_options(int argc, char **argv)
void init_output_filter(OutputFilter *ofilter, OptionsContext *o, AVFormatContext *oc)
OutputStream * new_data_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
struct StreamMap StreamMap
AVDictionary * strip_specifiers(AVDictionary *dict)
int show_hwaccels(void *optctx, const char *opt, const char *arg)
__thread HWDevice * filter_hw_device
int opt_preset(void *optctx, const char *opt, const char *arg)
int qsv_init(AVCodecContext *s)
struct OutputFilter OutputFilter
int opt_old2new(void *optctx, const char *opt, const char *arg)
__thread int nb_filtergraphs
void term_init(void)
int opt_stats_period(void *optctx, const char *opt, const char *arg)
void add_input_streams(OptionsContext *o, AVFormatContext *ic)
__thread int qp_hist
struct OptionsContext OptionsContext
int opt_bitrate(void *optctx, const char *opt, const char *arg)
int filtergraph_is_simple(FilterGraph *fg)
int hw_device_init_from_string(const char *arg, HWDevice **dev)
OutputStream * new_unknown_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
void check_filter_outputs(void)
int fftools_copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
struct HWAccel HWAccel
int opt_default_new(OptionsContext *o, const char *opt, const char *arg)
OutputStream * new_video_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
struct HWDevice HWDevice
int configure_filtergraph(FilterGraph *fg)
__thread int do_hex_dump
__thread int do_pkt_dump
const HWAccel hwaccels[]
HWDevice * hw_device_get_by_name(const char *name)
void dump_attachment(AVStream *st, const char *filename)
void init_options(OptionsContext *o)
__thread int debug_ts
int opt_map_channel(void *optctx, const char *opt, const char *arg)
int opt_progress(void *optctx, const char *opt, const char *arg)
__thread char * videotoolbox_pixfmt
int open_output_file(OptionsContext *o, const char *filename)
int opt_audio_codec(void *optctx, const char *opt, const char *arg)
int opt_recording_timestamp(void *optctx, const char *opt, const char *arg)
__thread int auto_conversion_filters
void assert_avoptions(AVDictionary *m)
struct InputStream InputStream
int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
int init_complex_filtergraph(FilterGraph *fg)
OutputFilter ** outputs
const char * graph_desc
AVFilterGraph * graph
InputFilter ** inputs
enum HWAccelID id
enum AVPixelFormat pix_fmt
int(* init)(AVCodecContext *s)
const char * name
AVBufferRef * device_ref
enum AVHWDeviceType type
const char * name
int64_t ts_offset
int64_t duration
AVFormatContext * ctx
int64_t input_ts_offset
int seek_timestamp
int64_t recording_time
AVRational time_base
int nb_streams_warn
int64_t last_ts
int64_t start_time
AVBufferRef * hw_frames_ctx
uint8_t * name
struct InputStream * ist
AVFilterContext * filter
enum AVMediaType type
AVFifoBuffer * frame_queue
uint64_t channel_layout
struct FilterGraph * graph
AVRational sample_aspect_ratio
unsigned int initialize
marks if sub2video_update should force an initialization
AVFifoBuffer * sub_queue
queue of AVSubtitle* before filter init
enum AVPixelFormat hwaccel_pix_fmt
AVFrame * decoded_frame
int64_t * dts_buffer
int64_t dts
dts of the last packet read for this stream (in AV_TIME_BASE units)
enum AVPixelFormat hwaccel_output_format
int64_t cfr_next_pts
void(* hwaccel_uninit)(AVCodecContext *s)
AVCodecContext * dec_ctx
int64_t pts
current pts of the decoded frame (in AV_TIME_BASE units)
AVBufferRef * hw_frames_ctx
AVCodec * dec
struct InputStream::@2 prev_sub
enum HWAccelID hwaccel_id
uint64_t data_size
int(* hwaccel_get_buffer)(AVCodecContext *s, AVFrame *frame, int flags)
int64_t filter_in_rescale_delta_last
int64_t next_dts
int wrap_correction_done
int64_t max_pts
enum AVPixelFormat hwaccel_retrieved_pix_fmt
AVFrame * filter_frame
void * hwaccel_ctx
uint64_t samples_decoded
int64_t next_pts
synthetic pts for the next decode frame (in AV_TIME_BASE units)
uint64_t frames_decoded
struct InputStream::sub2video sub2video
AVStream * st
InputFilter ** filters
int(* hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame)
uint64_t nb_packets
AVSubtitle subtitle
char * hwaccel_device
AVDictionary * decoder_opts
int64_t min_pts
enum AVHWDeviceType hwaccel_device_type
int64_t nb_samples
AVRational framerate
SpecifierOpt * metadata_map
int nb_copy_initial_nonkeyframes
SpecifierOpt * frame_pix_fmts
SpecifierOpt * dump_attachment
SpecifierOpt * autoscale
int nb_chroma_intra_matrices
int nb_muxing_queue_data_threshold
SpecifierOpt * frame_aspect_ratios
SpecifierOpt * pass
SpecifierOpt * filter_scripts
SpecifierOpt * copy_initial_nonkeyframes
SpecifierOpt * guess_layout_max
const char * format
SpecifierOpt * enc_time_bases
SpecifierOpt * max_frame_rates
int64_t input_ts_offset
SpecifierOpt * audio_sample_rate
SpecifierOpt * max_frames
StreamMap * stream_maps
SpecifierOpt * frame_sizes
SpecifierOpt * muxing_queue_data_threshold
SpecifierOpt * discard
SpecifierOpt * forced_key_frames
SpecifierOpt * hwaccel_devices
SpecifierOpt * filters
SpecifierOpt * metadata
SpecifierOpt * autorotate
int64_t recording_time
SpecifierOpt * disposition
uint64_t limit_filesize
SpecifierOpt * sample_fmts
SpecifierOpt * audio_channels
SpecifierOpt * codec_names
int64_t start_time_eof
SpecifierOpt * canvas_sizes
SpecifierOpt * reinit_filters
SpecifierOpt * passlogfiles
SpecifierOpt * frame_rates
SpecifierOpt * intra_matrices
SpecifierOpt * apad
SpecifierOpt * chroma_intra_matrices
int nb_hwaccel_output_formats
SpecifierOpt * top_field_first
int metadata_chapters_manual
SpecifierOpt * force_fps
SpecifierOpt * qscale
SpecifierOpt * copy_prior_start
SpecifierOpt * max_muxing_queue_size
SpecifierOpt * rc_overrides
const char ** attachments
SpecifierOpt * hwaccels
SpecifierOpt * program
SpecifierOpt * codec_tags
SpecifierOpt * time_bases
SpecifierOpt * presets
SpecifierOpt * ts_scale
SpecifierOpt * fix_sub_duration
SpecifierOpt * inter_matrices
SpecifierOpt * hwaccel_output_formats
SpecifierOpt * bitstream_filters
int nb_max_muxing_queue_size
AudioChannelMap * audio_channel_maps
OptionGroup * g
uint64_t limit_filesize
AVFormatContext * ctx
int64_t start_time
start time in microseconds == AV_TIME_BASE units
AVDictionary * opts
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
AVFilterInOut * out_tmp
struct OutputStream * ost
uint64_t * channel_layouts
AVFilterContext * filter
uint8_t * name
struct FilterGraph * graph
AVRational frame_rate
uint64_t channel_layout
enum AVMediaType type
int max_muxing_queue_size
AVDictionary * swr_opts
int copy_initial_nonkeyframes
int64_t last_mux_dts
AVRational mux_timebase
double forced_keyframes_expr_const_values[FKF_NB]
OSTFinished finished
int * audio_channels_map
AVRational frame_aspect_ratio
double rotate_override_value
AVFrame * last_frame
int audio_channels_mapped
int64_t sync_opts
int64_t * forced_kf_pts
int64_t error[4]
uint64_t packets_written
uint64_t frames_encoded
int64_t max_frames
size_t muxing_queue_data_threshold
AVDictionary * resample_opts
AVRational max_frame_rate
AVRational enc_timebase
AVFifoBuffer * muxing_queue
AVCodecParameters * ref_par
char * forced_keyframes
AVFrame * filtered_frame
const char * attachment_filename
AVRational frame_rate
AVCodecContext * enc_ctx
struct InputStream * sync_ist
AVDictionary * encoder_opts
uint64_t data_size
AVStream * st
char * filters
filtergraph associated to the -filter option
int64_t forced_kf_ref_pts
uint64_t samples_encoded
char * filters_script
filtergraph script associated to the -filter_script option
AVBSFContext * bsf_ctx
int64_t first_pts
AVCodec * enc
void * hwaccel_ctx
AVDictionary * sws_dict
OutputFilter * filter
char * disposition
AVExpr * forced_keyframes_pexpr
size_t muxing_queue_data_size
int last_nb0_frames[3]
char * logfile_prefix
int sync_stream_index
char * linklabel
int sync_file_index