ffmpeg.c File Reference

multimedia converter based on the FFmpeg libraries More...

#include "config.h"
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <limits.h>
#include <unistd.h>
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
#include "libswresample/swresample.h"
#include "libavutil/opt.h"
#include "libavutil/audioconvert.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/colorspace.h"
#include "libavutil/fifo.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avstring.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
#include "libavutil/timestamp.h"
#include "libavutil/bprint.h"
#include "libavformat/os_support.h"
#include "libavformat/ffm.h"
#include "libavfilter/avcodec.h"
#include "libavfilter/avfilter.h"
#include "libavfilter/avfiltergraph.h"
#include "libavfilter/buffersrc.h"
#include "libavfilter/buffersink.h"
#include <time.h>
#include "cmdutils.h"
#include "libavutil/avassert.h"
#include "cmdutils_common_opts.h"

Go to the source code of this file.

Data Structures

struct  StreamMap
struct  AudioChannelMap
struct  InputFilter
struct  OutputFilter
struct  FilterGraph
struct  FrameBuffer
struct  InputStream
struct  InputFile
struct  OutputStream
struct  OutputFile
struct  OptionsContext

Defines

#define VSYNC_AUTO   -1
#define VSYNC_PASSTHROUGH   0
#define VSYNC_CFR   1
#define VSYNC_VFR   2
#define VSYNC_DROP   0xff
#define SINKA
#define MAX_STREAMS   1024
#define DEFAULT_PASS_LOGFILENAME_PREFIX   "ffmpeg2pass"
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)
#define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name, separator)
 Define a function for building a string containing a list of allowed formats,.
#define GET_PIX_FMT_NAME(pix_fmt)   const char *name = av_get_pix_fmt_name(pix_fmt);
#define GET_SAMPLE_FMT_NAME(sample_fmt)   const char *name = av_get_sample_fmt_name(sample_fmt)
#define GET_SAMPLE_RATE_NAME(rate)
#define GET_CH_LAYOUT_NAME(ch_layout)
#define AUTO_INSERT_FILTER(opt_name, filter_name, arg)
#define METADATA_CHECK_INDEX(index, nb_elems, desc)
#define SET_DICT(type, meta, context, index)
#define OFFSET(x)   offsetof(OptionsContext, x)

Functions

