Re: [FFmpeg-devel] [PATCH major bump 0/6] Fix HDR vivid support
The patchset lgtm. thanks. On Thu, Feb 2, 2023 at 3:11 PM Zhao Zhili wrote: > From: Zhao Zhili > > Only patch 1/6 needs to go with major version bump. > > Zhao Zhili (6): > libavutil/hdr_dynamic_vivid_metadata: fix > AVHDRVividColorToneMappingParams > libavcodec/dynamic_hdr_vivid: fix start code check > avcodec/dynamic_hdr_vivid: fix base_param_Delta > avcodec/dynamic_hdr_vivid: fix base_enable_flag control > avcodec/dynamic_hdr_vivid: reindent after the previous commit > fftools/ffprobe: fix print_dynamic_hdr_vivid > > fftools/ffprobe.c | 16 + > libavcodec/dynamic_hdr_vivid.c | 49 -- > libavfilter/vf_showinfo.c | 17 - > libavutil/hdr_dynamic_vivid_metadata.h | 12 +++ > 4 files changed, 46 insertions(+), 48 deletions(-) > > -- > 2.25.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH major bump 1/6] libavutil/hdr_dynamic_vivid_metadata: fix AVHDRVividColorToneMappingParams
Quoting Zhao Zhili (2023-02-02 08:02:03) > From: Zhao Zhili > > There are two group of three_Spline params. Fix the struct > definition and usecases inside libavcodec, libavfilter and ffprobe. > > Co-Author: Houxiang ZHU > Signed-off-by: Zhao Zhili > --- > diff --git a/libavutil/hdr_dynamic_vivid_metadata.h > b/libavutil/hdr_dynamic_vivid_metadata.h > index a34f83072c..4ceddc539d 100644 > --- a/libavutil/hdr_dynamic_vivid_metadata.h > +++ b/libavutil/hdr_dynamic_vivid_metadata.h > @@ -126,42 +126,42 @@ typedef struct AVHDRVividColorToneMappingParams { > * The mode of three Spline. the value shall be in the range > * of 0 to 3, inclusive. > */ > -int three_Spline_TH_mode; > +int three_Spline_TH_mode[2]; > > /** > * three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive > * and in multiples of 1.0/255. > * > */ > -AVRational three_Spline_TH_enable_MB; > +AVRational three_Spline_TH_enable_MB[2]; > > /** > * 3Spline_TH_enable of three Spline. > * The value shall be in the range of 0.0 to 1.0, inclusive. > * and in multiples of 1.0/4095. > */ > -AVRational three_Spline_TH_enable; > +AVRational three_Spline_TH_enable[2]; > > /** > * 3Spline_TH_Delta1 of three Spline. > * The value shall be in the range of 0.0 to 0.25, inclusive, > * and in multiples of 0.25/1023. > */ > -AVRational three_Spline_TH_Delta1; > +AVRational three_Spline_TH_Delta1[2]; > > /** > * 3Spline_TH_Delta2 of three Spline. > * The value shall be in the range of 0.0 to 0.25, inclusive, > * and in multiples of 0.25/1023. > */ > -AVRational three_Spline_TH_Delta2; > +AVRational three_Spline_TH_Delta2[2]; > > /** > * 3Spline_enable_Strength of three Spline. > * The value shall be in the range of 0.0 to 1.0, inclusive, > * and in multiples of 1.0/255. > */ > -AVRational three_Spline_enable_Strength; > +AVRational three_Spline_enable_Strength[2]; > } AVHDRVividColorToneMappingParams; A major bump is not for breaking APIs however you like, only for things that were scheduled in advance that our callers could have prepared for. You should add new fields, not change existing ones. Also, the documentation and doc/APIchanges need to be updated. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH major bump 1/6] libavutil/hdr_dynamic_vivid_metadata: fix AVHDRVividColorToneMappingParams
> On Feb 2, 2023, at 16:16, Anton Khirnov wrote: > > Quoting Zhao Zhili (2023-02-02 08:02:03) >> From: Zhao Zhili >> >> There are two group of three_Spline params. Fix the struct >> definition and usecases inside libavcodec, libavfilter and ffprobe. >> >> Co-Author: Houxiang ZHU >> Signed-off-by: Zhao Zhili >> --- >> diff --git a/libavutil/hdr_dynamic_vivid_metadata.h >> b/libavutil/hdr_dynamic_vivid_metadata.h >> index a34f83072c..4ceddc539d 100644 >> --- a/libavutil/hdr_dynamic_vivid_metadata.h >> +++ b/libavutil/hdr_dynamic_vivid_metadata.h >> @@ -126,42 +126,42 @@ typedef struct AVHDRVividColorToneMappingParams { >> * The mode of three Spline. the value shall be in the range >> * of 0 to 3, inclusive. >> */ >> -int three_Spline_TH_mode; >> +int three_Spline_TH_mode[2]; >> >> /** >> * three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive >> * and in multiples of 1.0/255. >> * >> */ >> -AVRational three_Spline_TH_enable_MB; >> +AVRational three_Spline_TH_enable_MB[2]; >> >> /** >> * 3Spline_TH_enable of three Spline. >> * The value shall be in the range of 0.0 to 1.0, inclusive. >> * and in multiples of 1.0/4095. >> */ >> -AVRational three_Spline_TH_enable; >> +AVRational three_Spline_TH_enable[2]; >> >> /** >> * 3Spline_TH_Delta1 of three Spline. >> * The value shall be in the range of 0.0 to 0.25, inclusive, >> * and in multiples of 0.25/1023. >> */ >> -AVRational three_Spline_TH_Delta1; >> +AVRational three_Spline_TH_Delta1[2]; >> >> /** >> * 3Spline_TH_Delta2 of three Spline. >> * The value shall be in the range of 0.0 to 0.25, inclusive, >> * and in multiples of 0.25/1023. >> */ >> -AVRational three_Spline_TH_Delta2; >> +AVRational three_Spline_TH_Delta2[2]; >> >> /** >> * 3Spline_enable_Strength of three Spline. >> * The value shall be in the range of 0.0 to 1.0, inclusive, >> * and in multiples of 1.0/255. >> */ >> -AVRational three_Spline_enable_Strength; >> +AVRational three_Spline_enable_Strength[2]; >> } AVHDRVividColorToneMappingParams; > > A major bump is not for breaking APIs however you like, only for things > that were scheduled in advance that our callers could have prepared for. > You should add new fields, not change existing ones. > Also, the documentation and doc/APIchanges need to be updated. Adding new fields works, but very ugly. The code never work if three_Spline_num > 1. Breaking API to let user notice that may not be a bad thing in this specific situation. > > -- > Anton Khirnov > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 0/3] PNG color tagging improvements
The first patch fixes a FATE issue with cICP and iCCP. The second patch was discussed on IRC. I got a LGTM from Kasper, but sending to ML here and applying in a few days if there's no objections. A few things discussed: 1) There's no need to expose the gamma table as another function as it's only used here. 2) This patch includes the patch on the ML sent as "avcodec/pngdec: warn when reading tv-range cICP chunks" which got a LGTM from Lynne on IRC. If this is applied that one has no need to be applied. Changes from v2: - Split off the gAMA chunk handling into a second patch at Andreas' suggestion. Changes from v1: - The second patch broke FATE because I didn't change the fate ref to accommodate the new metadata. I've since updated the fate reference. Leo Izen (3): avcodec/pngenc: avoid writing cICP when inappropriate avcodec/pngdec: read colorspace info when decoding with AVDISCARD_ALL avcodec/pngdec: populate enum transfer values from gAMA chunk libavcodec/pngdec.c | 128 +-- libavcodec/pngenc.c | 21 -- tests/ref/fate/png-icc | 8 +-- tests/ref/fate/png-side-data | 2 +- 4 files changed, 96 insertions(+), 63 deletions(-) -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 1/3] avcodec/pngenc: avoid writing cICP when inappropriate
We parse the fallback cHRM on decode and correctly determine that we have BT.709 primaries, but unknown TRC. This causes us to write cICP where we shouldn't. Primaries without transfer can be handled entirely by cHRM, so we should only write cICP if we actually know the transfer function. Additionally, we should avoid writing cICP if there's an ICC profile because the spec says decoders must prioritize cICP over the ICC profile. Signed-off-by: Leo Izen --- libavcodec/pngenc.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 2393161c3b..81b95c143d 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -412,14 +412,25 @@ static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) } } +side_data = av_frame_get_side_data(pict, AV_FRAME_DATA_ICC_PROFILE); +if ((ret = png_write_iccp(s, side_data))) +return ret; + /* write colorspace information */ if (pict->color_primaries == AVCOL_PRI_BT709 && pict->color_trc == AVCOL_TRC_IEC61966_2_1) { s->buf[0] = 1; /* rendering intent, relative colorimetric by default */ png_write_chunk(&s->bytestream, MKTAG('s', 'R', 'G', 'B'), s->buf, 1); -} else if (pict->color_primaries != AVCOL_PRI_UNSPECIFIED || -pict->color_trc != AVCOL_TRC_UNSPECIFIED) { -/* these values match H.273 so no translation is needed */ +} else if (pict->color_trc != AVCOL_TRC_UNSPECIFIED && !side_data) { +/* + * Avoid writing cICP if the transfer is unknown. Known primaries + * with unknown transfer can be handled by cHRM. + * + * We also avoid writing cICP if an ICC Profile is present, because + * the standard requires that cICP overrides iCCP. + * + * These values match H.273 so no translation is needed. + */ s->buf[0] = pict->color_primaries; s->buf[1] = pict->color_trc; s->buf[2] = 0; /* colorspace = RGB */ @@ -432,10 +443,6 @@ static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) if (png_get_gama(pict->color_trc, s->buf)) png_write_chunk(&s->bytestream, MKTAG('g', 'A', 'M', 'A'), s->buf, 4); -side_data = av_frame_get_side_data(pict, AV_FRAME_DATA_ICC_PROFILE); -if ((ret = png_write_iccp(s, side_data))) -return ret; - /* put the palette if needed, must be after colorspace information */ if (s->color_type == PNG_COLOR_TYPE_PALETTE) { int has_alpha, alpha, i; -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 2/3] avcodec/pngdec: read colorspace info when decoding with AVDISCARD_ALL
These chunks are lightweight and it's useful information to have when running ffmpeg -i or ffprobe, for example. --- libavcodec/pngdec.c | 103 ++- tests/ref/fate/png-icc | 8 +-- tests/ref/fate/png-side-data | 2 +- 3 files changed, 59 insertions(+), 54 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 0d969decf2..a80e0d15bb 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1203,7 +1203,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, if (avctx->codec_id == AV_CODEC_ID_PNG && avctx->skip_frame == AVDISCARD_ALL) { -return 0; +goto exit_loop; } if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) { @@ -1256,6 +1256,9 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, case MKTAG('t', 'E', 'X', 't'): case MKTAG('I', 'D', 'A', 'T'): case MKTAG('t', 'R', 'N', 'S'): +case MKTAG('s', 'R', 'G', 'B'): +case MKTAG('c', 'I', 'C', 'P'): +case MKTAG('c', 'H', 'R', 'M'): break; default: continue; @@ -1382,6 +1385,56 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, } exit_loop: +if (s->have_cicp) { +if (s->cicp_primaries >= AVCOL_PRI_NB) +av_log(avctx, AV_LOG_WARNING, "unrecognized cICP primaries\n"); +else +avctx->color_primaries = p->color_primaries = s->cicp_primaries; +if (s->cicp_trc >= AVCOL_TRC_NB) +av_log(avctx, AV_LOG_WARNING, "unrecognized cICP transfer\n"); +else +avctx->color_trc = p->color_trc = s->cicp_trc; +/* we don't support tv-range RGB */ +avctx->color_range = p->color_range = AVCOL_RANGE_JPEG; +if (s->cicp_range == 0) +av_log(avctx, AV_LOG_WARNING, "unsupported tv-range cICP chunk\n"); +} else if (s->iccp_data) { +AVFrameSideData *sd = av_frame_new_side_data(p, AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len); +if (!sd) { +ret = AVERROR(ENOMEM); +goto fail; +} +memcpy(sd->data, s->iccp_data, s->iccp_data_len); + +av_dict_set(&sd->metadata, "name", s->iccp_name, 0); +} else if (s->have_srgb) { +avctx->color_primaries = p->color_primaries = AVCOL_PRI_BT709; +avctx->color_trc = p->color_trc = AVCOL_TRC_IEC61966_2_1; +} else if (s->have_chrm) { +AVColorPrimariesDesc desc; +enum AVColorPrimaries prim; +desc.wp.x = av_make_q(s->white_point[0], 10); +desc.wp.y = av_make_q(s->white_point[1], 10); +desc.prim.r.x = av_make_q(s->display_primaries[0][0], 10); +desc.prim.r.y = av_make_q(s->display_primaries[0][1], 10); +desc.prim.g.x = av_make_q(s->display_primaries[1][0], 10); +desc.prim.g.y = av_make_q(s->display_primaries[1][1], 10); +desc.prim.b.x = av_make_q(s->display_primaries[2][0], 10); +desc.prim.b.y = av_make_q(s->display_primaries[2][1], 10); +prim = av_csp_primaries_id_from_desc(&desc); +if (prim != AVCOL_PRI_UNSPECIFIED) +avctx->color_primaries = p->color_primaries = prim; +else +av_log(avctx, AV_LOG_WARNING, "unknown cHRM primaries\n"); +} + +/* these chunks override gAMA */ +if (s->iccp_data || s->have_srgb || s->have_cicp) +av_dict_set(&s->frame_metadata, "gamma", NULL, 0); + +avctx->colorspace = p->colorspace = AVCOL_SPC_RGB; +avctx->color_range = p->color_range = AVCOL_RANGE_JPEG; + if (avctx->codec_id == AV_CODEC_ID_PNG && avctx->skip_frame == AVDISCARD_ALL) { return 0; @@ -1499,56 +1552,8 @@ static void clear_frame_metadata(PNGDecContext *s) static int output_frame(PNGDecContext *s, AVFrame *f) { -AVCodecContext *avctx = s->avctx; int ret; -if (s->have_cicp) { -if (s->cicp_primaries >= AVCOL_PRI_NB) -av_log(avctx, AV_LOG_WARNING, "unrecognized cICP primaries\n"); -else -avctx->color_primaries = f->color_primaries = s->cicp_primaries; -if (s->cicp_trc >= AVCOL_TRC_NB) -av_log(avctx, AV_LOG_WARNING, "unrecognized cICP transfer\n"); -else -avctx->color_trc = f->color_trc = s->cicp_trc; -avctx->color_range = f->color_range = -s->cicp_range == 0 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; -} else if (s->iccp_data) { -AVFrameSideData *sd = av_frame_new_side_data(f, AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len); -if (!sd) { -ret = AVERROR(ENOMEM); -goto fail; -} -memcpy(sd->data, s->iccp_data, s->iccp_data_len); - -av_dict_set(&sd->metadata, "name", s->iccp_name, 0); -} else if (s->have_srgb) {
[FFmpeg-devel] [PATCH v3 3/3] avcodec/pngdec: populate enum transfer values from gAMA chunk
If the gAMA chunk is present, the gamma-transfer described by it often matches one of our enum values (e.g. gamma = 2.2). If so, we should populate the corresponding fields in AVCodecContext and AVFrame, provided that some other chunk isn't already providing that info. --- libavcodec/pngdec.c | 27 --- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index a80e0d15bb..b7751c64d8 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -75,6 +75,7 @@ typedef struct PNGDecContext { int have_chrm; uint32_t white_point[2]; uint32_t display_primaries[3][2]; +int gamma; int have_srgb; int have_cicp; enum AVColorPrimaries cicp_primaries; @@ -1259,6 +1260,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, case MKTAG('s', 'R', 'G', 'B'): case MKTAG('c', 'I', 'C', 'P'): case MKTAG('c', 'H', 'R', 'M'): +case MKTAG('g', 'A', 'M', 'A'): break; default: continue; @@ -1361,10 +1363,10 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, case MKTAG('g', 'A', 'M', 'A'): { AVBPrint bp; char *gamma_str; -int num = bytestream2_get_be32(&gb_chunk); +s->gamma = bytestream2_get_be32(&gb_chunk); av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED); -av_bprintf(&bp, "%i/%i", num, 10); +av_bprintf(&bp, "%i/%i", s->gamma, 10); ret = av_bprint_finalize(&bp, &gamma_str); if (ret < 0) return ret; @@ -1429,8 +1431,27 @@ exit_loop: } /* these chunks override gAMA */ -if (s->iccp_data || s->have_srgb || s->have_cicp) +if (s->iccp_data || s->have_srgb || s->have_cicp) { av_dict_set(&s->frame_metadata, "gamma", NULL, 0); +} else if (s->gamma) { +/* + * These values are 10/2.2, 10/2.8, 10/2.6, and + * 10/1.0 respectively. 45455, 35714, and 38462, and 10. + * There's a 0.001 gamma tolerance here in case of floating + * point issues when the PNG was written. + * + * None of the other enums have a pure gamma curve so it makes + * sense to leave those to sRGB and cICP. + */ +if (s->gamma > 45355 && s->gamma < 4) +avctx->color_trc = p->color_trc = AVCOL_TRC_GAMMA22; +else if (s->gamma > 35614 && s->gamma < 35814) +avctx->color_trc = p->color_trc = AVCOL_TRC_GAMMA28; +else if (s->gamma > 38362 && s->gamma < 38562) +avctx->color_trc = p->color_trc = AVCOL_TRC_SMPTE428; +else if (s->gamma > 99900 && s->gamma < 100100) +avctx->color_trc = p->color_trc = AVCOL_TRC_LINEAR; +} avctx->colorspace = p->colorspace = AVCOL_SPC_RGB; avctx->color_range = p->color_range = AVCOL_RANGE_JPEG; -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avformat/flvenc: add option meta_period
Allows to re-emit global metadata. Useful for dynamic metadata. Accepts values: at_start or 0, for insertion only at start at_keyframes or 1, for insertion at each video keyframe every_packet or 2, for insertion with all video packets --- doc/muxers.texi | 20 libavformat/flvenc.c | 22 +++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index ed5341be39..02ecddf186 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -535,6 +535,26 @@ at the end of stream. (Be used to non-seekable living stream). @item add_keyframe_index Used to facilitate seeking; particularly for HTTP pseudo streaming. @end table + +@item meta_period +Set interval at which to re-emit metadata. + +Possible values: + +@table @samp + +@item at_start +Only once, in the header at the start. (@var{default}) + +@item at_keyframes +With each video keyframe. + +@item every_packet +With every video packet. + +@end table +Note that metadata will always be re-emitted if a metadata update event is signalled. + @end table @anchor{framecrc} diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 128ae8ebc0..d1c7a493d1 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -71,6 +71,12 @@ typedef enum { FLV_NO_DURATION_FILESIZE = (1 << 4), } FLVFlags; +typedef enum { +FLV_META_ONCE_AT_START = 0, +FLV_META_AT_KF, +FLV_META_EVERY_PACKET, +} FLVMetaPeriod; + typedef struct FLVFileposition { int64_t keyframe_position; double keyframe_timestamp; @@ -117,6 +123,7 @@ typedef struct FLVContext { AVCodecParameters *data_par; int flags; +int meta_period; } FLVContext; typedef struct FLVStreamContext { @@ -822,7 +829,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) unsigned ts; int size = pkt->size; uint8_t *data = NULL; -int flags = -1, flags_size, ret = 0; +int flags = -1, flags_size, ret = 0, meta_upd_flag; int64_t cur_offset = avio_tell(pb); if (par->codec_type == AVMEDIA_TYPE_AUDIO && !pkt->size) { @@ -868,9 +875,14 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) ts = pkt->dts; -if (s->event_flags & AVSTREAM_EVENT_FLAG_METADATA_UPDATED) { +meta_upd_flag = s->event_flags & AVSTREAM_EVENT_FLAG_METADATA_UPDATED; + +if (meta_upd_flag || +(flv->meta_period == FLV_META_AT_KF&& par->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->flags & AV_PKT_FLAG_KEY)) || +(flv->meta_period == FLV_META_EVERY_PACKET && par->codec_type == AVMEDIA_TYPE_VIDEO )) { write_metadata(s, ts); -s->event_flags &= ~AVSTREAM_EVENT_FLAG_METADATA_UPDATED; +if (meta_upd_flag) +s->event_flags &= ~AVSTREAM_EVENT_FLAG_METADATA_UPDATED; } avio_write_marker(pb, av_rescale(ts, AV_TIME_BASE, 1000), @@ -1050,6 +1062,10 @@ static const AVOption options[] = { { "no_metadata", "disable metadata for FLV", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_NO_METADATA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" }, { "no_duration_filesize", "disable duration and filesize zero value metadata for FLV", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_NO_DURATION_FILESIZE}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" }, { "add_keyframe_index", "Add keyframe index metadata", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_ADD_KEYFRAME_INDEX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" }, +{ "meta_period", "metadata insertion period", offsetof(FLVContext, meta_period), AV_OPT_TYPE_INT, {.i64 = FLV_META_ONCE_AT_START}, FLV_META_ONCE_AT_START, FLV_META_EVERY_PACKET, AV_OPT_FLAG_ENCODING_PARAM, "meta_period" }, +{ "at_start", "only once at start",0, AV_OPT_TYPE_CONST, {.i64 = FLV_META_ONCE_AT_START}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "meta_period" }, +{ "at_keyframes", "with every video keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_META_AT_KF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "meta_period" }, +{ "every_packet", "with every video packet", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_META_EVERY_PACKET}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "meta_period" }, { NULL }, }; -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avformat/flvenc: add option to read metadata from file
Useful, in conjuntion with option meta_period, to vary metadata during stream. File format is ffmetadata. --- configure| 2 +- doc/muxers.texi | 3 + libavformat/flvenc.c | 134 +-- 3 files changed, 108 insertions(+), 31 deletions(-) diff --git a/configure b/configure index 9d78a244a3..de371632c4 100755 --- a/configure +++ b/configure @@ -3433,7 +3433,7 @@ eac3_demuxer_select="ac3_parser" f4v_muxer_select="mov_muxer" fifo_muxer_deps="threads" flac_demuxer_select="flac_parser" -flv_muxer_select="aac_adtstoasc_bsf" +flv_muxer_select="aac_adtstoasc_bsf ffmetadata_demuxer" gxf_muxer_select="pcm_rechunk_bsf" hds_muxer_select="flv_muxer" hls_demuxer_select="adts_header ac3_parser" diff --git a/doc/muxers.texi b/doc/muxers.texi index 02ecddf186..000c92b2a7 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -555,6 +555,9 @@ With every video packet. @end table Note that metadata will always be re-emitted if a metadata update event is signalled. +@item meta_filename +Specify a ffmetadata file from which to load metadata. + @end table @anchor{framecrc} diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index d1c7a493d1..f41f5a361f 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -122,6 +122,10 @@ typedef struct FLVContext { double framerate; AVCodecParameters *data_par; +char *meta_filename; +AVFormatContext *meta_ctx; +AVDictionary *meta_dict; + int flags; int meta_period; } FLVContext; @@ -277,6 +281,92 @@ static void put_amf_bool(AVIOContext *pb, int b) avio_w8(pb, !!b); } +static int read_metadata_from_file(AVFormatContext *s, unsigned int ts, int header) +{ +FLVContext *flv = s->priv_data; +const AVInputFormat *meta_format = NULL; +AVDictionary *current_meta_dict = NULL; +float timestamp = ts/1000.f; +int ret; + +if (!flv->meta_filename) +return 0; + +meta_format = av_find_input_format("ffmetadata"); +if (!meta_format) { +av_log(s, AV_LOG_ERROR, "ffmetadata demuxer not found.\n"); +return AVERROR(ENOSYS); +} + +avformat_close_input(&flv->meta_ctx); + +ret = avformat_open_input(&flv->meta_ctx, flv->meta_filename, meta_format, NULL); +if (ret < 0) { +av_log(s, AV_LOG_ERROR, "Failed to read metadata from file %s t: %f.", flv->meta_filename, timestamp); +if (flv->meta_dict) +av_log(s, AV_LOG_ERROR, " Continuing with old metadata."); +av_log(s, AV_LOG_ERROR, "\n"); +return ret; +} + +if (flv->meta_dict) { +av_dict_copy(¤t_meta_dict, flv->meta_dict, 0); +av_dict_free(&flv->meta_dict); +} + +ret = av_dict_copy(&flv->meta_dict, flv->meta_ctx->metadata, 0); +if (ret < 0) { +av_log(s, AV_LOG_ERROR, "Could not transfer metadata from %s at %f seconds. Continuing with old metadata.\n", flv->meta_filename, timestamp); +av_dict_free(&flv->meta_dict); +av_dict_copy(&flv->meta_dict, current_meta_dict, 0); +av_dict_free(¤t_meta_dict); +return ret; +} + +av_log(s, AV_LOG_VERBOSE, "Metadata from file %s updated %s at %f seconds.\n", flv->meta_filename, header ? "in header" : "in video packet", timestamp); +av_dict_free(¤t_meta_dict); +avformat_close_input(&flv->meta_ctx); + +return 0; +} + +static int write_user_metadata_tag(AVFormatContext *s, AVDictionaryEntry *tag, AVIOContext *pb, int *metadata_count) +{ + +av_log(s, AV_LOG_DEBUG, "Writing tag %s with value %s count: %d\n", tag->key, tag->value, *metadata_count); + +if( !strcmp(tag->key, "width") +||!strcmp(tag->key, "height") +||!strcmp(tag->key, "videodatarate") +||!strcmp(tag->key, "framerate") +||!strcmp(tag->key, "videocodecid") +||!strcmp(tag->key, "audiodatarate") +||!strcmp(tag->key, "audiosamplerate") +||!strcmp(tag->key, "audiosamplesize") +||!strcmp(tag->key, "stereo") +||!strcmp(tag->key, "audiocodecid") +||!strcmp(tag->key, "duration") +||!strcmp(tag->key, "onMetaData") +||!strcmp(tag->key, "datasize") +||!strcmp(tag->key, "lasttimestamp") +||!strcmp(tag->key, "totalframes") +||!strcmp(tag->key, "hasAudio") +||!strcmp(tag->key, "hasVideo") +||!strcmp(tag->key, "hasCuePoints") +||!strcmp(tag->key, "hasMetadata") +||!strcmp(tag->key, "hasKeyframes") +){ +av_log(s, AV_LOG_DEBUG, "Ignoring metadata for %s\n", tag->key); +return AVERROR(EINVAL); +} +put_amf_string(pb, tag->key); +avio_w8(pb, AMF_DATA_TYPE_STRING); +put_amf_string(pb, tag->value); +(*metadata_count)++; + +return 0; +} + static void write_metadata(AVFormatContext *s, unsigned int ts) { AVIOContext *pb = s->pb; @@ -360,36 +450,11 @@ static void write_metadata(AVFormatContext *s, unsigned int ts) } ff_standardize_creation_time
[FFmpeg-devel] [PATCH v2 1/2] avformat/flvenc: add option meta_period
Allows to re-emit global metadata. Useful for dynamic metadata. Accepts values: at_start or 0, for insertion only at start at_keyframes or 1, for insertion at each video keyframe every_packet or 2, for insertion with all video packets --- doc/muxers.texi | 20 libavformat/flvenc.c | 22 +++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index ed5341be39..02ecddf186 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -535,6 +535,26 @@ at the end of stream. (Be used to non-seekable living stream). @item add_keyframe_index Used to facilitate seeking; particularly for HTTP pseudo streaming. @end table + +@item meta_period +Set interval at which to re-emit metadata. + +Possible values: + +@table @samp + +@item at_start +Only once, in the header at the start. (@var{default}) + +@item at_keyframes +With each video keyframe. + +@item every_packet +With every video packet. + +@end table +Note that metadata will always be re-emitted if a metadata update event is signalled. + @end table @anchor{framecrc} diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 128ae8ebc0..d1c7a493d1 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -71,6 +71,12 @@ typedef enum { FLV_NO_DURATION_FILESIZE = (1 << 4), } FLVFlags; +typedef enum { +FLV_META_ONCE_AT_START = 0, +FLV_META_AT_KF, +FLV_META_EVERY_PACKET, +} FLVMetaPeriod; + typedef struct FLVFileposition { int64_t keyframe_position; double keyframe_timestamp; @@ -117,6 +123,7 @@ typedef struct FLVContext { AVCodecParameters *data_par; int flags; +int meta_period; } FLVContext; typedef struct FLVStreamContext { @@ -822,7 +829,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) unsigned ts; int size = pkt->size; uint8_t *data = NULL; -int flags = -1, flags_size, ret = 0; +int flags = -1, flags_size, ret = 0, meta_upd_flag; int64_t cur_offset = avio_tell(pb); if (par->codec_type == AVMEDIA_TYPE_AUDIO && !pkt->size) { @@ -868,9 +875,14 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) ts = pkt->dts; -if (s->event_flags & AVSTREAM_EVENT_FLAG_METADATA_UPDATED) { +meta_upd_flag = s->event_flags & AVSTREAM_EVENT_FLAG_METADATA_UPDATED; + +if (meta_upd_flag || +(flv->meta_period == FLV_META_AT_KF&& par->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->flags & AV_PKT_FLAG_KEY)) || +(flv->meta_period == FLV_META_EVERY_PACKET && par->codec_type == AVMEDIA_TYPE_VIDEO )) { write_metadata(s, ts); -s->event_flags &= ~AVSTREAM_EVENT_FLAG_METADATA_UPDATED; +if (meta_upd_flag) +s->event_flags &= ~AVSTREAM_EVENT_FLAG_METADATA_UPDATED; } avio_write_marker(pb, av_rescale(ts, AV_TIME_BASE, 1000), @@ -1050,6 +1062,10 @@ static const AVOption options[] = { { "no_metadata", "disable metadata for FLV", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_NO_METADATA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" }, { "no_duration_filesize", "disable duration and filesize zero value metadata for FLV", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_NO_DURATION_FILESIZE}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" }, { "add_keyframe_index", "Add keyframe index metadata", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_ADD_KEYFRAME_INDEX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" }, +{ "meta_period", "metadata insertion period", offsetof(FLVContext, meta_period), AV_OPT_TYPE_INT, {.i64 = FLV_META_ONCE_AT_START}, FLV_META_ONCE_AT_START, FLV_META_EVERY_PACKET, AV_OPT_FLAG_ENCODING_PARAM, "meta_period" }, +{ "at_start", "only once at start",0, AV_OPT_TYPE_CONST, {.i64 = FLV_META_ONCE_AT_START}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "meta_period" }, +{ "at_keyframes", "with every video keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_META_AT_KF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "meta_period" }, +{ "every_packet", "with every video packet", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_META_EVERY_PACKET}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "meta_period" }, { NULL }, }; -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 2/2] avformat/flvenc: add option to read metadata from file
Useful, in conjuntion with option meta_period, to vary metadata during stream. File format is ffmetadata. --- configure| 2 +- doc/muxers.texi | 3 + libavformat/flvenc.c | 133 +-- 3 files changed, 107 insertions(+), 31 deletions(-) diff --git a/configure b/configure index 9d78a244a3..de371632c4 100755 --- a/configure +++ b/configure @@ -3433,7 +3433,7 @@ eac3_demuxer_select="ac3_parser" f4v_muxer_select="mov_muxer" fifo_muxer_deps="threads" flac_demuxer_select="flac_parser" -flv_muxer_select="aac_adtstoasc_bsf" +flv_muxer_select="aac_adtstoasc_bsf ffmetadata_demuxer" gxf_muxer_select="pcm_rechunk_bsf" hds_muxer_select="flv_muxer" hls_demuxer_select="adts_header ac3_parser" diff --git a/doc/muxers.texi b/doc/muxers.texi index 02ecddf186..000c92b2a7 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -555,6 +555,9 @@ With every video packet. @end table Note that metadata will always be re-emitted if a metadata update event is signalled. +@item meta_filename +Specify a ffmetadata file from which to load metadata. + @end table @anchor{framecrc} diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index d1c7a493d1..1332b18b41 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -122,6 +122,10 @@ typedef struct FLVContext { double framerate; AVCodecParameters *data_par; +char *meta_filename; +AVFormatContext *meta_ctx; +AVDictionary *meta_dict; + int flags; int meta_period; } FLVContext; @@ -277,6 +281,92 @@ static void put_amf_bool(AVIOContext *pb, int b) avio_w8(pb, !!b); } +static int read_metadata_from_file(AVFormatContext *s, unsigned int ts, int header) +{ +FLVContext *flv = s->priv_data; +const AVInputFormat *meta_format = NULL; +AVDictionary *current_meta_dict = NULL; +float timestamp = ts/1000.f; +int ret; + +if (!flv->meta_filename) +return 0; + +meta_format = av_find_input_format("ffmetadata"); +if (!meta_format) { +av_log(s, AV_LOG_ERROR, "ffmetadata demuxer not found.\n"); +return AVERROR(ENOSYS); +} + +avformat_close_input(&flv->meta_ctx); + +ret = avformat_open_input(&flv->meta_ctx, flv->meta_filename, meta_format, NULL); +if (ret < 0) { +av_log(s, AV_LOG_ERROR, "Failed to read metadata from file %s t: %f.", flv->meta_filename, timestamp); +if (flv->meta_dict) +av_log(s, AV_LOG_ERROR, " Continuing with old metadata."); +av_log(s, AV_LOG_ERROR, "\n"); +return ret; +} + +if (flv->meta_dict) { +av_dict_copy(¤t_meta_dict, flv->meta_dict, 0); +av_dict_free(&flv->meta_dict); +} + +ret = av_dict_copy(&flv->meta_dict, flv->meta_ctx->metadata, 0); +if (ret < 0) { +av_log(s, AV_LOG_ERROR, "Could not transfer metadata from %s at %f seconds. Continuing with old metadata.\n", flv->meta_filename, timestamp); +av_dict_free(&flv->meta_dict); +av_dict_copy(&flv->meta_dict, current_meta_dict, 0); +av_dict_free(¤t_meta_dict); +return ret; +} + +av_log(s, AV_LOG_VERBOSE, "Metadata from file %s updated %s at %f seconds.\n", flv->meta_filename, header ? "in header" : "in video packet", timestamp); +av_dict_free(¤t_meta_dict); +avformat_close_input(&flv->meta_ctx); + +return 0; +} + +static int write_user_metadata_tag(AVFormatContext *s, AVDictionaryEntry *tag, AVIOContext *pb, int *metadata_count) +{ + +av_log(s, AV_LOG_DEBUG, "Writing tag %s with value %s count: %d\n", tag->key, tag->value, *metadata_count); + +if( !strcmp(tag->key, "width") +||!strcmp(tag->key, "height") +||!strcmp(tag->key, "videodatarate") +||!strcmp(tag->key, "framerate") +||!strcmp(tag->key, "videocodecid") +||!strcmp(tag->key, "audiodatarate") +||!strcmp(tag->key, "audiosamplerate") +||!strcmp(tag->key, "audiosamplesize") +||!strcmp(tag->key, "stereo") +||!strcmp(tag->key, "audiocodecid") +||!strcmp(tag->key, "duration") +||!strcmp(tag->key, "onMetaData") +||!strcmp(tag->key, "datasize") +||!strcmp(tag->key, "lasttimestamp") +||!strcmp(tag->key, "totalframes") +||!strcmp(tag->key, "hasAudio") +||!strcmp(tag->key, "hasVideo") +||!strcmp(tag->key, "hasCuePoints") +||!strcmp(tag->key, "hasMetadata") +||!strcmp(tag->key, "hasKeyframes") +){ +av_log(s, AV_LOG_DEBUG, "Ignoring metadata for %s\n", tag->key); +return AVERROR(EINVAL); +} +put_amf_string(pb, tag->key); +avio_w8(pb, AMF_DATA_TYPE_STRING); +put_amf_string(pb, tag->value); +(*metadata_count)++; + +return 0; +} + static void write_metadata(AVFormatContext *s, unsigned int ts) { AVIOContext *pb = s->pb; @@ -360,36 +450,11 @@ static void write_metadata(AVFormatContext *s, unsigned int ts) } ff_standardize_creation_time
Re: [FFmpeg-devel] [PATCH] Waveform Archiver decoder and demuxer
ons 2023-02-01 klockan 10:42 +0100 skrev Nicolas George: > Tomas Härdin (12023-02-01): > > This belongs in the demuxer. In fact it appears the decoder > > duplicates > > code from the demuxer. Why? > > Because sharing code between demuxer and decoder is extremely > annoying, > because somebody decided the libraries must be separate even though > all > the technical reasons for it have less annoying solutions. Carrying information like sample rate from demuxer to decoder happens all the time.. /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavformat/mpegtsenc.c -- correctly re-emit extradata ahead of IDR pictures
On Mon, Jan 30, 2023 at 4:12 PM Marton Balint wrote: > > For normal mpegts it also makes sense to include SPS/PPS before IDR-s, so > I'd say it is better if it is fixed in mpegtsenc. > > But it is mandatory to insert AUD NAL-s for every frame, and your patch > breaks that, because it only inserts it if SPS/PPS is also inserted, > because you changed > > if ((state & 0x1f) != 9) { // AUD NAL > > to > > if (extradd > 0) { > > So you need to rework your patch to keep the AUD insertion (but you don't > want to duplicate it of course). > > Regards, > Marton > Marton, thank you for this explanation. I understand now. There's an updated patch that preserves AUD insertion at http://ffmpeg.org/pipermail/ffmpeg-devel/2023-January/306143.html Posting to bump the visibility of that one, which perhaps should have been tagged "v2", whoops. Should I repost with "v2" to start a new thread? Cheers, John ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/h264_metadata_bsf: remove AUDs at any position
Some files, likely due to faulty packetization or muxing, can have AUDs at other positions besides the head unit of a packet. Remove these too. --- libavcodec/h264_metadata_bsf.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index d318bf0cee..6fab0190d4 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -469,12 +469,13 @@ static int h264_metadata_update_fragment(AVBSFContext *bsf, AVPacket *pkt, H264MetadataContext *ctx = bsf->priv_data; int err, i, has_sps, seek_point; -// If an AUD is present, it must be the first NAL unit. -if (au->nb_units && au->units[0].type == H264_NAL_AUD) { -if (ctx->aud == BSF_ELEMENT_REMOVE) -ff_cbs_delete_unit(au, 0); -} else { -if (pkt && ctx->aud == BSF_ELEMENT_INSERT) { +if (ctx->aud == BSF_ELEMENT_REMOVE) { +for (i = 0; i < au->nb_units; i++) { +if (au->units[i].type == H264_NAL_AUD) +ff_cbs_delete_unit(au, i); +} +} else if (ctx->aud == BSF_ELEMENT_INSERT) { +if (pkt) { err = h264_metadata_insert_aud(bsf, au); if (err < 0) return err; -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/tee: signal EOF if no more output is to be published.
Prior to 2d924b3a630, ffmpeg.c would exit if any packet write failed. tee's write_packet seemingly relied on that to enforce its abort failure policy. >From 2d924b3a630, ffmpeg only closes that OutputStream and keeps on sending packets of other streams. This breaks the abort behaviour with the tee muxer when there are multiple streams, leaving the ffmpeg process running beyond the intended point of abortion. Fixed by signaling EOF in tee's write_packet if an abort is required. --- libavformat/tee.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/tee.c b/libavformat/tee.c index dd408dd096..8362cdc972 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -54,6 +54,7 @@ typedef struct TeeContext { const AVClass *class; unsigned nb_slaves; unsigned nb_alive; +int abort; TeeSlave *slaves; int use_fifo; AVDictionary *fifo_options; @@ -438,6 +439,7 @@ static int tee_process_slave_failure(AVFormatContext *avf, unsigned slave_idx, i return err_n; } else if (tee_slave->on_fail == ON_SLAVE_FAILURE_ABORT) { av_log(avf, AV_LOG_ERROR, "Slave muxer #%u failed, aborting.\n", slave_idx); +tee->abort = 1; return err_n; } else { av_log(avf, AV_LOG_ERROR, "Slave muxer #%u failed: %s, continuing with %u/%u slaves.\n", @@ -599,7 +601,7 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt) ret_all = ret; } } -return ret_all; +return (tee->abort || !tee->nb_alive) ? AVERROR_EOF : ret_all; } const AVOutputFormat ff_tee_muxer = { -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [CLT2023] FFmpeg at Chemnitzer Linux-Tage
Hi, once again after the pandemic break, FFmpeg has been accepted for CLT 2023 in Chemnitz, Germany! This "Chemnitzer Linux Tage" will take place on 11th and 12th of March. You can find more details on their homepage: https://chemnitzer.linux-tage.de/2023/en/ We will man a booth with our staff and are happily waiting for our users to get in touch with us! If you're a developer and want to help us or just want to visit and check in at our booth, please let us know. FFmpeg can sponsor your travels and accomodation at Chemnitz for the duration of the conference! Currently registered for the CLT team, more attendees appreciated: Carl Eugen Hoyos Thomas Volkert Alexander Strasser Thilo Borgmann We would like to encourage everyone visiting the CLT to bring us sample files and/or command lines that show suspicious or buggy behavior - this will be your change to get your bug fixed right away! See you in Chemnitz! -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/tee: signal EOF if no more output is to be published.
On Thu, 2 Feb 2023, Gyan Doshi wrote: Prior to 2d924b3a630, ffmpeg.c would exit if any packet write failed. tee's write_packet seemingly relied on that to enforce its abort failure policy. From 2d924b3a630, ffmpeg only closes that OutputStream and keeps on sending packets of other streams. Hmm, are you sure? I glanced at the code and it seems to me that any failure of av_interleaved_write_frame() will cause the muxing thread to exit. So I don't quite see how other streams can receive packets. Thanks, Marton This breaks the abort behaviour with the tee muxer when there are multiple streams, leaving the ffmpeg process running beyond the intended point of abortion. Fixed by signaling EOF in tee's write_packet if an abort is required. --- libavformat/tee.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/tee.c b/libavformat/tee.c index dd408dd096..8362cdc972 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -54,6 +54,7 @@ typedef struct TeeContext { const AVClass *class; unsigned nb_slaves; unsigned nb_alive; +int abort; TeeSlave *slaves; int use_fifo; AVDictionary *fifo_options; @@ -438,6 +439,7 @@ static int tee_process_slave_failure(AVFormatContext *avf, unsigned slave_idx, i return err_n; } else if (tee_slave->on_fail == ON_SLAVE_FAILURE_ABORT) { av_log(avf, AV_LOG_ERROR, "Slave muxer #%u failed, aborting.\n", slave_idx); +tee->abort = 1; return err_n; } else { av_log(avf, AV_LOG_ERROR, "Slave muxer #%u failed: %s, continuing with %u/%u slaves.\n", @@ -599,7 +601,7 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt) ret_all = ret; } } -return ret_all; +return (tee->abort || !tee->nb_alive) ? AVERROR_EOF : ret_all; } const AVOutputFormat ff_tee_muxer = { -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 01/10] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile
From: Linjie Fu Described in HEVC spec A.3.7. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- update: fix accidential fail in FATE. libavcodec/avcodec.h | 1 + libavcodec/hevc_ps.c | 2 ++ libavcodec/profiles.c | 1 + 3 files changed, 4 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 90b437ccbe..9e36d2402a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1672,6 +1672,7 @@ typedef struct AVCodecContext { #define FF_PROFILE_HEVC_MAIN_10 2 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT4 +#define FF_PROFILE_HEVC_SCC 9 #define FF_PROFILE_VVC_MAIN_10 1 #define FF_PROFILE_VVC_MAIN_10_444 33 diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 5fe62ec35b..4aa5b76d5f 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -259,6 +259,8 @@ static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n"); else if (ptl->profile_idc == FF_PROFILE_HEVC_REXT) av_log(avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n"); +else if (ptl->profile_idc == FF_PROFILE_HEVC_SCC) +av_log(avctx, AV_LOG_DEBUG, "Screen Content Coding Extension profile bitstream\n"); else av_log(avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc); diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c index 7af7fbeb13..2230fc5415 100644 --- a/libavcodec/profiles.c +++ b/libavcodec/profiles.c @@ -85,6 +85,7 @@ const AVProfile ff_hevc_profiles[] = { { FF_PROFILE_HEVC_MAIN_10, "Main 10" }, { FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" }, { FF_PROFILE_HEVC_REXT, "Rext"}, +{ FF_PROFILE_HEVC_SCC, "Scc" }, { FF_PROFILE_UNKNOWN }, }; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 02/10] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax
From: Linjie Fu 1. Add extension syntax according to 7.3.2.2.3/7.3.2.3.3 in T-REC-H.265-201911. 2. Keep using parsed PPS when bitstream overread for compatibility. For example, the clip PS_A_VIDYO_3.bit in FATE test has incomplete extension syntax which will be overread and un-decodable if without this change. 3. Format brace in pps_range_extensions(). Signed-off-by: Linjie Fu Signed-off-by: Haihao Xiang Signed-off-by: Fei Wang --- libavcodec/hevc.h| 3 + libavcodec/hevc_ps.c | 289 +-- libavcodec/hevc_ps.h | 69 +++ 3 files changed, 349 insertions(+), 12 deletions(-) diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h index 1804755327..6b454a75c1 100644 --- a/libavcodec/hevc.h +++ b/libavcodec/hevc.h @@ -154,6 +154,9 @@ enum { // get near that, though, so set a lower limit here with the maximum // possible value for 4K video (at most 135 16x16 Ctb rows). HEVC_MAX_ENTRY_POINT_OFFSETS = HEVC_MAX_TILE_COLUMNS * 135, + +// A.3.7: Screen content coding extensions +HEVC_MAX_PALETTE_PREDICTOR_SIZE = 128, }; diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 4aa5b76d5f..348e4d8de2 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -853,7 +853,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, HEVCWindow *ow; int ret = 0; int log2_diff_max_min_transform_block_size; -int bit_depth_chroma, start, vui_present, sublayer_ordering_info; +int bit_depth_chroma, start, vui_present, sublayer_ordering_info, num_comps; int i; // Coded parameters @@ -1074,8 +1074,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, decode_vui(gb, avctx, apply_defdispwin, sps); if (get_bits1(gb)) { // sps_extension_flag -sps->sps_range_extension_flag = get_bits1(gb); -skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7); +sps->sps_range_extension_flag = get_bits1(gb); +sps->sps_multilayer_extension_flag = get_bits1(gb); +sps->sps_3d_extension_flag = get_bits1(gb); +sps->sps_scc_extension_flag= get_bits1(gb); +skip_bits(gb, 4); // sps_extension_4bits + if (sps->sps_range_extension_flag) { sps->transform_skip_rotation_enabled_flag = get_bits1(gb); sps->transform_skip_context_enabled_flag = get_bits1(gb); @@ -1101,6 +1105,57 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, av_log(avctx, AV_LOG_WARNING, "cabac_bypass_alignment_enabled_flag not yet implemented\n"); } + +if (sps->sps_multilayer_extension_flag) { +skip_bits1(gb); // inter_view_mv_vert_constraint_flag +av_log(avctx, AV_LOG_WARNING, + "sps_multilayer_extension_flag not yet implemented\n"); +} + +if (sps->sps_3d_extension_flag) { +for (i = 0; i <= 1; i++) { +skip_bits1(gb); // iv_di_mc_enabled_flag +skip_bits1(gb); // iv_mv_scal_enabled_flag +if (i == 0) { +get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 +skip_bits1(gb); // iv_res_pred_enabled_flag +skip_bits1(gb); // depth_ref_enabled_flag +skip_bits1(gb); // vsp_mc_enabled_flag +skip_bits1(gb); // dbbp_enabled_flag +} else { +skip_bits1(gb); // tex_mc_enabled_flag +get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 +skip_bits1(gb); // intra_contour_enabled_flag +skip_bits1(gb); // intra_dc_only_wedge_enabled_flag +skip_bits1(gb); // cqt_cu_part_pred_enabled_flag +skip_bits1(gb); // inter_dc_only_enabled_flag +skip_bits1(gb); // skip_intra_enabled_flag +} +} +av_log(avctx, AV_LOG_WARNING, + "sps_3d_extension_flag not yet implemented\n"); +} + +if (sps->sps_scc_extension_flag) { +sps->sps_curr_pic_ref_enabled_flag = get_bits1(gb); +sps->palette_mode_enabled_flag = get_bits1(gb); +if (sps->palette_mode_enabled_flag) { +sps->palette_max_size = get_ue_golomb_long(gb); +sps->delta_palette_max_predictor_size = get_ue_golomb_long(gb); +sps->sps_palette_predictor_initializers_present_flag = get_bits1(gb); + +if (sps->sps_palette_predictor_initializers_present_flag) { +sps->sps_num_palette_predictor_initializers_minus1 = get_ue_golomb_long(gb); +num_comps = !sps->chroma_format_idc ? 1 : 3; +for (int comp = 0; comp < num_comps; comp++) +for (i = 0; i <= sps->sps_num_palette_predic
[FFmpeg-devel] [PATCH v4 03/10] lavc/hevcdec: Add slice parse support for HEVC SCC extension
From: Linjie Fu Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.c | 6 ++ libavcodec/hevcdec.h | 4 2 files changed, 10 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 567e8d81d4..f9a97ac7f5 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -856,6 +856,12 @@ static int hls_slice_header(HEVCContext *s) sh->slice_cr_qp_offset = 0; } +if (s->ps.pps->pps_slice_act_qp_offsets_present_flag) { +sh->slice_act_y_qp_offset = get_se_golomb(gb); +sh->slice_act_cb_qp_offset = get_se_golomb(gb); +sh->slice_act_cr_qp_offset = get_se_golomb(gb); +} + if (s->ps.pps->chroma_qp_offset_list_enabled_flag) sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb); else diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 9d3f4adbb3..7841ba8565 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -295,6 +295,10 @@ typedef struct SliceHeader { int slice_cb_qp_offset; int slice_cr_qp_offset; +int slice_act_y_qp_offset; +int slice_act_cb_qp_offset; +int slice_act_cr_qp_offset; + uint8_t cu_chroma_qp_offset_enabled_flag; int beta_offset;///< beta_offset_div2 * 2 -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 04/10] lavc/hevcdec: Fix the parsing for use_integer_mv_flag
From: Linjie Fu According to 7.3.6.1, use_integer_mv_flag should be parsed if motion_vector_resolution_control_idc equals to 2. If not present, it equals to motion_vector_resolution_control_idc. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.c | 8 libavcodec/hevcdec.h | 1 + 2 files changed, 9 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index f9a97ac7f5..52fa627133 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -839,6 +839,14 @@ static int hls_slice_header(HEVCContext *s) sh->max_num_merge_cand); return AVERROR_INVALIDDATA; } + +// Syntax in 7.3.6.1 +if (s->ps.sps->motion_vector_resolution_control_idc == 2) +sh->use_integer_mv_flag = get_bits1(gb); +else +// Inferred to be equal to motion_vector_resolution_control_idc if not present +sh->use_integer_mv_flag = s->ps.sps->motion_vector_resolution_control_idc; + } sh->slice_qp_delta = get_se_golomb(gb); diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 7841ba8565..a7fc669bcb 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -305,6 +305,7 @@ typedef struct SliceHeader { int tc_offset; ///< tc_offset_div2 * 2 unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand +uint8_t use_integer_mv_flag; unsigned *entry_point_offset; int * offset; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 05/10] lavc/hevcdec: Set max_num_merge_cand to uint8_t
From: Linjie Fu uint8_t is big enough and keep consistent with the definition in cbs_h265.h. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index a7fc669bcb..aab816791e 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -304,7 +304,7 @@ typedef struct SliceHeader { int beta_offset;///< beta_offset_div2 * 2 int tc_offset; ///< tc_offset_div2 * 2 -unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand +uint8_t max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand uint8_t use_integer_mv_flag; unsigned *entry_point_offset; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 08/10] lavc/vaapi_hevc: Add vaapi profile parse support for SCC
From: Linjie Fu Note that Screen-Extended Main 4:4:4 and 4:4:4 10 supports chroma_format_idc from 0, 1 or 3, hence both 420 and 444 are supported. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_decode.c | 4 +++- libavcodec/vaapi_hevc.c | 14 -- libavcodec/vaapi_hevc.h | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 134f10eca5..ab8c12e364 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -410,7 +410,9 @@ static const struct { #endif #if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL MAP(HEVC,HEVC_REXT, None, - ff_vaapi_parse_hevc_rext_profile ), + ff_vaapi_parse_hevc_rext_scc_profile ), +MAP(HEVC,HEVC_SCC,None, + ff_vaapi_parse_hevc_rext_scc_profile ), #endif MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT, JPEGBaseline), diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 73a8f5b4ce..c10617a81a 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -586,9 +586,9 @@ static int ptl_convert(const PTLCommon *general_ptl, H265RawProfileTierLevel *h2 } /* - * Find exact va_profile for HEVC Range Extension + * Find exact va_profile for HEVC Range Extension and Screen Content Coding Extension */ -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx) { const HEVCContext *h = avctx->priv_data; const HEVCSPS *sps = h->ps.sps; @@ -627,6 +627,16 @@ VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) else if (!strcmp(profile->name, "Main 4:4:4 12") || !strcmp(profile->name, "Main 4:4:4 12 Intra")) return VAProfileHEVCMain444_12; +else if (!strcmp(profile->name, "Screen-Extended Main")) +return VAProfileHEVCSccMain; +else if (!strcmp(profile->name, "Screen-Extended Main 10")) +return VAProfileHEVCSccMain10; +else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4")) +return VAProfileHEVCSccMain444; +#if VA_CHECK_VERSION(1, 8, 0) +else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4 10")) +return VAProfileHEVCSccMain444_10; +#endif #else av_log(avctx, AV_LOG_WARNING, "HEVC profile %s is " "not supported with this VA version.\n", profile->name); diff --git a/libavcodec/vaapi_hevc.h b/libavcodec/vaapi_hevc.h index b3b0e6fc1e..449635d0d7 100644 --- a/libavcodec/vaapi_hevc.h +++ b/libavcodec/vaapi_hevc.h @@ -22,6 +22,6 @@ #include #include "avcodec.h" -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx); +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx); #endif /* AVCODEC_VAAPI_HEVC_H */ -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 06/10] lavc/hevc: Update reference list for SCC
From: Linjie Fu Screen Content Coding allows non-intra slice in an IRAP frame which can reference the frame itself, and would mark the current decoded picture as "used for long-term reference", no matter TwoVersionsOfCurrDecPicFlag(8.1.3), hence some previous restricts are not suitable any more. Constructe RefPicListTemp and RefPicList according to 8-8/9/10. Disable slice decoding for SCC profile to avoid unexpected error in hevc native decoder and patch welcome. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevc_refs.c | 21 - libavcodec/hevcdec.c | 10 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 811e8feff8..96153a2459 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -322,7 +322,7 @@ int ff_hevc_slice_rpl(HEVCContext *s) return ret; if (!(s->rps[ST_CURR_BEF].nb_refs + s->rps[ST_CURR_AFT].nb_refs + - s->rps[LT_CURR].nb_refs)) { + s->rps[LT_CURR].nb_refs) && !s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Zero refs in the frame RPS.\n"); return AVERROR_INVALIDDATA; } @@ -349,6 +349,13 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl_tmp.nb_refs++; } } +// Construct RefPicList0, RefPicList1 (8-8, 8-10) +if (s->ps.pps->pps_curr_pic_ref_enabled_flag) { +rpl_tmp.list[rpl_tmp.nb_refs] = s->ref->poc; +rpl_tmp.ref[rpl_tmp.nb_refs]= s->ref; +rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = 1; +rpl_tmp.nb_refs++; +} } /* reorder the references if necessary */ @@ -371,6 +378,14 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl->nb_refs = FFMIN(rpl->nb_refs, sh->nb_refs[list_idx]); } +// 8-9 +if (s->ps.pps->pps_curr_pic_ref_enabled_flag && +!sh->rpl_modification_flag[list_idx] && +rpl_tmp.nb_refs > sh->nb_refs[L0]) { +rpl->list[sh->nb_refs[L0] - 1] = s->ref->poc; +rpl->ref[sh->nb_refs[L0] - 1] = s->ref; +} + if (sh->collocated_list == list_idx && sh->collocated_ref_idx < rpl->nb_refs) s->ref->collocated_ref = rpl->ref[sh->collocated_ref_idx]; @@ -541,5 +556,9 @@ int ff_hevc_frame_nb_refs(const HEVCContext *s) for (i = 0; i < long_rps->nb_refs; i++) ret += !!long_rps->used[i]; } + +if (s->ps.pps->pps_curr_pic_ref_enabled_flag) +ret++; + return ret; } diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 52fa627133..121ceb4e75 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -668,7 +668,8 @@ static int hls_slice_header(HEVCContext *s) sh->slice_type); return AVERROR_INVALIDDATA; } -if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) { +if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I && +!s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); return AVERROR_INVALIDDATA; } @@ -3123,6 +3124,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) if (ret < 0) goto fail; } else { +if (s->avctx->profile == FF_PROFILE_HEVC_SCC) { +av_log(s->avctx, AV_LOG_ERROR, + "SCC profile is not yet implemented in hevc native decoder.\n"); +ret = AVERROR_PATCHWELCOME; +goto fail; +} + if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0) ctb_addr_ts = hls_slice_data_wpp(s, nal); else -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 09/10] lavc/vaapi_hevc: Set correct rps type for scc
From: Linjie Fu According to 8.1.3 and 8.3.2. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index c10617a81a..29c75e88f0 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -71,6 +71,7 @@ static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) { VASurfaceID pic_surf = ff_vaapi_get_surface_id(pic->frame); +const HEVCFrame *current_picture = h->ref; int i; for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; i++) { @@ -88,6 +89,9 @@ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) return VA_PICTURE_HEVC_RPS_LT_CURR; } +if (h->ps.pps->pps_curr_pic_ref_enabled_flag && current_picture->poc == pic->poc) +return VA_PICTURE_HEVC_LONG_TERM_REFERENCE; + return 0; } -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 10/10] lavc/vaapi_hevc: Loose the restricts for SCC decoding
From: Linjie Fu Allow current picture as the reference picture. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 29c75e88f0..42e1b62fc3 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -104,7 +104,8 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, VAPictureParameter const HEVCFrame *frame = NULL; while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) { -if (&h->DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) +if ((&h->DPB[j] != current_picture || h->ps.pps->pps_curr_pic_ref_enabled_flag) && +(h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) frame = &h->DPB[j]; j++; } @@ -222,7 +223,8 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, } #if VA_CHECK_VERSION(1, 2, 0) -if (avctx->profile == FF_PROFILE_HEVC_REXT) { +if (avctx->profile == FF_PROFILE_HEVC_REXT || +avctx->profile == FF_PROFILE_HEVC_SCC) { pic->pic_param.rext = (VAPictureParameterBufferHEVCRext) { .range_extension_pic_fields.bits = { .transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled_flag, -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 07/10] lavc/vaapi_hevc: Pass SCC parameters Through VA-API
From: Linjie Fu Including sps/pps/slice parameters. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 52 + 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 20fb36adfa..73a8f5b4ce 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -124,7 +124,7 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, const HEVCPPS *pps = h->ps.pps; const ScalingList *scaling_list = NULL; -int pic_param_size, err, i; +int pic_param_size, num_comps, pre_palette_size, err, i; VAPictureParameterBufferHEVC *pic_param = (VAPictureParameterBufferHEVC *)&pic->pic_param; @@ -245,8 +245,46 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, for (i = 0; i < 6; i++) pic->pic_param.rext.cr_qp_offset_list[i]= pps->cr_qp_offset_list[i]; } + +pre_palette_size = pps->pps_palette_predictor_initializers_present_flag ? + pps->pps_num_palette_predictor_initializers : + (sps->sps_palette_predictor_initializers_present_flag ? + sps->sps_num_palette_predictor_initializers_minus1 + 1 : + 0); + +if (avctx->profile == FF_PROFILE_HEVC_SCC) { +pic->pic_param.scc = (VAPictureParameterBufferHEVCScc) { +.screen_content_pic_fields.bits = { +.pps_curr_pic_ref_enabled_flag = pps->pps_curr_pic_ref_enabled_flag, +.palette_mode_enabled_flag = sps->palette_mode_enabled_flag, +.motion_vector_resolution_control_idc = sps->motion_vector_resolution_control_idc, +.intra_boundary_filtering_disabled_flag = sps->intra_boundary_filtering_disabled_flag, +.residual_adaptive_colour_transform_enabled_flag += pps->residual_adaptive_colour_transform_enabled_flag, +.pps_slice_act_qp_offsets_present_flag = pps->pps_slice_act_qp_offsets_present_flag, +}, +.palette_max_size = sps->palette_max_size, +.delta_palette_max_predictor_size = sps->delta_palette_max_predictor_size, +.predictor_palette_size = pre_palette_size, +.pps_act_y_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_y_qp_offset + 5 : 0, +.pps_act_cb_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cb_qp_offset + 5 : 0, +.pps_act_cr_qp_offset_plus3 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cr_qp_offset + 3 : 0, +}; + +num_comps = pps->monochrome_palette_flag ? 1 : 3; +for (int comp = 0; comp < num_comps; comp++) +for (int j = 0; j < pre_palette_size; j++) +pic->pic_param.scc.predictor_palette_entries[comp][j] = +pps->pps_palette_predictor_initializers_present_flag ? +pps->pps_palette_predictor_initializer[comp][j]: +sps->sps_palette_predictor_initializer[comp][j]; +} + #endif -pic_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? +pic_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->pic_param) : sizeof(VAPictureParameterBufferHEVC); err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic, @@ -299,7 +337,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx) VASliceParameterBufferHEVC *last_slice_param = (VASliceParameterBufferHEVC *)&pic->last_slice_param; int ret; -int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? +int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->last_slice_param) : sizeof(VASliceParameterBufferHEVC); if (pic->last_size) { @@ -413,7 +451,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx, VAAPIDecodePictureHEVC *pic = h->ref->hwaccel_picture_private; VASliceParameterBufferHEVC *last_slice_param = (VASliceParameterBufferHEVC *)&pic->last_slice_param; -int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? +int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->last_slice_param) : sizeof(VASliceParameterBufferHEVC); int nb_list = (sh->slice_type == HEVC_SLICE_B) ? @@ -478,11 +516,15 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx
Re: [FFmpeg-devel] [PATCH] lavc: deprecate CrystalHD decoders
On Tue, 31 Jan 2023 13:17:56 +0100 Anton Khirnov wrote: > The hardware is old and not relevant today. The decoders also have > many special quirks and are effectively unmaintained. > --- > Philip confirmed on IRC that he no longer has the hardware for > maintaining this and does not believe it is relevant today. > --- > Changelog | 1 + > MAINTAINERS| 2 -- > configure | 4 +++- > libavcodec/crystalhd.c | 4 > libavcodec/version_major.h | 3 +++ > 5 files changed, 11 insertions(+), 3 deletions(-) Ack. Thanks for doing this. --phil ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/tee: signal EOF if no more output is to be published.
On 2023-02-03 04:17 am, Marton Balint wrote: On Thu, 2 Feb 2023, Gyan Doshi wrote: Prior to 2d924b3a630, ffmpeg.c would exit if any packet write failed. tee's write_packet seemingly relied on that to enforce its abort failure policy. From 2d924b3a630, ffmpeg only closes that OutputStream and keeps on sending packets of other streams. Hmm, are you sure? I glanced at the code and it seems to me that any failure of av_interleaved_write_frame() will cause the muxing thread to exit. So I don't quite see how other streams can receive packets. Steps to reproduce: 1) ffmpeg -readrate 1 -stream_loop -1 -i INPUT -map 0:v -map 0:a -c copy -f tee "[f=flv:onfail=abort]rtmp://url/playpath|[f=null:onfail=ignore]stub" 2) Kill the rtmp endpoint at the server side. The tee muxer logs that it's aborting, however, ffmpeg keeps running. Contrast with 5.1 or earlier, which exit. av_iwf returns EOF which just results in a call to tq_receive_finish() for that ost without breaking muxer_thread's loop. Reards, Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] lavu/hwcontext_qsv: add support for UYVY
From: Haihao Xiang The SDK supports UYVY from version 1.17, and VPP may support UYVY input on Linux [1] $ ffmpeg -loglevel verbose -init_hw_device qsv=intel -f lavfi -i \ yuvtestsrc -vf \ "format=uyvy422,hwupload=extra_hw_frames=32,vpp_qsv=format=nv12" \ -f null - [1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/samples/readme-vpp_linux.md Signed-off-by: Haihao Xiang --- libavutil/hwcontext_qsv.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index ec0f72b329..42851d4fd5 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -118,6 +118,8 @@ static const struct { #if CONFIG_VAAPI { AV_PIX_FMT_YUYV422, MFX_FOURCC_YUY2, 0 }, +{ AV_PIX_FMT_UYVY422, + MFX_FOURCC_UYVY, 0 }, { AV_PIX_FMT_Y210, MFX_FOURCC_Y210, 1 }, // VUYX is used for VAAPI child device, @@ -1556,6 +1558,11 @@ static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface) // use the value from the frame. surface->Data.A = frame->data[0] + 6; break; +case AV_PIX_FMT_UYVY422: +surface->Data.Y = frame->data[0] + 1; +surface->Data.U = frame->data[0]; +surface->Data.V = frame->data[0] + 2; +break; #endif default: return MFX_ERR_UNSUPPORTED; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] lavfi/vf_vpp_qsv: support UYVY in system memory
From: Haihao Xiang It only works on Linux $ ffmpeg -loglevel verbose -init_hw_device qsv=intel -f lavfi -i \ yuvtestsrc -vf "format=uyvy422,vpp_qsv=format=nv12" -f null - Signed-off-by: Haihao Xiang --- libavfilter/qsvvpp.c | 9 + libavfilter/vf_vpp_qsv.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 7e64944f2c..e181e7b584 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -247,6 +247,10 @@ static int pix_fmt_to_mfx_fourcc(int format) return MFX_FOURCC_RGB4; case AV_PIX_FMT_P010: return MFX_FOURCC_P010; +#if CONFIG_VAAPI +case AV_PIX_FMT_UYVY422: +return MFX_FOURCC_UYVY; +#endif } return MFX_FOURCC_NV12; @@ -276,6 +280,11 @@ static int map_frame_to_surface(AVFrame *frame, mfxFrameSurface1 *surface) surface->Data.R = frame->data[0] + 2; surface->Data.A = frame->data[0] + 3; break; +case AV_PIX_FMT_UYVY422: +surface->Data.Y = frame->data[0] + 1; +surface->Data.U = frame->data[0]; +surface->Data.V = frame->data[0] + 2; +break; default: return MFX_ERR_UNSUPPORTED; } diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 010b69943a..65484fa091 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -703,6 +703,9 @@ static int vpp_query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUYV422, AV_PIX_FMT_RGB32, AV_PIX_FMT_P010, +#if CONFIG_VAAPI +AV_PIX_FMT_UYVY422, +#endif AV_PIX_FMT_QSV, AV_PIX_FMT_NONE }; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] lavfi/vf_vpp_qsv: add support for new scaling modes
From: Haihao Xiang The new modes work on new platforms and are avaialable only for oneVPL. Signed-off-by: Haihao Xiang --- libavfilter/vf_vpp_qsv.c | 31 --- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 65484fa091..ac77f7bb4b 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -504,8 +504,15 @@ static int config_output(AVFilterLink *outlink) if (inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) { if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) { +int mode = vpp->scale_mode; + +#if QSV_ONEVPL +if (mode > 2) +mode = MFX_SCALING_MODE_VENDOR + mode - 2; +#endif + INIT_MFX_EXTBUF(scale_conf, MFX_EXTBUFF_VPP_SCALING); -SET_MFX_PARAM_FIELD(scale_conf, ScalingMode, vpp->scale_mode); +SET_MFX_PARAM_FIELD(scale_conf, ScalingMode, mode); } else av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale & format conversion " "option is not supported with this MSDK version.\n"); @@ -679,10 +686,19 @@ static const AVOption vpp_options[] = { { "height", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS }, { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS }, { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS }, -{ "scale_mode", "scale & format conversion mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" }, +#if QSV_ONEVPL +{ "scale_mode", "scaling & format conversion mode (mode compute(3), vd(4) and ve(5) are only available on some platforms)", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 5, .flags = FLAGS, "scale mode" }, +#else +{ "scale_mode", "scaling & format conversion mode", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" }, +#endif { "auto", "auto mode", 0,AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_DEFAULT}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, { "low_power", "low power mode",0,AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, { "hq","high quality mode", 0,AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, +#if QSV_ONEVPL +{ "compute", "compute", 0,AV_OPT_TYPE_CONST, { .i64 = 3}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, +{ "vd","vd",0,AV_OPT_TYPE_CONST, { .i64 = 4}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, +{ "ve","ve",0,AV_OPT_TYPE_CONST, { .i64 = 5}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, +#endif { "rate", "Generate output at frame rate or field rate, available only for deinterlace mode", OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "rate" }, @@ -735,9 +751,18 @@ static const AVOption qsvscale_options[] = { { "h", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS }, { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS }, -{ "mode", "set scaling mode",OFFSET(scale_mode), AV_OPT_TYPE_INT,{ .i64 = MFX_SCALING_MODE_DEFAULT}, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, FLAGS, "mode"}, +#if QSV_ONEVPL +{ "mode", "scaling & format conversion mode (mode compute(3), vd(4) and ve(5) are only available on some platforms)",OFFSET(scale_mode), AV_OPT_TYPE_INT,{ .i64 = 0}, 0, 5, FLAGS, "mode"}, +#else +{ "mode", "scaling & format conversion mode",OFFSET(scale_mode), AV_OPT_TYPE_INT,{ .i64 = MFX_SCALING_MODE_DEFAULT}, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, FLAGS, "mode"}, +#endif { "low_power", "low power mode",0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "mode"}, { "hq","high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "mode"}, +#if QSV_ONEVPL +{ "compute", "compute", 0, AV_OPT_TYPE_CONST, { .i64 = 3}, INT_MIN, INT_MAX, FLAGS, "mode"}, +{ "vd","vd",0, AV_OPT_TYPE_CONST, {