FFmpeg: fftools/ffmpeg_enc.c Source File
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 #include <math.h>
20 #include <stdint.h>
21
23
38
40
42 // combined size of all the packets received from the encoder
44
45 // number of packets received from the encoder
47
50
53 };
54
55 // data that is local to the decoder thread and not visible outside of it
60
62 {
64
65 if (!enc)
66 return;
67
69 }
70
73 {
75
77
79 if (!enc)
81
84
85 *penc = enc;
86
87 return 0;
88 }
89
91 {
94
95 if (frames_ref &&
97 ost->enc_ctx->pix_fmt) {
98 // Matching format, will try to use hw_frames_ctx.
99 } else {
101 }
102
103 for (
int i = 0;;
i++) {
106 break;
107
108 if (frames_ref &&
111 config->pix_fmt ==
ost->enc_ctx->pix_fmt)) {
113 "frames context (format %s) with %s encoder.\n",
115 ost->enc_ctx->codec->name);
117 if (!
ost->enc_ctx->hw_frames_ctx)
119 return 0;
120 }
121
122 if (!dev &&
125 }
126
127 if (dev) {
129 "(type %s) with %s encoder.\n", dev->
name,
132 if (!
ost->enc_ctx->hw_device_ctx)
134 } else {
135 // No device required, or no device available.
136 }
137 return 0;
138 }
139
141 {
142 const char *cname =
ost->enc_ctx->codec->name;
143 uint8_t *encoder_string;
144 int encoder_string_len;
145
147 return 0;
148
150 encoder_string =
av_mallocz(encoder_string_len);
151 if (!encoder_string)
153
156 else
157 av_strlcpy(encoder_string,
"Lavc ", encoder_string_len);
158 av_strlcat(encoder_string, cname, encoder_string_len);
161
162 return 0;
163 }
164
166 {
177
179 return 0;
180
181 // frame is always non-NULL for audio and video
183
187
190
192 continue;
193
200 }
201 }
202
206
207 if (ist)
209
210 // the timebase is chosen by filtering code
215 }
216
220 frame->sample_rate > 0 &&
221 frame->ch_layout.nb_channels > 0);
227
228 if (
ost->bits_per_raw_sample)
230 else
233 break;
234
242 ost->frame_aspect_ratio.num ?
// overridden by the -aspect cli option
244 frame->sample_aspect_ratio;
245
247
248 if (
ost->bits_per_raw_sample)
250 else
253
259
263 ||
ost->top_field_first >= 0
264 #endif
265 ) {
266 int top_field_first =
267 #if FFMPEG_OPT_TOP
268 ost->top_field_first >= 0 ?
269 ost->top_field_first :
270 #endif
272
275 else
277 } else
279
280 break;
281 }
284
285 if (!enc_ctx->
width) {
286 enc_ctx->
width =
ost->ist->par->width;
288 }
289
292 /* ASS code assumes this buffer is null terminated so add extra byte. */
299 }
300
301 break;
302 default:
304 break;
305 }
306
309
312
314
318 "Encoding hardware device setup failed: %s\n",
av_err2str(
ret));
320 }
321
325 "incorrect parameters such as bit_rate, rate, width or height.\n");
327 }
328
330
331 if (
ost->enc_ctx->frame_size)
333
334 if (
ost->enc_ctx->bit_rate &&
ost->enc_ctx->bit_rate < 1000 &&
337 " It takes bits/s as argument, not kbits/s\n");
338
342 "Error initializing the output stream codec context.\n");
344 }
345
346 // copy timebase while removing common factors
349
353
355 }
356
358 {
360
363 return 0;
364 }
365 return 1;
366 }
367
370 {
372 int subtitle_out_max_size = 1024 * 1024;
373 int subtitle_out_size, nb,
i,
ret;
376
380 }
382 return 0;
383
385
386 /* Note: DVB subtitle need one packet to draw them and one other
387 packet to clear them */
388 /* XXX: signal it in the codec context ? */
390 nb = 2;
393 else
394 nb = 1;
395
396 /* shift timestamp to honor -ss and make check_recording_time() work with -t */
400 for (
i = 0;
i < nb;
i++) {
402
405
409
411 // start_display_time is required to be 0
415
421 }
422
423 ost->frames_encoded++;
424
426 if (subtitle_out_size < 0) {
428 return subtitle_out_size;
429 }
430
436 /* XXX: the pts correction is handled here. Maybe handling
437 it in the codec would be better */
440 else
442 }
444
449 }
450 }
451
452 return 0;
453 }
454
457 uint64_t frame_num)
458 {
463
466
468
473 }
474
476
479
493 }
494
500 }
501 } else {
507 "K" : "N", 1); continue;
511 continue;
512 }
516 continue;
517 }
519 }
520 }
521 }
524
526 }
527
528 static inline double psnr(
double d)
529 {
530 return -10.0 * log10(d);
531 }
532
534 {
541 double ti1,
bitrate, avg_bitrate;
542 double psnr_val = -1;
544
547
549
551 // FIXME the scaling assumes 8bit
555 }
556
557 if (!write_vstats)
558 return 0;
559
560 /* this is executed just the first time update_video_stats is called */
564 perror("fopen");
566 }
567 }
568
571 fprintf(
vstats_file,
"frame= %5"PRId64
" q= %2.1f ", frame_number,
573 } else {
574 fprintf(
vstats_file,
"out= %2d st= %2d frame= %5"PRId64
" q= %2.1f ",
577 }
578
579 if (psnr_val >= 0)
581
583 /* compute pts value */
585 if (ti1 < 0.01)
586 ti1 = 0.01;
587
590 fprintf(
vstats_file,
"s_size= %8.0fKiB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
593
594 return 0;
595 }
596
599 {
603 const char *action =
frame ?
"encode" :
"flush";
605
608
609 if (!fd)
611
613
614 if (
ost->enc_stats_pre.io)
616 ost->frames_encoded);
617
618 ost->frames_encoded++;
619 ost->samples_encoded +=
frame->nb_samples;
620
623 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
624 type_desc,
627 }
628
629 if (
frame->sample_aspect_ratio.num && !
ost->frame_aspect_ratio.num)
631 }
632
634
638 type_desc);
640 }
641
642 while (1) {
644
646
650
652
653 /* if two pass, output log on success and EOF */
656
659 return 0;
660 }
else if (
ret < 0) {
664 }
665
667 if (!fd)
670
671 // attach stream parameters to first packet if requested
677
681 }
682
684
689 }
690
691 if (
ost->enc_stats_post.io)
694
697 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s "
698 "duration:%s duration_time:%s\n",
699 type_desc,
703 }
704
706
708
713 }
714 }
715
717 }
718
721 {
722 double pts_time;
723
726
731 goto force_keyframe;
732 }
else if (kf->
pexpr) {
733 double res;
738 "force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n",
744 res);
745
747
748 if (res) {
752 goto force_keyframe;
753 }
755 goto force_keyframe;
756 }
757
759
760 force_keyframe:
763 }
764
766 {
769
773
774 // no flushing for subtitles
777 }
778
782
784 frame->quality =
ost->enc_ctx->global_quality;
786
787 #if FFMPEG_OPT_TOP
788 if (
ost->top_field_first >= 0) {
791 }
792 #endif
793 } else {
795 ost->enc_ctx->ch_layout.nb_channels !=
frame->ch_layout.nb_channels) {
797 "Audio channel count changed and encoder does not support parameter changes\n");
798 return 0;
799 }
800 }
801 }
802
804 }
805
807 {
810 ost->enc_ctx->codec->name);
812 }
813
815 {
818
819 memset(et, 0, sizeof(*et));
820 }
821
823 {
824 memset(et, 0, sizeof(*et));
825
829
833
834 return 0;
835
839 }
840
842 {
846 int ret = 0, input_status = 0;
847 int name_set = 0;
848
852
853 /* Open the subtitle encoders immediately. AVFrame-based encoders
854 * are opened through a callback from the scheduler once they get
855 * their first frame
856 *
857 * N.B.: because the callback is called from a different thread,
858 * enc_ctx MUST NOT be accessed before sch_enc_receive() returns
859 * for the first time for audio/video. */
864 }
865
866 while (!input_status) {
868 if (input_status < 0) {
872 break;
873
876 } else {
880 }
882 }
883
884 if (!name_set) {
886 name_set = 1;
887 }
888
890
893
897 else
900 break;
901 }
902 }
903
904 // flush the encoder
910 }
911
912 // EOF is normal thread termination
915
918
920 }
921
923 {
926 }
static int frame_samples(const SyncQueue *sq, SyncQueueFrame frame)
static void error(const char *err)
const uint8_t * subtitle_header
int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, const AVSubtitle *sub)
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
AVCodecParameters * par_enc
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
#define AV_LOG_WARNING
Something somehow does not look correct.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
#define AVERROR_EXPERIMENTAL
Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
#define atomic_store(object, desired)
int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
Read encoded data from the encoder.
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
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare two timestamps each in its own time base.
enum AVColorSpace colorspace
YUV colorspace type.
AVFrameSideData ** decoded_side_data
Array containing static side data, such as HDR10 CLL / MDCV structures.
int sample_rate
samples per second
@ AV_PKT_DATA_QUALITY_STATS
This side data contains quality related information from the encoder.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AVERROR_EOF
End of file.
uint8_t * data
The data buffer.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int64_t start_time
start time in microseconds == AV_TIME_BASE units
This structure describes decoded (raw) audio or video data.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
int capabilities
Codec capabilities.
int depth
Number of bits in the component.
enum AVFieldOrder field_order
Field order.
AVRational avg_frame_rate
Average framerate.
uint8_t * subtitle_header
static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf, const AVFrame *frame)
#define AV_LOG_VERBOSE
Detailed information.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define AV_CODEC_FLAG_PSNR
error[?] variables will be set during encoding.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, const AVFrameSideData *src, unsigned int flags)
Add a new side data entry to an array based on existing side data, taking a reference towards the con...
static int set_encoder_id(OutputFile *of, OutputStream *ost)
#define AV_CODEC_FLAG_INTERLACED_ME
interlaced motion estimation
static double psnr(double d)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame, AVPacket *pkt)
@ AV_FIELD_BT
Bottom coded first, top displayed first.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
@ AV_FIELD_TT
Top coded_first, top displayed first.
#define AV_CODEC_FLAG_COPY_OPAQUE
const struct AVCodec * codec
AVBufferRef * opaque_ref
AVBufferRef for free use by the API user.
#define AV_CODEC_FLAG_FRAME_DURATION
Signal to the encoder that the values of AVFrame.duration are valid and should be used (typically for...
AVChannelLayout ch_layout
Audio channel layout.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
int flags
AV_CODEC_FLAG_*.
void update_benchmark(const char *fmt,...)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
@ AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX
The codec supports this format via the hw_frames_ctx interface.
@ AV_FIELD_TB
Top coded first, bottom displayed first.
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
@ AV_CODEC_ID_DVB_SUBTITLE
static void enc_thread_uninit(EncoderThread *et)
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
AVRational frame_rate_filter
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE
Remove existing entries before adding new ones.
int encoder_thread(void *arg)
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
EncStatsComponent * components
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void enc_stats_write(OutputStream *ost, EncStats *es, const AVFrame *frame, const AVPacket *pkt, uint64_t frame_num)
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int64_t pts
Same as packet pts, in AV_TIME_BASE.
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
int sch_enc_receive(Scheduler *sch, unsigned enc_idx, AVFrame *frame)
Called by encoder tasks to obtain frames for encoding.
@ AV_SIDE_DATA_PROP_GLOBAL
The side data type can be used in stream-global structures.
double expr_const_values[FKF_NB]
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
static int frame_encode(OutputStream *ost, AVFrame *frame, AVPacket *pkt)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
void avcodec_parameters_free(AVCodecParameters **ppar)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
Rational number (pair of numerator and denominator).
@ AV_PICTURE_TYPE_I
Intra.
int subtitle_header_size
Header containing style information for text subtitles.
int64_t wallclock[LATENCY_PROBE_NB]
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
void avio_w8(AVIOContext *s, int b)
@ AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
The codec supports this format via the hw_device_ctx interface.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sch_enc_send(Scheduler *sch, unsigned enc_idx, AVPacket *pkt)
Called by encoder tasks to send encoded packets downstream.
#define pthread_mutex_unlock(a)
int enc_loopback(Encoder *enc)
static int enc_thread_init(EncoderThread *et)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
char * stats_out
pass1 encoding statistics output buffer
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
enum AVSampleFormat sample_fmt
audio sample format
#define AV_NOPTS_VALUE
Undefined timestamp value.
HWDevice * hw_device_get_by_type(enum AVHWDeviceType type)
@ AV_PICTURE_TYPE_NONE
Undefined.
FrameData * frame_data(AVFrame *frame)
Get our axiliary frame data attached to the frame, allocating it if needed.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
uint32_t end_display_time
int enc_alloc(Encoder **penc, const AVCodec *codec, Scheduler *sch, unsigned sch_idx)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
int flags
A combination of AV_PKT_FLAG values.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
#define AV_LOG_INFO
Standard information.
static void enc_thread_set_name(const OutputStream *ost)
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
#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 av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)
Supply a raw video or audio frame to the encoder.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
This struct describes a set or pool of "hardware" frames (i.e.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes,...
static int hw_device_setup_for_encode(OutputStream *ost, AVBufferRef *frames_ref)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2
Writes a formatted string to the context.
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.
main external API structure.
int index
stream index in AVFormatContext
int enc_open(void *opaque, const AVFrame *frame)
static int do_subtitle_out(OutputFile *of, OutputStream *ost, const AVSubtitle *sub, AVPacket *pkt)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static int check_recording_time(OutputStream *ost, int64_t ts, AVRational tb)
This struct describes the properties of a side data type.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
void enc_free(Encoder **penc)
#define AV_CODEC_CAP_PARAM_CHANGE
Codec supports changed parameters at any point.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
enum AVMediaType codec_type
A reference to a data buffer.
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
int avcodec_parameters_from_context(struct AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
AVRational av_add_q(AVRational b, AVRational c)
Add two rationals.
const AVSideDataDescriptor * av_frame_side_data_desc(enum AVFrameSideDataType type)
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
FrameData * packet_data(AVPacket *pkt)
int width
picture width / height.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
int of_stream_init(OutputFile *of, OutputStream *ost)
#define AV_PKT_FLAG_TRUSTED
The packet comes from a trusted source.
static int update_video_stats(OutputStream *ost, const AVPacket *pkt, int write_vstats)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
uint32_t start_display_time
AVRational time_base
Time base of the packet's timestamps.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
#define pthread_mutex_lock(a)
static int ff_thread_setname(const char *name)
Generated on Fri Aug 22 2025 13:58:03 for FFmpeg by
doxygen
1.8.17