static void do_video_stats (AVFormatContext *os, OutputStream *ost, int frame_size)
static int64_t getutime (void)
static void update_benchmark (const char *fmt,...)
static void reset_options (OptionsContext *o, int is_input)
static int alloc_buffer (InputStream *ist, AVCodecContext *s, FrameBuffer **pbuf)
static void free_buffer_pool (InputStream *ist)
static void unref_buffer (InputStream *ist, FrameBuffer *buf)
static int codec_get_buffer (AVCodecContext *s, AVFrame *frame)
static void codec_release_buffer (AVCodecContext *s, AVFrame *frame)
static void filter_release_buffer (AVFilterBuffer *fb)
static enum PixelFormat choose_pixel_fmt (AVStream *st, AVCodec *codec, enum PixelFormat target)
static char * choose_pix_fmts (OutputStream *ost)
 DEF_CHOOSE_FORMAT (enum AVSampleFormat, sample_fmt, sample_fmts, AV_SAMPLE_FMT_NONE, GET_SAMPLE_FMT_NAME,",") DEF_CHOOSE_FORMAT(int
 DEF_CHOOSE_FORMAT (uint64_t, channel_layout, channel_layouts, 0, GET_CH_LAYOUT_NAME,", ")
static int configure_video_filters (FilterGraph *fg, AVFilterContext **in_filter, AVFilterContext **out_filter)
static int configure_simple_filtergraph (FilterGraph *fg)
static FilterGraphinit_simple_filtergraph (InputStream *ist, OutputStream *ost)
static void init_input_filter (FilterGraph *fg, AVFilterInOut *in)
static int configure_output_video_filter (FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
static int configure_output_audio_filter (FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
static int configure_output_filter (FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
static int configure_complex_filter (FilterGraph *fg)
static int configure_complex_filters (void)
static int configure_filtergraph (FilterGraph *fg)
static int ist_in_filtergraph (FilterGraph *fg, InputStream *ist)
static void term_exit (void)
static void sigterm_handler (int sig)
static void term_init (void)
static int read_key (void)
static int decode_interrupt_cb (void *ctx)
void av_noreturn exit_program (int ret)
 Do all the necessary cleanup and abort.
static void assert_avoptions (AVDictionary *m)
static void assert_codec_experimental (AVCodecContext *c, int encoder)
static void choose_sample_fmt (AVStream *st, AVCodec *codec)
static void write_frame (AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
static int check_recording_time (OutputStream *ost)
static void do_audio_out (AVFormatContext *s, OutputStream *ost, AVFrame *frame)
static void pre_process_video_frame (InputStream *ist, AVPicture *picture, void **bufp)
static void do_subtitle_out (AVFormatContext *s, OutputStream *ost, InputStream *ist, AVSubtitle *sub, int64_t pts)
static void do_video_out (AVFormatContext *s, OutputStream *ost, AVFrame *in_picture, float quality)
static double psnr (double d)
static int poll_filters (void)
static void print_report (int is_last_report, int64_t timer_start, int64_t cur_time)
static void flush_encoders (void)
static int check_output_constraints (InputStream *ist, OutputStream *ost)
static void do_streamcopy (InputStream *ist, OutputStream *ost, const AVPacket *pkt)
static void rate_emu_sleep (InputStream *ist)
static int guess_input_channel_layout (InputStream *ist)
static int decode_audio (InputStream *ist, AVPacket *pkt, int *got_output)
static int decode_video (InputStream *ist, AVPacket *pkt, int *got_output)
static int transcode_subtitles (InputStream *ist, AVPacket *pkt, int *got_output)
static int output_packet (InputStream *ist, const AVPacket *pkt)
static void print_sdp (void)
static int init_input_stream (int ist_index, char *error, int error_len)
static InputStreamget_input_stream (OutputStream *ost)
static int transcode_init (void)
static int transcode (void)
static int opt_frame_crop (const char *opt, const char *arg)
static int opt_pad (const char *opt, const char *arg)
static int opt_video_channel (const char *opt, const char *arg)
static int opt_video_standard (const char *opt, const char *arg)
static int opt_audio_codec (OptionsContext *o, const char *opt, const char *arg)
static int opt_video_codec (OptionsContext *o, const char *opt, const char *arg)
static int opt_subtitle_codec (OptionsContext *o, const char *opt, const char *arg)
static int opt_data_codec (OptionsContext *o, const char *opt, const char *arg)
static int opt_map (OptionsContext *o, const char *opt, const char *arg)
static int opt_attach (OptionsContext *o, const char *opt, const char *arg)
static int opt_map_channel (OptionsContext *o, const char *opt, const char *arg)
static void parse_meta_type (char *arg, char *type, int *index, const char **stream_spec)
 Parse a metadata specifier in arg.
static int copy_metadata (char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
static int opt_recording_timestamp (OptionsContext *o, const char *opt, const char *arg)
static AVCodecfind_codec_or_die (const char *name, enum AVMediaType type, int encoder)
static AVCodecchoose_decoder (OptionsContext *o, AVFormatContext *s, AVStream *st)
static void add_input_streams (OptionsContext *o, AVFormatContext *ic)
 Add all the streams from the given input file to the global list of input streams.
static void assert_file_overwrite (const char *filename)
static void dump_attachment (AVStream *st, const char *filename)
static int opt_input_file (OptionsContext *o, const char *opt, const char *filename)
static void parse_forced_key_frames (char *kf, OutputStream *ost)
static uint8_tget_line (AVIOContext *s)
static int get_preset_file_2 (const char *preset_name, const char *codec_name, AVIOContext **s)
static void choose_encoder (OptionsContext *o, AVFormatContext *s, OutputStream *ost)
static OutputStreamnew_output_stream (OptionsContext *o, AVFormatContext *oc, enum AVMediaType type, int source_index)
static void parse_matrix_coeffs (uint16_t *dest, const char *str)
static OutputStreamnew_video_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static OutputStreamnew_audio_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static OutputStreamnew_data_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static OutputStreamnew_attachment_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static OutputStreamnew_subtitle_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static int opt_streamid (OptionsContext *o, const char *opt, const char *arg)
static int copy_chapters (InputFile *ifile, OutputFile *ofile, int copy_metadata)
static int read_ffserver_streams (OptionsContext *o, AVFormatContext *s, const char *filename)
static void init_output_filter (OutputFilter *ofilter, OptionsContext *o, AVFormatContext *oc)
static void opt_output_file (void *optctx, const char *filename)
static int opt_pass (const char *opt, const char *arg)
static int64_t getmaxrss (void)
static int opt_audio_qscale (OptionsContext *o, const char *opt, const char *arg)
static void show_usage (void)
static int opt_help (const char *opt, const char *arg)
static int opt_target (OptionsContext *o, const char *opt, const char *arg)
static int opt_vstats_file (const char *opt, const char *arg)
static int opt_vstats (const char *opt, const char *arg)
static int opt_video_frames (OptionsContext *o, const char *opt, const char *arg)
static int opt_audio_frames (OptionsContext *o, const char *opt, const char *arg)
static int opt_data_frames (OptionsContext *o, const char *opt, const char *arg)
static int opt_preset (OptionsContext *o, const char *opt, const char *arg)
static void log_callback_null (void *ptr, int level, const char *fmt, va_list vl)
static int opt_passlogfile (const char *opt, const char *arg)
static int opt_old2new (OptionsContext *o, const char *opt, const char *arg)
static int opt_bitrate (OptionsContext *o, const char *opt, const char *arg)
static int opt_qscale (OptionsContext *o, const char *opt, const char *arg)
static int opt_profile (OptionsContext *o, const char *opt, const char *arg)
static int opt_video_filters (OptionsContext *o, const char *opt, const char *arg)
static int opt_audio_filters (OptionsContext *o, const char *opt, const char *arg)
static int opt_vsync (const char *opt, const char *arg)
static int opt_deinterlace (const char *opt, const char *arg)
static void parse_cpuflags (int argc, char **argv, const OptionDef *options)
static int opt_channel_layout (OptionsContext *o, const char *opt, const char *arg)
static int opt_filter_complex (const char *opt, const char *arg)
int main (int argc, char **argv)

Variables

const char program_name [] = "ffmpeg"
 program name, defined by the program for show_version().
const int program_birth_year = 2000
 program birth year, defined by the program for show_banner()
static const OptionDef options []
static int frame_bits_per_raw_sample = 0
static int video_discard = 0
static int same_quant = 0
static int do_deinterlace = 0
static int intra_dc_precision = 8
static int qp_hist = 0
static int intra_only = 0
static const char * video_codec_name = NULL
static const char * audio_codec_name = NULL
static const char * subtitle_codec_name = NULL
static int file_overwrite = 0
static int no_file_overwrite = 0
static int do_benchmark = 0
static int do_benchmark_all = 0
static int do_hex_dump = 0
static int do_pkt_dump = 0
static int do_psnr = 0
static int do_pass = 0
static const char * pass_logfilename_prefix
static int video_sync_method = VSYNC_AUTO
static int audio_sync_method = 0
static float audio_drift_threshold = 0.1
static int copy_ts = 0
static int copy_tb = -1
static int opt_shortest = 0
static char * vstats_filename
static FILE * vstats_file
static int audio_volume = 256
static int exit_on_error = 0
static int using_stdin = 0
static int run_as_daemon = 0
static volatile int received_nb_signals = 0
static int64_t video_size = 0
static int64_t audio_size = 0
static int64_t extra_size = 0
static int nb_frames_dup = 0
static int nb_frames_drop = 0
static int input_sync
static float dts_delta_threshold = 10
static float dts_error_threshold = 3600*30
static int print_stats = 1
static int debug_ts = 0
static int current_time
static InputStream ** input_streams = NULL
static int nb_input_streams = 0
static InputFile ** input_files = NULL
static int nb_input_files = 0
static OutputStream ** output_streams = NULL
static int nb_output_streams = 0
static OutputFile ** output_files = NULL
static int nb_output_files = 0
static FilterGraph ** filtergraphs
int nb_filtergraphs
 sample_rate
 supported_samplerates
 GET_SAMPLE_RATE_NAME
static volatile int received_sigterm = 0
static const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL }


Detailed Description

multimedia converter based on the FFmpeg libraries

Definition in file ffmpeg.c.


Define Documentation

#define AUTO_INSERT_FILTER ( opt_name,
filter_name,
arg   ) 

Value:

do {                 \
    AVFilterContext *filt_ctx;                                              \
                                                                            \
    av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi "            \
           "similarly to -af " filter_name "=%s.\n", arg);                  \
                                                                            \
    ret = avfilter_graph_create_filter(&filt_ctx,                           \
                                       avfilter_get_by_name(filter_name),   \
                                       filter_name, arg, NULL, fg->graph);  \
    if (ret < 0)                                                            \
        return ret;                                                         \
                                                                            \
    ret = avfilter_link(*in_filter, 0, filt_ctx, 0);                        \
    if (ret < 0)                                                            \
        return ret;                                                         \
                                                                            \
    *in_filter = filt_ctx;                                                  \
} while (0)

Referenced by DEF_CHOOSE_FORMAT().

#define DEF_CHOOSE_FORMAT ( type,
var,
supported_list,
none,
get_name,
separator   ) 

Value:

static char *choose_ ## var ## s(OutputStream *ost)                             \
{                                                                               \
    if (ost->st->codec->var != none) {                                          \
        get_name(ost->st->codec->var);                                          \
        return av_strdup(name);                                                 \
    } else if (ost->enc->supported_list) {                                      \
        const type *p;                                                          \
        AVIOContext *s = NULL;                                                  \
        uint8_t *ret;                                                           \
        int len;                                                                \
                                                                                \
        if (avio_open_dyn_buf(&s) < 0)                                          \
            exit_program(1);                                                    \
                                                                                \
        for (p = ost->enc->supported_list; *p != none; p++) {                   \
            get_name(*p);                                                       \
            avio_printf(s, "%s" separator, name);                               \
        }                                                                       \
        len = avio_close_dyn_buf(s, &ret);                                      \
        ret[len - 1] = 0;                                                       \
        return ret;                                                             \
    } else                                                                      \
        return NULL;                                                            \
}
Define a function for building a string containing a list of allowed formats,.

Definition at line 750 of file ffmpeg.c.

#define DEFAULT_PASS_LOGFILENAME_PREFIX   "ffmpeg2pass"

Definition at line 173 of file ffmpeg.c.

Referenced by transcode_init().

#define GET_CH_LAYOUT_NAME ( ch_layout   ) 

Value:

char name[16];\
    snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);

Definition at line 795 of file ffmpeg.c.

#define GET_PIX_FMT_NAME ( pix_fmt   )     const char *name = av_get_pix_fmt_name(pix_fmt);

Definition at line 776 of file ffmpeg.c.

#define GET_SAMPLE_FMT_NAME ( sample_fmt   )     const char *name = av_get_sample_fmt_name(sample_fmt)

Definition at line 782 of file ffmpeg.c.

#define GET_SAMPLE_RATE_NAME ( rate   ) 

Value:

char name[16];\
    snprintf(name, sizeof(name), "%d", rate);

#define MATCH_PER_STREAM_OPT ( name,
type,
outvar,
fmtctx,
st   ) 

Value:

{\
    int i, ret;\
    for (i = 0; i < o->nb_ ## name; i++) {\
        char *spec = o->name[i].specifier;\
        if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0)\
            outvar = o->name[i].u.type;\
        else if (ret < 0)\
            exit_program(1);\
    }\
}

Definition at line 443 of file ffmpeg.c.

Referenced by add_input_streams(), choose_decoder(), choose_encoder(), new_audio_stream(), new_output_stream(), new_subtitle_stream(), and new_video_stream().

#define MAX_STREAMS   1024

Definition at line 122 of file ffmpeg.c.

Referenced by opt_streamid().

#define METADATA_CHECK_INDEX ( index,
nb_elems,
desc   ) 

