34 int raten, rated, aspectn, aspectd, ret;
36 const char *colorspace =
"";
37 const char *colorrange =
"";
52 if (aspectn == 0 && aspectd == 1)
57 colorrange =
" XCOLORRANGE=LIMITED";
60 colorrange =
" XCOLORRANGE=FULL";
66 switch (field_order) {
71 default: inter =
'p';
break;
76 colorspace =
" Cmono";
79 colorspace =
" Cmono9";
82 colorspace =
" Cmono10";
85 colorspace =
" Cmono12";
88 colorspace =
" Cmono16";
91 colorspace =
" C411 XYSCSS=411";
94 colorspace =
" C420jpeg XYSCSS=420JPEG";
95 colorrange =
" XCOLORRANGE=FULL";
98 colorspace =
" C422 XYSCSS=422";
99 colorrange =
" XCOLORRANGE=FULL";
102 colorspace =
" C444 XYSCSS=444";
103 colorrange =
" XCOLORRANGE=FULL";
109 default: colorspace =
" C420jpeg XYSCSS=420JPEG";
break;
113 colorspace =
" C422 XYSCSS=422";
116 colorspace =
" C444 XYSCSS=444";
119 colorspace =
" C444alpha XYSCSS=444";
122 colorspace =
" C420p9 XYSCSS=420P9";
125 colorspace =
" C422p9 XYSCSS=422P9";
128 colorspace =
" C444p9 XYSCSS=444P9";
131 colorspace =
" C420p10 XYSCSS=420P10";
134 colorspace =
" C422p10 XYSCSS=422P10";
137 colorspace =
" C444p10 XYSCSS=444P10";
140 colorspace =
" C420p12 XYSCSS=420P12";
143 colorspace =
" C422p12 XYSCSS=422P12";
146 colorspace =
" C444p12 XYSCSS=444P12";
149 colorspace =
" C420p14 XYSCSS=420P14";
152 colorspace =
" C422p14 XYSCSS=422P14";
155 colorspace =
" C444p14 XYSCSS=444P14";
158 colorspace =
" C420p16 XYSCSS=420P16";
161 colorspace =
" C422p16 XYSCSS=422P16";
164 colorspace =
" C444p16 XYSCSS=444P16";
170 aspectn, aspectd, colorspace, colorrange);
173 "Error. YUV4MPEG stream header write failed.\n");
206 for (
int k = 0; k <
desc->nb_components; k++) {
208 const uint8_t *ptr =
frame->data[k];
210 if (
desc->nb_components >= 3 && (k == 1 || k == 2)) {
214 plane_width *=
desc->comp[k].step;
216 for (
int i = 0;
i < plane_height;
i++) {
218 ptr +=
frame->linesize[k];
233 switch (
s->streams[0]->codecpar->format) {
236 "stream, some mjpegtools might not work.\n");
269 "Use '-strict -1' to encode to this pixel format.\n",
274 "Mjpegtools will not work.\n");
278 "yuv444p, yuv422p, yuv420p, yuv411p and gray8 pixel formats. "
279 "And using 'strict -1' also yuv444p9, yuv422p9, yuv420p9, "
280 "yuv444p10, yuv422p10, yuv420p10, "
281 "yuv444p12, yuv422p12, yuv420p12, "
282 "yuv444p14, yuv422p14, yuv420p14, "
283 "yuv444p16, yuv422p16, yuv420p16, "
285 "gray9, gray10, gray12 "
286 "and gray16 pixel formats. "
287 "Use -pix_fmt to select one.\n");
295 .p.name =
"yuv4mpegpipe",
297 .p.extensions =
"y4m",
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2
Writes a formatted string to the context.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#define i(width, name, range_min, range_max)
#define AV_CEIL_RSHIFT(a, b)
#define FF_COMPLIANCE_NORMAL
@ AV_FIELD_TT
Top coded_first, top displayed first.
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
@ AV_FIELD_BT
Bottom coded first, top displayed first.
@ AV_FIELD_TB
Top coded first, bottom displayed first.
reference-counted frame API
@ AV_CODEC_ID_WRAPPED_AVFRAME
Passthrough codec, AVFrames wrapped in AVPacket.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define FF_OFMT_FLAG_MAX_ONE_OF_EACH
If this flag is set, it indicates that for each codec type whose corresponding default codec (i....
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.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV422P9
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_JPEG
Full range content.
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P14
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
enum AVFieldOrder field_order
The order of the fields in interlaced video.
int height
The height of the video frame in pixels.
int width
The width of the video frame in pixels.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
enum AVChromaLocation chroma_location
enum AVColorRange color_range
Additional colorspace characteristics.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
static int yuv4_write_header(AVFormatContext *s)
static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
static int yuv4_init(AVFormatContext *s)