Go to the documentation of this file.
25 #include "config_components.h"
68 const char *str = strrchr(
s->url,
'.');
69 img->split_planes = str
74 &&
desc->nb_components >= 3;
76 img->img_number =
img->start_img_number;
144 char* target[4] = {0};
155 }
else if (
img->use_strftime) {
157 struct tm *tm, tmpbuf;
161 }
else if (
img->frame_pts) {
170 if (
img->img_number ==
img->start_img_number) {
171 av_log(
s,
AV_LOG_WARNING,
"The specified filename '%s' does not contain an image sequence pattern or a pattern is invalid.\n",
s->url);
173 "Use a pattern such as %%03d for an image sequence or "
174 "use the -update option (with -frames:v 1 if needed) to write a single image.\n");
178 av_log(
s,
AV_LOG_ERROR,
"Cannot write more than one file with the same name. Are you missing the -update option or a sequence pattern?\n");
187 for (
i = 0;
i < 4;
i++) {
189 if (
img->use_rename) {
192 if (!
tmp[
i] || !target[
i]) {
208 if (!
img->split_planes ||
i+1 >=
desc->nb_components)
210 filename.str[filename.len - 1] =
"UVAx"[
i];
214 if (
img->split_planes) {
217 if (
desc->comp[0].depth >= 9) {
225 if (
desc->nb_components > 3)
227 }
else if (
img->muxer) {
237 for (
i = 0;
i < 4 &&
tmp[
i];
i++) {
271 #define OFFSET(x) offsetof(VideoMuxData, x)
272 #define ENC AV_OPT_FLAG_ENCODING_PARAM
275 {
"start_number",
"set first number in the sequence",
OFFSET(start_img_number),
AV_OPT_TYPE_INT, { .i64 = 1 }, 0, INT_MAX,
ENC },
278 {
"atomic_writing",
"write files atomically (using temporary files and renames)",
OFFSET(use_rename),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
ENC },
279 {
"protocol_opts",
"specify protocol options for the opened files",
OFFSET(protocol_opts),
AV_OPT_TYPE_DICT, {0}, 0, 0,
ENC },
283 #if CONFIG_IMAGE2_MUXER
284 static const AVClass img2mux_class = {
294 .p.extensions =
"bmp,dpx,exr,jls,jpeg,jpg,jxl,ljpg,pam,pbm,pcx,pfm,pgm,pgmyuv,phm,"
295 "png,ppm,sgi,tga,tif,tiff,jp2,j2c,j2k,xwd,sun,ras,rs,im1,im8,"
296 "im24,sunras,vbn,xbm,xface,pix,y,avif,qoi,hdr,wbmp",
303 .p.priv_class = &img2mux_class,
306 #if CONFIG_IMAGE2PIPE_MUXER
308 .
p.
name =
"image2pipe",
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
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
static int write_packet_pipe(AVFormatContext *s, AVPacket *pkt)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
This struct describes the properties of an encoded stream.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
char * av_asprintf(const char *fmt,...)
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
static int write_and_close(AVFormatContext *s, AVIOContext **pb, const unsigned char *buf, int size)
static int write_header(AVFormatContext *s)
static int query_codec(enum AVCodecID id, int std_compliance)
int ff_rename(const char *url_src, const char *url_dst, void *logctx)
Wrap ffurl_move() and log if error happens.
static int write_packet(AVFormatContext *s, AVPacket *pkt)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
static const AVOption muxoptions[]
const IdStrMap ff_img_tags[]
#define AV_CEIL_RSHIFT(a, b)
#define AVIO_FLAG_WRITE
write-only
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.
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
const char * av_default_item_name(void *ptr)
Return the context name.
AVIOContext * pb
I/O context.
void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm)
Append a formatted date and time to a print buffer.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
int split_planes
use independent file for each Y, U, V plane
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#define FF_COMPLIANCE_NORMAL
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AV_FRAME_FILENAME_FLAGS_MULTIPLE
Allow multiple d.
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...
int id
Format-specific stream ID.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
void av_bprintf(AVBPrint *buf, const char *fmt,...)
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
static av_always_inline void update(AVFilterContext *ctx, AVFrame *insamples, int is_silence, int current_sample, int64_t nb_samples_notify, AVRational time_base)
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
static int write_muxed_file(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
char * av_strdup(const char *s)
Duplicate a string.
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file ensuring correct interleaving.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
AVDictionary * protocol_opts
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.