Value:

if ((index) < 0 || (index) >= (nb_elems)) {\
        av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
                (desc), (index));\
        exit_program(1);\
    }

#define OFFSET (  )     offsetof(OptionsContext, x)

Definition at line 5730 of file ffmpeg.c.

#define SET_DICT ( type,
meta,
context,
index   ) 

Value:

switch (type) {\
        case 'g':\
            meta = &context->metadata;\
            break;\
        case 'c':\
            METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
            meta = &context->chapters[index]->metadata;\
            break;\
        case 'p':\
            METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
            meta = &context->programs[index]->metadata;\
            break;\
        }\

Referenced by copy_metadata().

#define SINKA

Definition at line 100 of file ffmpeg.c.

#define VSYNC_AUTO   -1

Definition at line 94 of file ffmpeg.c.

Referenced by do_video_out(), opt_vsync(), and transcode_init().

#define VSYNC_CFR   1

Definition at line 96 of file ffmpeg.c.

Referenced by do_video_out(), opt_vsync(), and transcode_init().

#define VSYNC_DROP   0xff

Definition at line 98 of file ffmpeg.c.

Referenced by do_video_out(), opt_vsync(), and write_frame().

#define VSYNC_PASSTHROUGH   0

Definition at line 95 of file ffmpeg.c.

