* [FFmpeg-devel] [PATCH 1/7] Preserve AFD side data when going from AVPacket to AVFrame
2023-06-07 20:22 [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
@ 2023-06-07 20:22 ` Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 2/7] vf_drawtext: Add ability to show AFD value Devin Heitmueller
` (6 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-07 20:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Devin Heitmueller
This is needed to ensure that AFD data continues to work when
capturing V210 video with the Decklink libavdevice input.
Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
---
libavcodec/decode.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index a7c1302..6ee2c85 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1331,6 +1331,7 @@ int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx,
{ AV_PKT_DATA_MASTERING_DISPLAY_METADATA, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
{ AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
{ AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
+ { AV_PKT_DATA_AFD, AV_FRAME_DATA_AFD },
{ AV_PKT_DATA_ICC_PROFILE, AV_FRAME_DATA_ICC_PROFILE },
{ AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE },
{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
--
1.8.3.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 2/7] vf_drawtext: Add ability to show AFD value
2023-06-07 20:22 [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 1/7] Preserve AFD side data when going from AVPacket to AVFrame Devin Heitmueller
@ 2023-06-07 20:22 ` Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 3/7] avcodec/avframe: add new side data types for Bar Data Devin Heitmueller
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-07 20:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Devin Heitmueller
Add an "afd" variable which shows the current AFD side data for
the given frame. This is to assist in debugging as it allows us
to burn the current AFD right into the video.
Example usage:
./ffmpeg -y -i afd.ts -vf drawtext=fontfile=/Library/Fonts/Verdana.ttf:text="AFD=%{afd}":fontsize=32:x=10:y=50:fontcolor=blue burnin.ts
Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
---
doc/filters.texi | 5 +++++
libavfilter/vf_drawtext.c | 19 +++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/doc/filters.texi b/doc/filters.texi
index a46357b..9179c20 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -12601,6 +12601,11 @@ The following functions are available:
@table @command
+@item afd
+The Active Format Descriptor value of the current frame (as specified in the
+frame's side data). This can be useful for debugging aspect ratio issues.
+See standards ETSI TS 101 154 or SMPTE ST2016-1 for more details on its meaning.
+
@item expr, e
The expression evaluation result.
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 71ab851..32accfb 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -221,6 +221,7 @@ typedef struct DrawTextContext {
int text_shaping; ///< 1 to shape the text before drawing it
#endif
AVDictionary *metadata;
+ AVFrame *frame;
} DrawTextContext;
#define OFFSET(x) offsetof(DrawTextContext, x)
@@ -1056,6 +1057,22 @@ static int func_metadata(AVFilterContext *ctx, AVBPrint *bp,
return 0;
}
+static int func_afd(AVFilterContext *ctx, AVBPrint *bp,
+ char *fct, unsigned argc, char **argv, int tag)
+{
+ DrawTextContext *s = ctx->priv;
+ AVFrameSideData *side_data;
+
+ side_data = av_frame_get_side_data(s->frame, AV_FRAME_DATA_AFD);
+ if (side_data) {
+ av_bprintf(bp, "0x%02x", side_data->data[0]);
+ } else {
+ av_bprintf(bp, "none");
+ }
+
+ return 0;
+}
+
static int func_strftime(AVFilterContext *ctx, AVBPrint *bp,
char *fct, unsigned argc, char **argv, int tag)
{
@@ -1234,6 +1251,7 @@ static const struct drawtext_function {
{ "frame_num", 0, 0, 0, func_frame_num },
{ "n", 0, 0, 0, func_frame_num },
{ "metadata", 1, 2, 0, func_metadata },
+ { "afd", 0, 0, 0, func_afd },
};
static int eval_function(AVFilterContext *ctx, AVBPrint *bp, char *fct,
@@ -1680,6 +1698,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->var_values[VAR_DURATION] = frame->duration * av_q2d(inlink->time_base);
s->metadata = frame->metadata;
+ s->frame = frame;
for (int i = 0; i < loop; i++) {
if (header) {
--
1.8.3.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 3/7] avcodec/avframe: add new side data types for Bar Data
2023-06-07 20:22 [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 1/7] Preserve AFD side data when going from AVPacket to AVFrame Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 2/7] vf_drawtext: Add ability to show AFD value Devin Heitmueller
@ 2023-06-07 20:22 ` Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 4/7] libavfilter: Add filter to insert AFD/bar data Devin Heitmueller
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-07 20:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Devin Heitmueller
Add new side data types for both AVPacket and AVFrame to support
"bar data" as defined in SMPTE 2016-1, ATSC A/53, and SCTE 128-1.
Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
---
libavcodec/decode.c | 1 +
libavcodec/defs.h | 12 ++++++++++++
libavcodec/packet.h | 6 ++++++
libavutil/frame.h | 6 ++++++
4 files changed, 25 insertions(+)
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 6ee2c85..5aafce7 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1332,6 +1332,7 @@ int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx,
{ AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
{ AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
{ AV_PKT_DATA_AFD, AV_FRAME_DATA_AFD },
+ { AV_PKT_DATA_BARDATA, AV_FRAME_DATA_BARDATA },
{ AV_PKT_DATA_ICC_PROFILE, AV_FRAME_DATA_ICC_PROFILE },
{ AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE },
{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
diff --git a/libavcodec/defs.h b/libavcodec/defs.h
index fbe3254..deadfe7 100644
--- a/libavcodec/defs.h
+++ b/libavcodec/defs.h
@@ -119,6 +119,18 @@ typedef struct AVPanScan {
} AVPanScan;
/**
+ * Bar data - used by side data for avcodec and avframe. Defines the location
+ * of horizontal or vertical black bars (i.e. letterbox/pillar bars)
+ */
+typedef struct AVBarData {
+ int top_bottom; /* 0=top/bottom 1=left/right */
+ int top;
+ int left;
+ int bottom;
+ int right;
+} AVBarData;
+
+/**
* This structure describes the bitrate properties of an encoded bitstream. It
* roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
* parameters for H.264/HEVC.
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index f28e7e7..bdad21e 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -300,6 +300,12 @@ enum AVPacketSideDataType {
AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
/**
+ * Bar data. See SMPTE ST2016-1, ATSC A/53, SCTE 128-1
+ * Format for this data can be found in the AVBarData struct
+ */
+ AV_PKT_DATA_BARDATA,
+
+ /**
* The number of side data types.
* This is not part of the public API/ABI in the sense that it may
* change when new side data types are added.
diff --git a/libavutil/frame.h b/libavutil/frame.h
index a491315..317b663 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -214,6 +214,12 @@ enum AVFrameSideDataType {
* Ambient viewing environment metadata, as defined by H.274.
*/
AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT,
+ /**
+ * SMPTE ST 2016-1 Bar data
+ * The data is the AVBarData struct defined in libavcodec.
+ * Note: See SMPTE ST 2016-1:2009 Section 8 for the interaction between AFD and Bar Data
+ */
+ AV_FRAME_DATA_BARDATA,
};
enum AVActiveFormatDescription {
--
1.8.3.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 4/7] libavfilter: Add filter to insert AFD/bar data
2023-06-07 20:22 [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
` (2 preceding siblings ...)
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 3/7] avcodec/avframe: add new side data types for Bar Data Devin Heitmueller
@ 2023-06-07 20:22 ` Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 5/7] Provide a side data description for newly introduced bar data Devin Heitmueller
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-07 20:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Devin Heitmueller
Introduce a new filter which allows the user to manually set the
AFD or bar data side data on AVFrames.
Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
---
doc/filters.texi | 52 ++++++++++++++++++
libavfilter/Makefile | 1 +
libavfilter/allfilters.c | 1 +
libavfilter/vf_afd.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 187 insertions(+)
create mode 100644 libavfilter/vf_afd.c
diff --git a/doc/filters.texi b/doc/filters.texi
index 9179c20..18aa998 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21208,6 +21208,58 @@ This filter use field-dominance information in frame to decide which
of each pair of fields to place first in the output.
If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
+@section setafd
+
+The @code{setafd} filter sets the Aspect Ratio Description side data for the
+output video.
+
+This filter allows configuration of AFD metadata (conforming to
+ETSI TS 101 154 or SMPTE ST2016-1), as well as Bar Data (conforming to
+SMPTE 2016-1, ATSC A/53, and SCTE 128-1)
+
+It accepts the following parameters:
+
+@table @option
+
+@item afd
+This parameters dictates whether AFD side data will be injected. It is
+enabled by default.
+
+@item code
+If AFD output is enabled, this parameter will specify the AFD code to
+insert into the video stream. Valid values are from 0x00 to 0x0f.
+
+@item bardata
+This parameter dictates whether bar data will be injected. It is
+disabled by default.
+
+@item top
+@item bottom
+@item left
+@item right
+If bardata output is enabled, These parameters specify the dimensions
+of the bar data. Typically only top/bottom or left/right would be specified.
+If either top or bottom are specified, the bar data inserted will be for those
+parameters (even if left/right are also specified).
+
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Set the AFD value to 0x08
+@example
+ffmpeg -i INPUT -vf setafd=code=0x08 OUTPUT
+@end example
+@item
+Set the Bar data to a top width of 100 and a bottom width of 120
+@example
+ffmpeg -i INPUT -vf setafd=afd=0:bardata=1:top=100:bottom=120 OUTPUT
+@end example
+
+@end itemize
+
@section setdar, setsar
The @code{setdar} filter sets the Display Aspect Ratio for the filter
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 18935b1..30954e1 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -467,6 +467,7 @@ OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o
OBJS-$(CONFIG_SENDCMD_FILTER) += f_sendcmd.o
OBJS-$(CONFIG_SEPARATEFIELDS_FILTER) += vf_separatefields.o
OBJS-$(CONFIG_SETDAR_FILTER) += vf_aspect.o
+OBJS-$(CONFIG_SETAFD_FILTER) += vf_afd.o
OBJS-$(CONFIG_SETFIELD_FILTER) += vf_setparams.o
OBJS-$(CONFIG_SETPARAMS_FILTER) += vf_setparams.o
OBJS-$(CONFIG_SETPTS_FILTER) += setpts.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index f1f7811..2ec9487 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -437,6 +437,7 @@ extern const AVFilter ff_vf_select;
extern const AVFilter ff_vf_selectivecolor;
extern const AVFilter ff_vf_sendcmd;
extern const AVFilter ff_vf_separatefields;
+extern const AVFilter ff_vf_setafd;
extern const AVFilter ff_vf_setdar;
extern const AVFilter ff_vf_setfield;
extern const AVFilter ff_vf_setparams;
diff --git a/libavfilter/vf_afd.c b/libavfilter/vf_afd.c
new file mode 100644
index 0000000..a6120c8
--- /dev/null
+++ b/libavfilter/vf_afd.c
@@ -0,0 +1,133 @@
+/*
+ * AFD and Bardata Insertion Filter
+ * Copyright (c) 2023 LTN Global Communications
+ *
+ * Author: Devin Heitmueller <dheitmueller@ltnglobal.com>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Active Format Description and Bar Data Insertion Filter
+ */
+
+#include "libavcodec/defs.h"
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "internal.h"
+
+typedef struct AFDContext {
+ const AVClass *class;
+ int enable_afd;
+ int afd_code;
+ int enable_bardata;
+ int top;
+ int bottom;
+ int left;
+ int right;
+} AFDContext;
+
+static int filter_frame(AVFilterLink *link, AVFrame *frame)
+{
+ AFDContext *s = link->dst->priv;
+ AVFrameSideData *side_data;
+ AVBarData *bar_data;
+
+ /* Insert/tweak the side-data for AFD */
+ if (s->enable_afd) {
+ /* Insert/tweak the side-data for Bar Data */
+ side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_AFD);
+ if (!side_data) {
+ side_data = av_frame_new_side_data(frame, AV_FRAME_DATA_AFD, sizeof(unsigned char));
+ if (side_data == NULL)
+ return -ENOMEM;
+ }
+ side_data->data[0] = s->afd_code;
+ }
+
+ if (s->enable_bardata) {
+ /* Insert/tweak the side-data for Bar Data */
+ side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_BARDATA);
+ if (!side_data) {
+ side_data = av_frame_new_side_data(frame, AV_FRAME_DATA_BARDATA, sizeof(AVBarData));
+ if (side_data == NULL)
+ return -ENOMEM;
+ }
+ bar_data = (AVBarData *) side_data->data;
+ if (s->top || s->bottom) {
+ bar_data->top_bottom = 1;
+ bar_data->top = s->top;
+ bar_data->bottom = s->bottom;
+ bar_data->left = 0;
+ bar_data->right = 0;
+ } else {
+ bar_data->top_bottom = 0;
+ bar_data->top = 0;
+ bar_data->bottom = 0;
+ bar_data->left = s->left;
+ bar_data->right = s->right;
+ }
+ }
+
+ return ff_filter_frame(link->dst->outputs[0], frame);
+}
+
+#define OFFSET(x) offsetof(AFDContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+
+static const AVOption setafd_options[] = {
+ /* AFD Options */
+ { "afd", "Enable AFD insertion", OFFSET(enable_afd), AV_OPT_TYPE_BOOL, { .i64 = 1}, 0, 1, .flags = FLAGS },
+ { "code", "AFD code to insert", OFFSET(afd_code), AV_OPT_TYPE_INT, {.i64=0}, 0, 0x0F, FLAGS },
+
+ /* Bar data Options */
+ { "bardata","Enable Bar Data insertion", OFFSET(enable_bardata), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, .flags = FLAGS },
+ { "top", "top bar position", OFFSET(top), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
+ { "bottom","bottom bar position", OFFSET(bottom), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
+ { "left", "left bar position", OFFSET(left), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
+ { "right", "right bar position", OFFSET(right), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
+ { NULL }
+};
+
+AVFILTER_DEFINE_CLASS(setafd);
+
+static const AVFilterPad avfilter_vf_setafd_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ },
+};
+
+static const AVFilterPad avfilter_vf_setafd_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+};
+
+const AVFilter ff_vf_setafd = {
+ .name = "setafd",
+ .description = NULL_IF_CONFIG_SMALL("Set AFD and/or Bar Data for video frames"),
+ .priv_size = sizeof(AFDContext),
+ .priv_class = &setafd_class,
+ .flags = AVFILTER_FLAG_METADATA_ONLY,
+ FILTER_INPUTS(avfilter_vf_setafd_inputs),
+ FILTER_OUTPUTS(avfilter_vf_setafd_outputs),
+};
--
1.8.3.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 5/7] Provide a side data description for newly introduced bar data
2023-06-07 20:22 [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
` (3 preceding siblings ...)
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 4/7] libavfilter: Add filter to insert AFD/bar data Devin Heitmueller
@ 2023-06-07 20:22 ` Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 6/7] avcodec/v210enc: Pass through " Devin Heitmueller
` (2 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-07 20:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Devin Heitmueller
Add a new description for bar data, so that the presence of bar
data can be seen through ffprobe.
Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
---
libavutil/frame.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavutil/frame.c b/libavutil/frame.c
index b6cee2d..03d1b31 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -941,6 +941,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
case AV_FRAME_DATA_REPLAYGAIN: return "AVReplayGain";
case AV_FRAME_DATA_DISPLAYMATRIX: return "3x3 displaymatrix";
case AV_FRAME_DATA_AFD: return "Active format description";
+ case AV_FRAME_DATA_BARDATA: return "SMPTE 2016-1 bar data";
case AV_FRAME_DATA_MOTION_VECTORS: return "Motion vectors";
case AV_FRAME_DATA_SKIP_SAMPLES: return "Skip samples";
case AV_FRAME_DATA_AUDIO_SERVICE_TYPE: return "Audio service type";
--
1.8.3.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 6/7] avcodec/v210enc: Pass through bar data
2023-06-07 20:22 [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
` (4 preceding siblings ...)
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 5/7] Provide a side data description for newly introduced bar data Devin Heitmueller
@ 2023-06-07 20:22 ` Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 7/7] avdevice/decklink_enc: Add support for output of bar data as VANC Devin Heitmueller
2023-06-15 14:54 ` [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
7 siblings, 0 replies; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-07 20:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Devin Heitmueller
When encoding to V210, make sure the bar side data makes it through
in the resulting AVPacket. This is needed so the decklink output
module can put out bar data as VANC when in 10-bit mode.
Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
---
libavcodec/v210enc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index 2a30ed7..69a2d72 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -103,6 +103,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
memcpy(buf, side_data->data, side_data->size);
}
+ side_data = av_frame_get_side_data(pic, AV_FRAME_DATA_BARDATA);
+ if (side_data && side_data->size) {
+ uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_BARDATA, side_data->size);
+ if (!buf)
+ return AVERROR(ENOMEM);
+ memcpy(buf, side_data->data, side_data->size);
+ }
+
*got_packet = 1;
return 0;
}
--
1.8.3.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [FFmpeg-devel] [PATCH 7/7] avdevice/decklink_enc: Add support for output of bar data as VANC
2023-06-07 20:22 [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
` (5 preceding siblings ...)
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 6/7] avcodec/v210enc: Pass through " Devin Heitmueller
@ 2023-06-07 20:22 ` Devin Heitmueller
2023-06-15 14:54 ` [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
7 siblings, 0 replies; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-07 20:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Devin Heitmueller
SMPTE ST2016-3 supports both AFD and bar data within the VANC message.
Extend the existing support to pass through both.
Example usage:
ffmpeg -i input.ts -vf setafd=afd=1:code=0x00:bardata=1:top=100:bottom=120 -f decklink -vcodec v210 'DeckLink Duo (4)'
Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
---
libavdevice/decklink_enc.cpp | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index 6906cb0..5d85d6b 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -447,23 +447,39 @@ static void construct_afd(AVFormatContext *avctx, struct decklink_ctx *ctx,
struct klvanc_packet_afd_s *afd = NULL;
uint16_t *afd_words = NULL;
uint16_t len;
- size_t size;
+ size_t size, bardata_size;
int f1_line = 12, f2_line = 0, ret;
const uint8_t *data = av_packet_get_side_data(pkt, AV_PKT_DATA_AFD, &size);
- if (!data || size == 0)
+ const AVBarData *bardata = (AVBarData *) av_packet_get_side_data(pkt, AV_PKT_DATA_BARDATA, &bardata_size);
+
+ if ((!data || size == 0) && (!bardata || bardata_size != sizeof(AVBarData)))
return;
ret = klvanc_create_AFD(&afd);
if (ret)
return;
- ret = klvanc_set_AFD_val(afd, data[0]);
- if (ret) {
- av_log(avctx, AV_LOG_ERROR, "Invalid AFD value specified: %d\n",
- data[0]);
- klvanc_destroy_AFD(afd);
- return;
+ if (data) {
+ ret = klvanc_set_AFD_val(afd, data[0]);
+ if (ret) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid AFD value specified: %d\n",
+ data[0]);
+ klvanc_destroy_AFD(afd);
+ return;
+ }
+ }
+
+ if (bardata) {
+ if (bardata->top_bottom) {
+ afd->barDataFlags = BARS_TOPBOTTOM;
+ afd->top = bardata->top;
+ afd->bottom = bardata->bottom;
+ } else {
+ afd->barDataFlags = BARS_LEFTRIGHT;
+ afd->left = bardata->left;
+ afd->right = bardata->right;
+ }
}
/* Compute the AR flag based on the DAR (see ST 2016-1:2009 Sec 9.1). Note, we treat
--
1.8.3.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data
2023-06-07 20:22 [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
` (6 preceding siblings ...)
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 7/7] avdevice/decklink_enc: Add support for output of bar data as VANC Devin Heitmueller
@ 2023-06-15 14:54 ` Devin Heitmueller
2023-06-15 14:57 ` Paul B Mahol
7 siblings, 1 reply; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-15 14:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Devin Heitmueller
On Wed, Jun 7, 2023 at 3:24 PM Devin Heitmueller
<devin.heitmueller@ltnglobal.com> wrote:
>
> This patch series includes some misc changes related to AFD, as well
> as adding support for S2016-1 bar data.
>
> The current focus of this series for bar data is getting the basic
> support in place within the raw domain and decklink output. A subsequent
> patch series will be submitted which includes the patches to the
> H.264/HEVC decoders and libx264 to properly handle the SEI data.
>
> Devin Heitmueller (7):
> Preserve AFD side data when going from AVPacket to AVFrame
> vf_drawtext: Add ability to show AFD value
> avcodec/avframe: add new side data types for Bar Data
> libavfilter: Add filter to insert AFD/bar data
> Provide a side data description for newly introduced bar data
> avcodec/v210enc: Pass through bar data
> avdevice/decklink_enc: Add support for output of bar data as VANC
>
> doc/filters.texi | 57 +++++++++++++++++++
> libavcodec/decode.c | 2 +
> libavcodec/defs.h | 12 ++++
> libavcodec/packet.h | 6 ++
> libavcodec/v210enc.c | 8 +++
> libavdevice/decklink_enc.cpp | 32 ++++++++---
> libavfilter/Makefile | 1 +
> libavfilter/allfilters.c | 1 +
> libavfilter/vf_afd.c | 133 +++++++++++++++++++++++++++++++++++++++++++
> libavfilter/vf_drawtext.c | 19 +++++++
> libavutil/frame.c | 1 +
> libavutil/frame.h | 6 ++
> 12 files changed, 270 insertions(+), 8 deletions(-)
> create mode 100644 libavfilter/vf_afd.c
>
> --
> 1.8.3.1
>
Does anyone have any comments/feedback on this patch series?
Devin
--
Devin Heitmueller, Senior Software Engineer
LTN Global Communications
o: +1 (301) 363-1001
w: https://ltnglobal.com e: devin.heitmueller@ltnglobal.com
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data
2023-06-15 14:54 ` [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
@ 2023-06-15 14:57 ` Paul B Mahol
2023-06-15 15:21 ` Devin Heitmueller
0 siblings, 1 reply; 12+ messages in thread
From: Paul B Mahol @ 2023-06-15 14:57 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Devin Heitmueller
On Thu, Jun 15, 2023 at 4:54 PM Devin Heitmueller <
devin.heitmueller@ltnglobal.com> wrote:
> On Wed, Jun 7, 2023 at 3:24 PM Devin Heitmueller
> <devin.heitmueller@ltnglobal.com> wrote:
> >
> > This patch series includes some misc changes related to AFD, as well
> > as adding support for S2016-1 bar data.
> >
> > The current focus of this series for bar data is getting the basic
> > support in place within the raw domain and decklink output. A subsequent
> > patch series will be submitted which includes the patches to the
> > H.264/HEVC decoders and libx264 to properly handle the SEI data.
> >
> > Devin Heitmueller (7):
> > Preserve AFD side data when going from AVPacket to AVFrame
> > vf_drawtext: Add ability to show AFD value
> > avcodec/avframe: add new side data types for Bar Data
> > libavfilter: Add filter to insert AFD/bar data
> > Provide a side data description for newly introduced bar data
> > avcodec/v210enc: Pass through bar data
> > avdevice/decklink_enc: Add support for output of bar data as VANC
> >
> > doc/filters.texi | 57 +++++++++++++++++++
> > libavcodec/decode.c | 2 +
> > libavcodec/defs.h | 12 ++++
> > libavcodec/packet.h | 6 ++
> > libavcodec/v210enc.c | 8 +++
> > libavdevice/decklink_enc.cpp | 32 ++++++++---
> > libavfilter/Makefile | 1 +
> > libavfilter/allfilters.c | 1 +
> > libavfilter/vf_afd.c | 133
> +++++++++++++++++++++++++++++++++++++++++++
> > libavfilter/vf_drawtext.c | 19 +++++++
> > libavutil/frame.c | 1 +
> > libavutil/frame.h | 6 ++
> > 12 files changed, 270 insertions(+), 8 deletions(-)
> > create mode 100644 libavfilter/vf_afd.c
> >
> > --
> > 1.8.3.1
> >
>
> Does anyone have any comments/feedback on this patch series?
>
It may conflict with another set of drawtext patches.
>
> Devin
>
> --
> Devin Heitmueller, Senior Software Engineer
> LTN Global Communications
> o: +1 (301) 363-1001
> w: https://ltnglobal.com e: devin.heitmueller@ltnglobal.com
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data
2023-06-15 14:57 ` Paul B Mahol
@ 2023-06-15 15:21 ` Devin Heitmueller
2023-06-22 11:52 ` Devin Heitmueller
0 siblings, 1 reply; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-15 15:21 UTC (permalink / raw)
To: Paul B Mahol
Cc: Devin Heitmueller, FFmpeg development discussions and patches
Hello Paul,
On Thu, Jun 15, 2023 at 10:57 AM Paul B Mahol <onemda@gmail.com> wrote:
> It may conflict with another set of drawtext patches.
I'm happy to regenerate the drawtext patch if there is a conflict. If
the other patches could be merged though that would be helpful as it
would avoid me having to regenerate the entire patch series (assuming
there are no other issues/comments). None of the other patches in the
series depend on the drawtext patch, but the drawtext patch depends on
other patches in the series.
Devin
--
Devin Heitmueller, Senior Software Engineer
LTN Global Communications
o: +1 (301) 363-1001
w: https://ltnglobal.com e: devin.heitmueller@ltnglobal.com
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data
2023-06-15 15:21 ` Devin Heitmueller
@ 2023-06-22 11:52 ` Devin Heitmueller
0 siblings, 0 replies; 12+ messages in thread
From: Devin Heitmueller @ 2023-06-22 11:52 UTC (permalink / raw)
To: Paul B Mahol
Cc: Devin Heitmueller, FFmpeg development discussions and patches
Does anyone else have any comments on this series that would prevent
it from being merged upstream? If not, I can rebase the drawtext
patch so there are no conflicts.
Devin
--
Devin Heitmueller, Senior Software Engineer
LTN Global Communications
o: +1 (301) 363-1001
w: https://ltnglobal.com e: devin.heitmueller@ltnglobal.com
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 12+ messages in thread