FFmpeg
|
#include "config.h"
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <stdatomic.h>
#include <stdint.h>
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswresample/swresample.h"
#include "libavutil/opt.h"
#include "libavutil/channel_layout.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/fifo.h"
#include "libavutil/hwcontext.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "libavutil/display.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 "libavutil/time.h"
#include "libavutil/thread.h"
#include "libavutil/threadmessage.h"
#include "libavcodec/mathops.h"
#include "libavcodec/version.h"
#include "libavformat/os_support.h"
#include "libavfilter/avfilter.h"
#include "libavfilter/buffersrc.h"
#include "libavfilter/buffersink.h"
#include "ffmpeg.h"
#include "cmdutils.h"
#include "sync_queue.h"
#include "libavutil/avassert.h"
Go to the source code of this file.
Data Structures | |
struct | FrameData |
struct | BenchmarkTimeStamps |
Macros | |
#define | SIGNAL(sig, func) signal(sig, func) |
Variables | |
const char | program_name [] = "ffmpeg" |
program name, defined by the program for show_version(). More... | |
const int | program_birth_year = 2000 |
program birth year, defined by the program for show_banner() More... | |
static FILE * | vstats_file |
static int64_t | nb_frames_dup = 0 |
static uint64_t | dup_warning = 1000 |
static int64_t | nb_frames_drop = 0 |
static int64_t | decode_error_stat [2] |
unsigned | nb_output_dumped = 0 |
static BenchmarkTimeStamps | current_time |
AVIOContext * | progress_avio = NULL |
InputFile ** | input_files = NULL |
int | nb_input_files = 0 |
OutputFile ** | output_files = NULL |
int | nb_output_files = 0 |
FilterGraph ** | filtergraphs |
int | nb_filtergraphs |
static volatile int | received_sigterm = 0 |
static volatile int | received_nb_signals = 0 |
static atomic_int | transcode_init_done = ATOMIC_VAR_INIT(0) |
static volatile int | ffmpeg_exited = 0 |
int | main_return_code = 0 |
static int64_t | copy_ts_first_pts = AV_NOPTS_VALUE |
const AVIOInterruptCB | int_cb = { decode_interrupt_cb, NULL } |
multimedia converter based on the FFmpeg libraries
Definition in file ffmpeg.c.
|
static |
Definition at line 2484 of file ffmpeg.c.
Referenced by do_streamcopy(), and encode_frame().
|
static |
Definition at line 4094 of file ffmpeg.c.
Referenced by main(), and update_benchmark().
|
static |
Definition at line 4120 of file ffmpeg.c.
Referenced by ffmpeg_cleanup().
|
static |
Definition at line 1966 of file ffmpeg.c.
Referenced by flush_encoders(), ifilter_send_frame(), and transcode_step().
|
static |
Definition at line 164 of file ffmpeg.c.
Referenced by sub2video_update().
|
static |
Definition at line 179 of file ffmpeg.c.
Referenced by sub2video_update().
|
static |
Definition at line 210 of file ffmpeg.c.
Referenced by sub2video_heartbeat(), and sub2video_update().
void sub2video_update | ( | InputStream * | ist, |
int64_t | heartbeat_pts, | ||
AVSubtitle * | sub | ||
) |
Definition at line 228 of file ffmpeg.c.
Referenced by configure_filtergraph(), process_subtitle(), sub2video_flush(), and sub2video_heartbeat().
|
static |
Definition at line 268 of file ffmpeg.c.
Referenced by process_input().
|
static |
Definition at line 300 of file ffmpeg.c.
Referenced by transcode_subtitles().
|
static |
Definition at line 316 of file ffmpeg.c.
Referenced by sigterm_handler(), and term_exit().
void term_exit | ( | void | ) |
Definition at line 324 of file ffmpeg.c.
Referenced by assert_file_overwrite(), ffmpeg_cleanup(), and transcode().
|
static |
Definition at line 338 of file ffmpeg.c.
Referenced by term_init().
void term_init | ( | void | ) |
Definition at line 395 of file ffmpeg.c.
Referenced by assert_file_overwrite().
|
static |
Definition at line 444 of file ffmpeg.c.
Referenced by check_keyboard_interaction().
|
static |
|
static |
Definition at line 588 of file ffmpeg.c.
Referenced by check_keyboard_interaction(), choose_output(), flush_encoders(), got_eagain(), need_output(), print_final_stats(), print_report(), process_input(), process_input_packet(), process_subtitle(), reap_filters(), reset_eagain(), transcode(), and transcode_init().
InputStream* ist_iter | ( | InputStream * | prev | ) |
Definition at line 604 of file ffmpeg.c.
Referenced by check_keyboard_interaction(), init_input_filter(), map_auto_data(), map_auto_subtitle(), transcode(), and transcode_init().
void remove_avoptions | ( | AVDictionary ** | a, |
AVDictionary * | b | ||
) |
Definition at line 620 of file ffmpeg.c.
Referenced by ifile_open().
void assert_avoptions | ( | AVDictionary * | m | ) |
Definition at line 629 of file ffmpeg.c.
Referenced by ifile_open(), init_input_stream(), and init_output_stream().
Definition at line 638 of file ffmpeg.c.
Referenced by init_input_stream(), and init_output_stream().
|
static |
Definition at line 643 of file ffmpeg.c.
Referenced by decode_audio(), decode_video(), and encode_frame().
|
static |
Definition at line 664 of file ffmpeg.c.
Referenced by check_recording_time(), do_streamcopy(), submit_encode_frame(), and transcode_from_filter().
|
static |
Definition at line 673 of file ffmpeg.c.
Referenced by do_audio_out(), do_subtitle_out(), and do_video_out().
|
static |
Definition at line 685 of file ffmpeg.c.
Referenced by video_sync_process().
|
static |
Definition at line 3203 of file ffmpeg.c.
Referenced by init_output_stream_wrapper().
|
static |
Definition at line 730 of file ffmpeg.c.
Referenced by do_video_out(), flush_encoders(), reap_filters(), transcode_init(), and transcode_step().
Definition at line 751 of file ffmpeg.c.
Referenced by main(), print_report(), run_psnr(), and update_video_stats().
|
static |
Definition at line 756 of file ffmpeg.c.
Referenced by encode_frame().
void enc_stats_write | ( | OutputStream * | ost, |
EncStats * | es, | ||
const AVFrame * | frame, | ||
const AVPacket * | pkt, | ||
uint64_t | frame_num | ||
) |
Definition at line 811 of file ffmpeg.c.
Referenced by encode_frame(), and write_packet().
|
static |
Definition at line 877 of file ffmpeg.c.
Referenced by submit_encode_frame().
|
static |
Definition at line 979 of file ffmpeg.c.
Referenced by do_audio_out(), do_video_out(), and flush_encoders().
|
static |
Definition at line 1025 of file ffmpeg.c.
Referenced by reap_filters().
|
static |
Definition at line 1051 of file ffmpeg.c.
Referenced by process_subtitle().
|
static |
Definition at line 1132 of file ffmpeg.c.
Referenced by do_video_out().
|
static |
Definition at line 1201 of file ffmpeg.c.
Referenced by do_video_out().
|
static |
Definition at line 1253 of file ffmpeg.c.
Referenced by reap_filters().
Get and encode new output from any of the filtergraphs, without causing activity.
Definition at line 1361 of file ffmpeg.c.
Referenced by ifilter_send_frame(), transcode_from_filter(), and transcode_step().
|
static |
Definition at line 1449 of file ffmpeg.c.
Referenced by print_report().
|
static |
Definition at line 1569 of file ffmpeg.c.
Referenced by transcode().
|
static |
Definition at line 1766 of file ffmpeg.c.
Referenced by flush_encoders(), and ifilter_send_eof().
|
static |
Definition at line 1784 of file ffmpeg.c.
Referenced by transcode().
|
static |
Definition at line 1847 of file ffmpeg.c.
Referenced by process_input_packet(), and process_subtitle().
|
static |
Definition at line 1863 of file ffmpeg.c.
Referenced by process_input_packet().
|
static |
Definition at line 1947 of file ffmpeg.c.
Referenced by decode_audio(), decode_video(), and transcode_subtitles().
|
static |
Definition at line 1977 of file ffmpeg.c.
Referenced by send_frame_to_filters().
|
static |
Definition at line 2057 of file ffmpeg.c.
Referenced by send_filter_eof().
|
static |
Definition at line 2087 of file ffmpeg.c.
Referenced by decode_audio(), and decode_video().
|
static |
Definition at line 2127 of file ffmpeg.c.
Referenced by decode_audio(), and decode_video().
|
static |
Definition at line 2145 of file ffmpeg.c.
Referenced by process_input_packet().
|
static |
Definition at line 2202 of file ffmpeg.c.
Referenced by process_input_packet().
|
static |
Definition at line 2326 of file ffmpeg.c.
Referenced by fix_sub_duration_heartbeat(), and transcode_subtitles().
|
static |
Definition at line 2385 of file ffmpeg.c.
Referenced by fix_sub_duration_heartbeat().
|
static |
Definition at line 2465 of file ffmpeg.c.
Referenced by new_output_stream(), and trigger_fix_sub_duration_heartbeat().
|
static |
Definition at line 2515 of file ffmpeg.c.
Referenced by process_input_packet().
|
static |
Definition at line 2536 of file ffmpeg.c.
Referenced by process_input_packet().
|
static |
Definition at line 2552 of file ffmpeg.c.
Referenced by decode_flush(), process_input(), and transcode().
|
static |
Definition at line 2744 of file ffmpeg.c.
Referenced by init_input_stream().
|
static |
Definition at line 2793 of file ffmpeg.c.
Referenced by transcode_init().
|
static |
Definition at line 2852 of file ffmpeg.c.
Referenced by init_output_stream().
|
static |
Definition at line 2982 of file ffmpeg.c.
Referenced by init_output_stream_encode().
|
static |
Definition at line 3005 of file ffmpeg.c.
Referenced by init_output_stream_encode().
|
static |
Definition at line 3028 of file ffmpeg.c.
Referenced by init_output_stream().
|
static |
Definition at line 3315 of file ffmpeg.c.
Referenced by transcode().
|
static |
Definition at line 3455 of file ffmpeg.c.
Referenced by mf_negotiate_types(), and transcode().
|
static |
Select the output stream to process.
Definition at line 3472 of file ffmpeg.c.
Referenced by transcode_step().
|
static |
Definition at line 3502 of file ffmpeg.c.
Referenced by check_keyboard_interaction().
|
static |
Definition at line 3514 of file ffmpeg.c.
Referenced by transcode().
|
static |
Definition at line 3623 of file ffmpeg.c.
Referenced by movie_request_frame(), and transcode_step().
|
static |
Definition at line 3631 of file ffmpeg.c.
Referenced by process_input(), and transcode_step().
|
static |
Definition at line 3640 of file ffmpeg.c.
Referenced by process_input().
|
static |
Definition at line 3671 of file ffmpeg.c.
Referenced by ts_discontinuity_process().
|
static |
Definition at line 3735 of file ffmpeg.c.
Referenced by process_input().
Definition at line 3762 of file ffmpeg.c.
Referenced by transcode_step().
|
static |
Perform a step of transcoding for the specified filter graph.
[in] | graph | filter graph to consider |
[out] | best_ist | input stream where a frame would allow to continue |
Definition at line 3872 of file ffmpeg.c.
Referenced by transcode_step().
|
static |
Run a single step of transcoding.
Definition at line 3918 of file ffmpeg.c.
Referenced by transcode().
|
static |
const char program_name[] = "ffmpeg" |
program name, defined by the program for show_version().
Definition at line 111 of file ffmpeg.c.
Referenced by main().
const int program_birth_year = 2000 |
program birth year, defined by the program for show_banner()
|
static |
Definition at line 114 of file ffmpeg.c.
Referenced by ffmpeg_cleanup(), and update_video_stats().
|
static |
Definition at line 134 of file ffmpeg.c.
Referenced by do_video_out(), and print_report().
|
static |
Definition at line 135 of file ffmpeg.c.
Referenced by do_video_out().
|
static |
Definition at line 136 of file ffmpeg.c.
Referenced by do_video_out(), and print_report().
|
static |
Definition at line 137 of file ffmpeg.c.
Referenced by check_decode_result(), and main().
unsigned nb_output_dumped = 0 |
Definition at line 138 of file ffmpeg.c.
Referenced by mux_check_init(), and print_report().
|
static |
Definition at line 140 of file ffmpeg.c.
Referenced by main(), and update_benchmark().
AVIOContext* progress_avio = NULL |
Definition at line 141 of file ffmpeg.c.
Referenced by print_report().
Definition at line 143 of file ffmpeg.c.
Referenced by apply_sync_offsets(), assert_file_overwrite(), check_decode_result(), configure_input_audio_filter(), configure_input_video_filter(), copy_meta(), correct_input_start_times(), do_streamcopy(), ffmpeg_cleanup(), ifile_open(), init_input_filter(), init_output_stream_streamcopy(), ist_iter(), map_auto_audio(), map_auto_video(), map_manual(), new_video_stream(), opt_map(), opt_map_channel(), opt_target(), print_final_stats(), process_input(), reset_eagain(), sub2video_heartbeat(), sub2video_prepare(), transcode(), transcode_from_filter(), transcode_init(), and transcode_step().
int nb_input_files = 0 |
Definition at line 144 of file ffmpeg.c.
Referenced by apply_sync_offsets(), assert_file_overwrite(), copy_meta(), correct_input_start_times(), dump_attachment(), ffmpeg_cleanup(), ifile_open(), init_input_filter(), ist_iter(), main(), map_auto_audio(), map_auto_video(), opt_map(), opt_map_channel(), opt_target(), print_final_stats(), reset_eagain(), thread_start(), and transcode_init().
OutputFile** output_files = NULL |
Definition at line 146 of file ffmpeg.c.
Referenced by check_output_constraints(), check_recording_time(), close_output_stream(), configure_output_audio_filter(), configure_output_video_filter(), do_streamcopy(), do_subtitle_out(), ffmpeg_cleanup(), flush_encoders(), init_output_stream(), init_output_stream_encode(), init_output_stream_streamcopy(), mux_alloc(), mux_check_init(), new_video_stream(), ost_iter(), print_final_stats(), print_report(), print_sdp(), process_input(), process_subtitle(), reap_filters(), transcode(), and trigger_fix_sub_duration_heartbeat().
int nb_output_files = 0 |
Definition at line 147 of file ffmpeg.c.
Referenced by create_streams(), ffmpeg_cleanup(), main(), mux_alloc(), mux_check_init(), ost_iter(), print_final_stats(), print_report(), print_sdp(), and transcode().
FilterGraph** filtergraphs |
Definition at line 149 of file ffmpeg.c.
Referenced by check_filter_outputs(), check_keyboard_interaction(), create_streams(), do_video_out(), ffmpeg_cleanup(), init_complex_filters(), init_simple_filtergraph(), map_manual(), opt_filter_complex(), and opt_filter_complex_script().
int nb_filtergraphs |
Definition at line 150 of file ffmpeg.c.
Referenced by check_filter_outputs(), check_keyboard_interaction(), create_streams(), do_video_out(), ffmpeg_cleanup(), init_complex_filters(), init_simple_filtergraph(), map_manual(), opt_filter_complex(), opt_filter_complex_script(), and transcode_init().
|
static |
Definition at line 330 of file ffmpeg.c.
Referenced by ffmpeg_cleanup(), sigterm_handler(), and transcode().
|
static |
Definition at line 331 of file ffmpeg.c.
Referenced by check_keyboard_interaction(), decode_interrupt_cb(), main(), and sigterm_handler().
|
static |
Definition at line 332 of file ffmpeg.c.
Referenced by decode_interrupt_cb(), ffmpeg_cleanup(), and transcode_init().
|
static |
Definition at line 333 of file ffmpeg.c.
Referenced by ffmpeg_cleanup().
int main_return_code = 0 |
Definition at line 334 of file ffmpeg.c.
Referenced by main(), and of_write_trailer().
|
static |
Definition at line 335 of file ffmpeg.c.
Referenced by print_report().
const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL } |
Definition at line 500 of file ffmpeg.c.
Referenced by avio_open2(), dump_attachment(), enc_stats_get_file(), ff_network_sleep_interruptible(), ff_network_wait_fd_timeout(), ffio_open_whitelist(), ffurl_alloc(), ffurl_open_whitelist(), get_preset_file_2(), ifile_open(), libsrt_network_wait_fd_timeout(), of_add_attachments(), of_open(), print_sdp(), read_binary(), url_alloc_for_protocol(), and zmq_proto_wait_timeout().