Referenced by do_video_out(), opt_vsync(), and transcode_init().

#define VSYNC_VFR   2

Definition at line 97 of file ffmpeg.c.

Referenced by do_video_out(), and opt_vsync().


Function Documentation

static void add_input_streams ( OptionsContext o,
AVFormatContext ic 
) [static]

Add all the streams from the given input file to the global list of input streams.

Definition at line 4117 of file ffmpeg.c.

Referenced by opt_input_file().

static int alloc_buffer ( InputStream ist,
AVCodecContext s,
FrameBuffer **  pbuf 
) [static]

static void assert_avoptions ( AVDictionary m  )  [static]

Definition at line 1624 of file ffmpeg.c.

Referenced by init_input_stream(), opt_input_file(), and transcode_init().

static void assert_codec_experimental ( AVCodecContext c,
int  encoder 
) [static]

Definition at line 1633 of file ffmpeg.c.

Referenced by init_input_stream(), and transcode_init().

static void assert_file_overwrite ( const char *  filename  )  [static]

Definition at line 4188 of file ffmpeg.c.

Referenced by dump_attachment(), and opt_output_file().

static int check_output_constraints ( InputStream ist,
OutputStream ost 
) [static]

Definition at line 2421 of file ffmpeg.c.

Referenced by output_packet(), and transcode_subtitles().

static int check_recording_time ( OutputStream ost  )  [static]

Definition at line 1735 of file ffmpeg.c.

Referenced by do_audio_out().

static AVCodec* choose_decoder ( OptionsContext o,
AVFormatContext s,
AVStream st 
) [static]

Definition at line 4100 of file ffmpeg.c.

Referenced by add_input_streams(), and opt_input_file().

static void choose_encoder ( OptionsContext o,
AVFormatContext s,
OutputStream ost 
) [static]

Definition at line 4450 of file ffmpeg.c.

Referenced by new_output_stream().

static char* choose_pix_fmts ( OutputStream ost  )  [static]

Definition at line 704 of file ffmpeg.c.

Referenced by configure_output_video_filter(), and configure_video_filters().

static enum PixelFormat choose_pixel_fmt ( AVStream st,
AVCodec codec,
enum PixelFormat  target 
) [static]

Definition at line 672 of file ffmpeg.c.

Referenced by choose_pix_fmts(), and read_ffserver_streams().

static void choose_sample_fmt ( AVStream st,
AVCodec codec 
) [static]

Definition at line 1650 of file ffmpeg.c.

Referenced by read_ffserver_streams().

static int codec_get_buffer ( AVCodecContext s,
AVFrame frame 
) [static]

Definition at line 608 of file ffmpeg.c.

Referenced by init_input_stream().

static void codec_release_buffer ( AVCodecContext s,
AVFrame frame 
) [static]

Definition at line 650 of file ffmpeg.c.

Referenced by init_input_stream().

static int configure_complex_filter ( FilterGraph fg  )  [static]

Definition at line 1326 of file ffmpeg.c.

Referenced by configure_complex_filters(), and configure_filtergraph().

static int configure_complex_filters ( void   )  [static]

Definition at line 1408 of file ffmpeg.c.

Referenced by opt_output_file().

static int configure_filtergraph ( FilterGraph fg  )  [static]

Definition at line 1419 of file ffmpeg.c.

Referenced by decode_audio(), and decode_video().

static int configure_output_audio_filter ( FilterGraph fg,
OutputFilter ofilter,
AVFilterInOut out 
) [static]

Definition at line 1228 of file ffmpeg.c.

Referenced by configure_output_filter().

static int configure_output_filter ( FilterGraph fg,
OutputFilter ofilter,
AVFilterInOut out 
) [static]

Definition at line 1317 of file ffmpeg.c.

Referenced by configure_complex_filter(), and init_output_filter().

static int configure_output_video_filter ( FilterGraph fg,
OutputFilter ofilter,
AVFilterInOut out 
) [static]

