Go to the documentation of this file.
40 ost2->
finished |=
ost == ost2 ? this_stream : others;
60 if (
ost->frame_number >=
ost->max_frames) {
72 unsigned int are_we_over_size =
73 (
ost->muxing_queue_data_size +
pkt->
size) >
ost->muxing_queue_data_threshold;
74 size_t limit = are_we_over_size ?
ost->max_muxing_queue_size : SIZE_MAX;
77 if (new_size <= cur_size) {
79 "Too many packets buffered for output stream %d:%d.\n",
94 ost->muxing_queue_data_size += tmp_pkt->
size;
104 if (
ost->frame_rate.num &&
ost->is_cfr) {
118 av_log(
s,
AV_LOG_WARNING,
"Invalid DTS: %"PRId64
" PTS: %"PRId64
" in output stream %d:%d, replacing by guess\n",
134 av_log(
s, loglevel,
"Non-monotonous DTS in output stream "
135 "%d:%d; previous: %"PRId64
", current: %"PRId64
"; ",
141 av_log(
s, loglevel,
"changing to %"PRId64
". This may result "
142 "in incorrect timestamps in the output file.\n",
153 ost->packets_written++;
159 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s size:%d\n",
210 printf(
"SDP:\n%s\n", sdp);
236 if (!
ost->initialized)
243 "Could not write header for output file #%d "
244 "(incorrect codec parameters ?): %s\n",
287 "Nothing was written into output file %d (%s), because "
288 "at least one of its streams received no packets.\n",
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVMediaType codec_type
General type of the encoded data.
static int print_sdp(void)
size_t av_fifo_can_read(const AVFifo *f)
unsigned nb_output_dumped
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
void print_error(const char *filename, int err)
Print an error message to stderr, indicating filename and a human readable description of the error c...
int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
void of_close(OutputFile **pof)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate,...
#define AVIO_FLAG_WRITE
write-only
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
size_t av_fifo_can_write(const AVFifo *f)
void of_write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and write the stream header to an output media file.
OutputStream ** output_streams
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
#define avio_print(s,...)
Write strings (const char *) to the context.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int of_write_trailer(OutputFile *of)
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
OutputFile ** output_files
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
char * url
input or output URL.
#define AV_NOPTS_VALUE
Undefined timestamp value.
printf("static const uint8_t my_array[100] = {\n")
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
Generate an SDP for an RTP session.
int av_packet_make_refcounted(AVPacket *pkt)
Ensure the data described by a given packet is reference counted.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
Convert valid timing fields (timestamps / durations) in a packet from one timebase to another.
#define AV_LOG_INFO
Standard information.
int of_check_init(OutputFile *of)
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define av_malloc_array(a, b)
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
const AVIOInterruptCB int_cb
static double limit(double x)
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
const struct AVOutputFormat * oformat
The output container format.
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
int index
stream index in AVFormatContext
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
This structure stores compressed data.
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file ensuring correct interleaving.
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static void close_all_output_streams(OutputStream *ost, OSTFinished this_stream, OSTFinished others)
int av_fifo_grow2(AVFifo *f, size_t inc)
Enlarge an AVFifo.