Definition at line 1166 of file ffmpeg.c.

Referenced by configure_output_filter().

static int configure_simple_filtergraph ( FilterGraph fg  )  [static]

Definition at line 1006 of file ffmpeg.c.

Referenced by configure_filtergraph(), and transcode_init().

static int configure_video_filters ( FilterGraph fg,
AVFilterContext **  in_filter,
AVFilterContext **  out_filter 
) [static]

Definition at line 928 of file ffmpeg.c.

Referenced by configure_simple_filtergraph(), and video_thread().

static int copy_chapters ( InputFile ifile,
OutputFile ofile,
int  copy_metadata 
) [static]

Definition at line 4840 of file ffmpeg.c.

Referenced by opt_output_file().

static int copy_metadata ( char *  outspec,
char *  inspec,
AVFormatContext oc,
AVFormatContext ic,
OptionsContext o 
) [static]

Definition at line 3985 of file ffmpeg.c.

Referenced by opt_output_file().

static int decode_audio ( InputStream ist,
AVPacket pkt,
int *  got_output 
) [static]

Definition at line 2530 of file ffmpeg.c.

Referenced by output_packet().

static int decode_interrupt_cb ( void *  ctx  )  [static]

Definition at line 1545 of file ffmpeg.c.

Referenced by read_thread().

static int decode_video ( InputStream ist,
AVPacket pkt,
int *  got_output 
) [static]

Definition at line 2631 of file ffmpeg.c.

Referenced by output_packet().

DEF_CHOOSE_FORMAT ( uint64_t  ,
channel_layout  ,
channel_layouts  ,
,
GET_CH_LAYOUT_NAME  ,
,
 
)

Definition at line 799 of file ffmpeg.c.

DEF_CHOOSE_FORMAT ( enum  AVSampleFormat,
sample_fmt  ,
sample_fmts  ,
AV_SAMPLE_FMT_NONE  ,
GET_SAMPLE_FMT_NAME  ,
,
 
)

static void do_audio_out ( AVFormatContext s,
OutputStream ost,
AVFrame frame 
) [static]

Definition at line 1748 of file ffmpeg.c.

Referenced by poll_filters().

static void do_streamcopy ( InputStream ist,
OutputStream ost,
const AVPacket pkt 
) [static]

Definition at line 2442 of file ffmpeg.c.

Referenced by output_packet().

static void do_subtitle_out ( AVFormatContext s,
OutputStream ost,
InputStream ist,
AVSubtitle sub,
int64_t  pts 
) [static]

Definition at line 1835 of file ffmpeg.c.

Referenced by transcode_subtitles().

static void do_video_out ( AVFormatContext s,
OutputStream ost,
AVFrame in_picture,
float  quality 
) [static]

Definition at line 1899 of file ffmpeg.c.

Referenced by poll_filters().

static void do_video_stats ( AVFormatContext os,
OutputStream ost,
int  frame_size 
) [static]

Definition at line 2062 of file ffmpeg.c.

Referenced by do_video_out().

static void dump_attachment ( AVStream st,
const char *  filename 
) [static]

Definition at line 4213 of file ffmpeg.c.

Referenced by opt_input_file().

void av_noreturn exit_program ( int  ret  ) 

Do all the necessary cleanup and abort.

This function is implemented in the avtools, not cmdutils.

Definition at line 1552 of file ffmpeg.c.

static void filter_release_buffer ( AVFilterBuffer fb  )  [static]

Definition at line 665 of file ffmpeg.c.

Referenced by decode_video().

static AVCodec* find_codec_or_die ( const char *  name,
enum AVMediaType  type,
int  encoder 
) [static]

Definition at line 4081 of file ffmpeg.c.

Referenced by choose_decoder(), choose_encoder(), and opt_input_file().

static void flush_encoders ( void   )  [static]

Definition at line 2345 of file ffmpeg.c.

Referenced by transcode().

static void free_buffer_pool ( InputStream ist  )  [static]

Definition at line 584 of file ffmpeg.c.

Referenced by exit_program().

static InputStream* get_input_stream ( OutputStream ost  )  [static]

Definition at line 2952 of file ffmpeg.c.

Referenced by transcode_init().

static uint8_t* get_line ( AVIOContext s  )  [static]

Definition at line 4405 of file ffmpeg.c.

Referenced by new_output_stream(), read_chapter(), and read_header().

static int get_preset_file_2 ( const char *  preset_name,
const char *  codec_name,
AVIOContext **  s 
) [static]

Definition at line 4424 of file ffmpeg.c.

Referenced by new_output_stream().

static int64_t getmaxrss ( void   )  [static]

Definition at line 5312 of file ffmpeg.c.

Referenced by main().

static int64_t getutime ( void   )  [static]

Definition at line 455 of file ffmpeg.c.

Referenced by main(), and update_benchmark().

static int guess_input_channel_layout ( InputStream ist  )  [static]

Definition at line 2512 of file ffmpeg.c.

Referenced by add_input_streams(), and decode_audio().

static void init_input_filter ( FilterGraph fg,
AVFilterInOut in 
) [static]

Definition at line 1096 of file ffmpeg.c.

Referenced by configure_complex_filter().

static int init_input_stream ( int  ist_index,
char *  error,
int  error_len 
) [static]

Definition at line 2915 of file ffmpeg.c.

Referenced by transcode_init().

static void init_output_filter ( OutputFilter ofilter,
OptionsContext o,
AVFormatContext oc 
) [static]

Definition at line 4920 of file ffmpeg.c.

Referenced by opt_output_file().

static FilterGraph* init_simple_filtergraph ( InputStream ist,
OutputStream ost 
) [static]

Definition at line 1063 of file ffmpeg.c.

Referenced by transcode_init().

static int ist_in_filtergraph ( FilterGraph fg,
InputStream ist 
) [static]

Definition at line 1425 of file ffmpeg.c.

Referenced by decode_audio(), and decode_video().

static void log_callback_null ( void *  ptr,
int  level,
const char *  fmt,
va_list  vl 
) [static]

Definition at line 5594 of file ffmpeg.c.

Referenced by main().

int main ( int  argc,
char **  argv 
)

Definition at line 5873 of file ffmpeg.c.

static OutputStream* new_attachment_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 4794 of file ffmpeg.c.

Referenced by opt_output_file().

static OutputStream* new_audio_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 4731 of file ffmpeg.c.

Referenced by init_output_filter(), and opt_output_file().

static OutputStream* new_data_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 4781 of file ffmpeg.c.

Referenced by opt_output_file().

static OutputStream* new_output_stream ( OptionsContext o,
AVFormatContext oc,
enum AVMediaType  type,
int  source_index 
) [static]

static OutputStream* new_subtitle_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 4801 of file ffmpeg.c.

Referenced by opt_output_file().

static OutputStream* new_video_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 4597 of file ffmpeg.c.

Referenced by init_output_filter(), and opt_output_file().

static int opt_attach ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 3884 of file ffmpeg.c.

static int opt_audio_codec ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 3765 of file ffmpeg.c.

Referenced by ffserver_opt_preset(), opt_preset(), opt_target(), and parse_ffconfig().

static int opt_audio_filters ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5653 of file ffmpeg.c.

static int opt_audio_frames ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5539 of file ffmpeg.c.

static int opt_audio_qscale ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5330 of file ffmpeg.c.

static int opt_bitrate ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5616 of file ffmpeg.c.

static int opt_channel_layout ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5684 of file ffmpeg.c.

static int opt_data_codec ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 3783 of file ffmpeg.c.

Referenced by opt_preset().

static int opt_data_frames ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5544 of file ffmpeg.c.

static int opt_deinterlace ( const char *  opt,
const char *  arg 
) [static]

Definition at line 5670 of file ffmpeg.c.

static int opt_filter_complex ( const char *  opt,
const char *  arg 
) [static]

Definition at line 5719 of file ffmpeg.c.

static int opt_frame_crop ( const char *  opt,
const char *  arg 
) [static]

Definition at line 3741 of file ffmpeg.c.

static int opt_help ( const char *  opt,
const char *  arg 
) [static]

Definition at line 5342 of file ffmpeg.c.

static int opt_input_file ( OptionsContext o,
const char *  opt,
const char *  filename 
) [static]

Definition at line 4245 of file ffmpeg.c.

Referenced by main().

static int opt_map ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 3788 of file ffmpeg.c.

static int opt_map_channel ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 3892 of file ffmpeg.c.

static int opt_old2new ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5608 of file ffmpeg.c.

static void opt_output_file ( void *  optctx,
const char *  filename 
) [static]

Definition at line 4953 of file ffmpeg.c.

Referenced by main().

static int opt_pad ( const char *  opt,
const char *  arg 
) [static]

Definition at line 3747 of file ffmpeg.c.

static int opt_pass ( const char *  opt,
const char *  arg 
) [static]

Definition at line 5306 of file ffmpeg.c.

static int opt_passlogfile ( const char *  opt,
const char *  arg 
) [static]

Definition at line 5598 of file ffmpeg.c.

static int opt_preset ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5549 of file ffmpeg.c.

static int opt_profile ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5639 of file ffmpeg.c.

static int opt_qscale ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5625 of file ffmpeg.c.

static int opt_recording_timestamp ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 4068 of file ffmpeg.c.

static int opt_streamid ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 4819 of file ffmpeg.c.

static int opt_subtitle_codec ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 3777 of file ffmpeg.c.

Referenced by opt_preset().

static int opt_target ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5378 of file ffmpeg.c.

static int opt_video_channel ( const char *  opt,
const char *  arg 
) [static]

Definition at line 3753 of file ffmpeg.c.

static int opt_video_codec ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 3771 of file ffmpeg.c.

Referenced by ffserver_opt_preset(), opt_preset(), opt_target(), and parse_ffconfig().

static int opt_video_filters ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5648 of file ffmpeg.c.

static int opt_video_frames ( OptionsContext o,
const char *  opt,
const char *  arg 
) [static]

Definition at line 5534 of file ffmpeg.c.

static int opt_video_standard ( const char *  opt,
const char *  arg 
) [static]

Definition at line 3759 of file ffmpeg.c.

static int opt_vstats ( const char *  opt,
const char *  arg 
) [static]

Definition at line 5523 of file ffmpeg.c.

static int opt_vstats_file ( const char *  opt,
const char *  arg 
) [static]

Definition at line 5516 of file ffmpeg.c.

Referenced by opt_vstats().

static int opt_vsync ( const char *  opt,
const char *  arg 
) [static]

Definition at line 5658 of file ffmpeg.c.

static int output_packet ( InputStream ist,
const AVPacket pkt 
) [static]

Definition at line 2763 of file ffmpeg.c.

Referenced by mpeg_mux_end(), mpeg_mux_write_packet(), and transcode().

static void parse_cpuflags ( int  argc,
char **  argv,
const OptionDef options 
) [static]

Definition at line 5677 of file ffmpeg.c.

Referenced by main().

static void parse_forced_key_frames ( char *  kf,
OutputStream ost 
) [static]

Definition at line 4382 of file ffmpeg.c.

Referenced by new_video_stream().

static void parse_matrix_coeffs ( uint16_t *  dest,
const char *  str 
) [static]

Definition at line 4580 of file ffmpeg.c.

Referenced by new_video_stream().

static void parse_meta_type ( char *  arg,
char *  type,
int *  index,
const char **  stream_spec 
) [static]

Parse a metadata specifier in arg.

Parameters:
type metadata type is written here -- g(lobal)/s(tream)/c(hapter)/p(rogram)
index for type c/p, chapter/program index is written here
stream_spec for type s, the stream specifier is written here

Definition at line 3958 of file ffmpeg.c.

Referenced by copy_metadata(), and opt_output_file().

static int poll_filters ( void   )  [static]

Definition at line 2100 of file ffmpeg.c.

Referenced by transcode().

static void pre_process_video_frame ( InputStream ist,
AVPicture picture,
void **  bufp 
) [static]

Definition at line 1796 of file ffmpeg.c.

Referenced by decode_video().

static void print_report ( int  is_last_report,
int64_t  timer_start,
int64_t  cur_time 
) [static]

Definition at line 2211 of file ffmpeg.c.

Referenced by transcode().

static void print_sdp ( void   )  [static]

Definition at line 2898 of file ffmpeg.c.

Referenced by transcode_init().

static double psnr ( double  d  )  [static]

Definition at line 2057 of file ffmpeg.c.

Referenced by do_video_stats(), main(), print_report(), and run_psnr().

static void rate_emu_sleep ( InputStream ist  )  [static]

Definition at line 2502 of file ffmpeg.c.

Referenced by decode_audio(), decode_video(), output_packet(), and transcode_subtitles().

static int read_ffserver_streams ( OptionsContext o,
AVFormatContext s,
const char *  filename 
) [static]

Definition at line 4880 of file ffmpeg.c.

Referenced by opt_output_file().

static int read_key ( void   )  [static]

Definition at line 1492 of file ffmpeg.c.

Referenced by transcode().

static void reset_options ( OptionsContext o,
int  is_input 
) [static]

Definition at line 490 of file ffmpeg.c.

Referenced by main(), opt_input_file(), and opt_output_file().

static void show_usage ( void   )  [static]

Definition at line 5335 of file ffmpeg.c.

Referenced by main(), and opt_help().

static void sigterm_handler ( int  sig  )  [static]

Definition at line 1445 of file ffmpeg.c.

Referenced by main(), and term_init().

static void term_exit ( void   )  [static]

Definition at line 1434 of file ffmpeg.c.

Referenced by assert_file_overwrite(), sigterm_handler(), term_init(), and transcode().

static void term_init ( void   )  [static]

Definition at line 1454 of file ffmpeg.c.

Referenced by assert_file_overwrite(), and main().

static int transcode ( void   )  [static]

Definition at line 3395 of file ffmpeg.c.

Referenced by main().

static int transcode_init ( void   )  [static]

Definition at line 2969 of file ffmpeg.c.

Referenced by transcode().

static int transcode_subtitles ( InputStream ist,
AVPacket pkt,
int *  got_output 
) [static]

Definition at line 2737 of file ffmpeg.c.

Referenced by output_packet().

static void unref_buffer ( InputStream ist,
FrameBuffer buf 
) [static]

Definition at line 595 of file ffmpeg.c.

Referenced by codec_release_buffer(), and filter_release_buffer().

static void update_benchmark ( const char *  fmt,
  ... 
) [static]

Definition at line 473 of file ffmpeg.c.

Referenced by decode_audio(), decode_video(), do_audio_out(), do_video_out(), and flush_encoders().

static void write_frame ( AVFormatContext s,
AVPacket pkt,
OutputStream ost 
) [static]


Variable Documentation

const char* audio_codec_name = NULL [static]

float audio_drift_threshold = 0.1 [static]

Definition at line 146 of file ffmpeg.c.

Referenced by configure_output_audio_filter(), and DEF_CHOOSE_FORMAT().

int64_t audio_size = 0 [static]

int audio_sync_method = 0 [static]

int audio_volume = 256 [static]

Definition at line 153 of file ffmpeg.c.

Referenced by DEF_CHOOSE_FORMAT(), and transcode_init().

int copy_tb = -1 [static]

Definition at line 148 of file ffmpeg.c.

Referenced by transcode_init().

int copy_ts = 0 [static]

Definition at line 147 of file ffmpeg.c.

Referenced by opt_input_file(), and transcode().

int current_time [static]

Definition at line 171 of file ffmpeg.c.

Referenced by main(), and update_benchmark().

int debug_ts = 0 [static]

Definition at line 170 of file ffmpeg.c.

Referenced by do_audio_out(), do_video_out(), and transcode().

int do_benchmark = 0 [static]

Definition at line 137 of file ffmpeg.c.

Referenced by main().

int do_benchmark_all = 0 [static]

Definition at line 138 of file ffmpeg.c.

Referenced by update_benchmark().

int do_deinterlace = 0 [static]

Definition at line 127 of file ffmpeg.c.

Referenced by init_input_stream(), opt_deinterlace(), and pre_process_video_frame().

int do_hex_dump = 0 [static]

Definition at line 139 of file ffmpeg.c.

Referenced by transcode().

int do_pass = 0 [static]

Definition at line 142 of file ffmpeg.c.

Referenced by new_video_stream(), and opt_pass().

int do_pkt_dump = 0 [static]

Definition at line 140 of file ffmpeg.c.

Referenced by transcode().

int do_psnr = 0 [static]

Definition at line 141 of file ffmpeg.c.

Referenced by new_video_stream().

float dts_delta_threshold = 10 [static]

Definition at line 166 of file ffmpeg.c.

Referenced by transcode().

float dts_error_threshold = 3600*30 [static]

Definition at line 167 of file ffmpeg.c.

Referenced by transcode().

int exit_on_error = 0 [static]

Definition at line 155 of file ffmpeg.c.

Referenced by do_subtitle_out(), transcode(), and write_frame().

int64_t extra_size = 0 [static]

Definition at line 161 of file ffmpeg.c.

Referenced by ape_read_packet(), asf_write_header1(), print_report(), and transcode_init().

int file_overwrite = 0 [static]

Definition at line 135 of file ffmpeg.c.

Referenced by assert_file_overwrite().

Definition at line 348 of file ffmpeg.c.

int frame_bits_per_raw_sample = 0 [static]

Definition at line 124 of file ffmpeg.c.

Referenced by new_video_stream(), and transcode_init().

Definition at line 792 of file ffmpeg.c.

InputFile** input_files = NULL [static]

Definition at line 340 of file ffmpeg.c.

Definition at line 338 of file ffmpeg.c.

int input_sync [static]

Definition at line 164 of file ffmpeg.c.

const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL } [static]

int intra_dc_precision = 8 [static]

Definition at line 128 of file ffmpeg.c.

Referenced by new_video_stream().

int intra_only = 0 [static]

Definition at line 130 of file ffmpeg.c.

Referenced by build_frame_code(), and new_video_stream().

int nb_frames_drop = 0 [static]

Definition at line 163 of file ffmpeg.c.

Referenced by do_video_out(), and print_report().

int nb_frames_dup = 0 [static]

Definition at line 162 of file ffmpeg.c.

Referenced by do_video_out(), and print_report().

int nb_input_files = 0 [static]

int nb_input_streams = 0 [static]

int nb_output_files = 0 [static]

int nb_output_streams = 0 [static]

int no_file_overwrite = 0 [static]

Definition at line 136 of file ffmpeg.c.

Referenced by assert_file_overwrite().

int opt_shortest = 0 [static]

Definition at line 149 of file ffmpeg.c.

Referenced by transcode().

static const OptionDef options [static]

Definition at line 120 of file ffmpeg.c.

Referenced by pp_get_mode_by_name_and_quality(), show_codec_opts(), and show_format_opts().

Definition at line 345 of file ffmpeg.c.

Definition at line 343 of file ffmpeg.c.

const char* pass_logfilename_prefix [static]

Definition at line 143 of file ffmpeg.c.

Referenced by opt_passlogfile(), and transcode_init().

int print_stats = 1 [static]

Definition at line 169 of file ffmpeg.c.

Referenced by print_report().

const int program_birth_year = 2000

program birth year, defined by the program for show_banner()

Definition at line 103 of file ffmpeg.c.

const char program_name[] = "ffmpeg"

program name, defined by the program for show_version().

Definition at line 102 of file ffmpeg.c.

int qp_hist = 0 [static]

Definition at line 129 of file ffmpeg.c.

Referenced by print_report(), and transcode().

volatile int received_nb_signals = 0 [static]

Definition at line 158 of file ffmpeg.c.

Referenced by decode_interrupt_cb(), sigterm_handler(), and transcode().

volatile int received_sigterm = 0 [static]

Definition at line 1443 of file ffmpeg.c.

Referenced by transcode().

int run_as_daemon = 0 [static]

Definition at line 157 of file ffmpeg.c.

Referenced by main(), term_init(), and transcode().

int same_quant = 0 [static]

Definition at line 126 of file ffmpeg.c.

Referenced by decode_video(), new_output_stream(), and poll_filters().

const char* subtitle_codec_name = NULL [static]

Definition at line 792 of file ffmpeg.c.

int using_stdin = 0 [static]

Definition at line 156 of file ffmpeg.c.

Referenced by assert_file_overwrite(), opt_input_file(), and transcode().

const char* video_codec_name = NULL [static]

int video_discard = 0 [static]

Definition at line 125 of file ffmpeg.c.

int64_t video_size = 0 [static]

int video_sync_method = VSYNC_AUTO [static]

Definition at line 144 of file ffmpeg.c.

Referenced by do_video_out(), opt_vsync(), transcode_init(), and write_frame().

FILE* vstats_file [static]

Definition at line 151 of file ffmpeg.c.

Referenced by do_video_stats(), and exit_program().

char* vstats_filename [static]

Definition at line 150 of file ffmpeg.c.

Referenced by do_video_out(), do_video_stats(), exit_program(), and opt_vstats_file().


Generated on Fri Oct 26 02:47:54 2012 for FFmpeg by  doxygen 1.5.8