* [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file
@ 2022-05-08 7:17 lance.lmwang
2022-05-08 7:17 ` [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand lance.lmwang
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: lance.lmwang @ 2022-05-08 7:17 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Limin Wang
From: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
doc/filters.texi | 9 +++++++++
libavfilter/src_movie.c | 5 ++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 367614d2f8..6775cf43ba 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -29652,6 +29652,15 @@ shows how to add protocol_whitelist and protocol_blacklist options:
ffplay -f lavfi
"movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
@end example
+
+@item dec_opts
+Specify decode options for the opened file. Format options can be specified
+as a list of @var{key}=@var{value} pairs separated by ':'. The following example
+shows how to add export_side_data options:
+@example
+./ffmpeg -y -f lavfi
+-i "movie=./input.ts:dec_opts=export_side_data=scte20cc[out0+subcc]" out.srt
+@end example
@end table
It allows overlaying a second video on top of the main input of
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 711854c23c..c7dbd90aa9 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -70,6 +70,7 @@ typedef struct MovieContext {
int64_t discontinuity_threshold;
int64_t ts_offset;
int dec_threads;
+ AVDictionary *dec_opts;
AVFormatContext *format_ctx;
@@ -96,6 +97,7 @@ static const AVOption movie_options[]= {
{ "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS },
{ "dec_threads", "set the number of threads for decoding", OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
{ "format_opts", "set format options for the opened file", OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
+ { "dec_opts", "set decode options for the opened file", OFFSET(dec_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
{ NULL },
};
@@ -158,6 +160,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
{
+ MovieContext *movie = ctx->priv;
const AVCodec *codec;
int ret;
@@ -179,7 +182,7 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
dec_threads = ff_filter_get_nb_threads(ctx);
st->codec_ctx->thread_count = dec_threads;
- if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
+ if ((ret = avcodec_open2(st->codec_ctx, codec, &movie->dec_opts)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
return ret;
}
--
2.35.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] 9+ messages in thread
* [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand
2022-05-08 7:17 [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file lance.lmwang
@ 2022-05-08 7:17 ` lance.lmwang
2022-05-11 12:00 ` Anton Khirnov
2022-05-18 13:43 ` [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file lance.lmwang
2022-05-18 14:50 ` "zhilizhao(赵志立)"
2 siblings, 1 reply; 9+ messages in thread
From: lance.lmwang @ 2022-05-08 7:17 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Limin Wang
From: Limin Wang <lance.lmwang@gmail.com>
some samples include both A53 and SCTE20 data. Before the commit, both
of the will be exported, so the CC data will be repeated or garbarge
as they're using the same frame side data. If you know your samples include
only one of them, You can export by +a53cc+scte20.
After the commit, the default will not export MPEG2 A53/SCTE20/DVD CC side data,
please export on demand.
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
doc/codecs.texi | 10 ++++++++++
libavcodec/avcodec.h | 16 +++++++++++++++-
libavcodec/mpeg12dec.c | 6 +++---
libavcodec/options_table.h | 3 +++
libavcodec/version.h | 2 +-
tests/fate/ffmpeg.mak | 2 +-
tests/fate/subtitles.mak | 6 +++---
7 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/doc/codecs.texi b/doc/codecs.texi
index 5e10020900..4cced983b9 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -662,6 +662,16 @@ for codecs that support it. At present, those are H.264 and VP9.
@item film_grain
Export film grain parameters through frame side data (see @code{AV_FRAME_DATA_FILM_GRAIN_PARAMS}).
Supported at present by AV1 decoders.
+@item a53cc
+Export A53 CC through frame side data (see @code{AV_FRAME_DATA_A53_CC})
+for codecs that support it.
+@item scte20cc
+Export SCTE20 CC through frame side data (see @code{AV_FRAME_DATA_A53_CC})
+for codecs that support it.
+@item dvdcc
+Export DVD CC through frame side data (see @code{AV_FRAME_DATA_A53_CC})
+for codecs that support it.
+
@end table
@item threads @var{integer} (@emph{decoding/encoding,video})
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4dae23d06e..25fd4de2fe 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -360,7 +360,21 @@ typedef struct RcOverride{
* Do not apply film grain, export it instead.
*/
#define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3)
-
+/**
+ * Decoding only.
+ * Export A53 CC through frame side data
+ */
+#define AV_CODEC_EXPORT_DATA_A53_CC (1 << 4)
+/**
+ * Decoding only.
+ * Export SCTE20 CC through frame side data
+ */
+#define AV_CODEC_EXPORT_DATA_SCTE20_CC (1 << 5)
+/**
+ * Decoding only.
+ * Export DVD CC through frame side data
+ */
+#define AV_CODEC_EXPORT_DATA_DVD_CC (1 << 6)
/**
* The decoder will keep a reference to the frame and may reuse it later.
*/
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index e9bde48f7a..032cb8f9b1 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2203,7 +2203,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
{
Mpeg1Context *s1 = avctx->priv_data;
- if (buf_size >= 6 &&
+ if (buf_size >= 6 && (avctx->export_side_data & AV_CODEC_EXPORT_DATA_A53_CC) &&
p[0] == 'G' && p[1] == 'A' && p[2] == '9' && p[3] == '4' &&
p[4] == 3 && (p[5] & 0x40)) {
/* extract A53 Part 4 CC data */
@@ -2224,7 +2224,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
}
return 1;
- } else if (buf_size >= 2 &&
+ } else if (buf_size >= 2 && (avctx->export_side_data & AV_CODEC_EXPORT_DATA_SCTE20_CC) &&
p[0] == 0x03 && (p[1]&0x7f) == 0x01) {
/* extract SCTE-20 CC data */
GetBitContext gb;
@@ -2269,7 +2269,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
}
return 1;
- } else if (buf_size >= 11 &&
+ } else if (buf_size >= 11 && (avctx->export_side_data & AV_CODEC_EXPORT_DATA_DVD_CC) &&
p[0] == 'C' && p[1] == 'C' && p[2] == 0x01 && p[3] == 0xf8) {
/* extract DVD CC data
*
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index e72b4d12b6..3c6db07459 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -88,6 +88,9 @@ static const AVOption avcodec_options[] = {
{"prft", "export Producer Reference Time through packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_PRFT}, INT_MIN, INT_MAX, A|V|S|E, "export_side_data"},
{"venc_params", "export video encoding parameters through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS}, INT_MIN, INT_MAX, V|D, "export_side_data"},
{"film_grain", "export film grain parameters through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_FILM_GRAIN}, INT_MIN, INT_MAX, V|D, "export_side_data"},
+{"a53cc", "export A53 CC through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_A53_CC}, INT_MIN, INT_MAX, V|D, "export_side_data"},
+{"scte20cc", "export SCTE20 CC through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_SCTE20_CC}, INT_MIN, INT_MAX, V|D, "export_side_data"},
+{"dvdcc", "export DVD CC through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_DVD_CC}, INT_MIN, INT_MAX, V|D, "export_side_data"},
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, INT_MAX},
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 735c8b813c..87b7284a95 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#include "version_major.h"
-#define LIBAVCODEC_VERSION_MINOR 27
+#define LIBAVCODEC_VERSION_MINOR 28
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index 9d14a96e13..a403aa27a1 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -109,7 +109,7 @@ FATE_SAMPLES_FFMPEG-$(call ALLYES, LAVFI_INDEV MOVIE_FILTER FILE_PROTOCOL \
+= fate-ffmpeg-fix_sub_duration
fate-ffmpeg-fix_sub_duration: CMD = fmtstdout srt -fix_sub_duration \
-real_time 1 -f lavfi \
- -i "movie=$(TARGET_SAMPLES)/sub/Closedcaption_rollup.m2v[out0+subcc]"
+ -i "movie=$(TARGET_SAMPLES)/sub/Closedcaption_rollup.m2v:dec_opts=export_side_data=a53cc[out0+subcc]"
FATE_STREAMCOPY-$(call ALLYES, EAC3_DEMUXER MOV_MUXER) += fate-copy-trac3074
fate-copy-trac3074: $(SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3
diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index bc464edce6..bb1dc7434e 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -2,13 +2,13 @@ FATE_SUBTITLES_ASS-$(call ALLYES, AQTITLE_DEMUXER TEXT_DECODER ICONV) += fate-su
fate-sub-aqtitle: CMD = fmtstdout ass -sub_charenc windows-1250 -i $(TARGET_SAMPLES)/sub/AQTitle_capability_tester.aqt
FATE_SUBTITLES_ASS-$(call ALLYES, AVDEVICE LAVFI_INDEV CCAPTION_DECODER MOVIE_FILTER MPEGTS_DEMUXER) += fate-sub-cc
-fate-sub-cc: CMD = fmtstdout ass -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/Closedcaption_rollup.m2v[out0+subcc]"
+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/Closedcaption_rollup.m2v:dec_opts=export_side_data=a53cc[out0+subcc]"
FATE_SUBTITLES_ASS-$(call ALLYES, AVDEVICE LAVFI_INDEV CCAPTION_DECODER MOVIE_FILTER MPEGTS_DEMUXER) += fate-sub-cc-realtime
-fate-sub-cc-realtime: CMD = fmtstdout ass -real_time 1 -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/Closedcaption_rollup.m2v[out0+subcc]"
+fate-sub-cc-realtime: CMD = fmtstdout ass -real_time 1 -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/Closedcaption_rollup.m2v:dec_opts=export_side_data=a53cc[out0+subcc]"
FATE_SUBTITLES_ASS-$(call ALLYES, AVDEVICE LAVFI_INDEV CCAPTION_DECODER MOVIE_FILTER MPEGTS_DEMUXER) += fate-sub-cc-scte20
-fate-sub-cc-scte20: CMD = fmtstdout ass -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/scte20.ts[out0+subcc]"
+fate-sub-cc-scte20: CMD = fmtstdout ass -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/scte20.ts:dec_opts=export_side_data=scte20cc[out0+subcc]"
FATE_SUBTITLES_ASS-$(call DEMDEC, ASS, ASS) += fate-sub-ass-to-ass-transcode
fate-sub-ass-to-ass-transcode: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/1ededcbd7b.ass
--
2.35.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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand
2022-05-08 7:17 ` [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand lance.lmwang
@ 2022-05-11 12:00 ` Anton Khirnov
2022-05-11 13:30 ` lance.lmwang
0 siblings, 1 reply; 9+ messages in thread
From: Anton Khirnov @ 2022-05-11 12:00 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Limin Wang
Quoting lance.lmwang@gmail.com (2022-05-08 09:17:01)
> From: Limin Wang <lance.lmwang@gmail.com>
>
> some samples include both A53 and SCTE20 data. Before the commit, both
> of the will be exported, so the CC data will be repeated or garbarge
Why would it be garbage? That sounds like a bug.
Why can't we just export both?
--
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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand
2022-05-11 12:00 ` Anton Khirnov
@ 2022-05-11 13:30 ` lance.lmwang
2022-05-19 9:12 ` Anton Khirnov
0 siblings, 1 reply; 9+ messages in thread
From: lance.lmwang @ 2022-05-11 13:30 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, May 11, 2022 at 02:00:10PM +0200, Anton Khirnov wrote:
> Quoting lance.lmwang@gmail.com (2022-05-08 09:17:01)
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > some samples include both A53 and SCTE20 data. Before the commit, both
> > of the will be exported, so the CC data will be repeated or garbarge
>
> Why would it be garbage? That sounds like a bug.
> Why can't we just export both?
for A53/SCTE20/DVDCC are exprted by A53_CC side data and they're sharing
the same a53_buf_ref to store the data, so if stream contains CC wrapped
as ATSC A53 packets + the same data wrapped as SCTE-20 packets, the CC
data will repeated. We can consider to add a new side data type if necessary,
but it's preferable to export A53_CC even it's SCTE20, so we can't export
both by A53_CC still.
related topic for it:
https://trac.ffmpeg.org/ticket/9724
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20220427084949.73931-1-4rusxg@gmail.com/
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20180306222512.20124-1-ffmpeg@tmm1.net/
>
> --
> Anton Khirnov
--
Thanks,
Limin Wang
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file
2022-05-08 7:17 [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file lance.lmwang
2022-05-08 7:17 ` [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand lance.lmwang
@ 2022-05-18 13:43 ` lance.lmwang
2022-05-18 14:50 ` "zhilizhao(赵志立)"
2 siblings, 0 replies; 9+ messages in thread
From: lance.lmwang @ 2022-05-18 13:43 UTC (permalink / raw)
To: ffmpeg-devel
On Sun, May 08, 2022 at 03:17:00PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> doc/filters.texi | 9 +++++++++
> libavfilter/src_movie.c | 5 ++++-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 367614d2f8..6775cf43ba 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -29652,6 +29652,15 @@ shows how to add protocol_whitelist and protocol_blacklist options:
> ffplay -f lavfi
> "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
> @end example
> +
> +@item dec_opts
> +Specify decode options for the opened file. Format options can be specified
> +as a list of @var{key}=@var{value} pairs separated by ':'. The following example
> +shows how to add export_side_data options:
> +@example
> +./ffmpeg -y -f lavfi
> +-i "movie=./input.ts:dec_opts=export_side_data=scte20cc[out0+subcc]" out.srt
> +@end example
> @end table
>
> It allows overlaying a second video on top of the main input of
> diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> index 711854c23c..c7dbd90aa9 100644
> --- a/libavfilter/src_movie.c
> +++ b/libavfilter/src_movie.c
> @@ -70,6 +70,7 @@ typedef struct MovieContext {
> int64_t discontinuity_threshold;
> int64_t ts_offset;
> int dec_threads;
> + AVDictionary *dec_opts;
>
> AVFormatContext *format_ctx;
>
> @@ -96,6 +97,7 @@ static const AVOption movie_options[]= {
> { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS },
> { "dec_threads", "set the number of threads for decoding", OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
> { "format_opts", "set format options for the opened file", OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> + { "dec_opts", "set decode options for the opened file", OFFSET(dec_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> { NULL },
> };
>
> @@ -158,6 +160,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
>
> static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
> {
> + MovieContext *movie = ctx->priv;
> const AVCodec *codec;
> int ret;
>
> @@ -179,7 +182,7 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
> dec_threads = ff_filter_get_nb_threads(ctx);
> st->codec_ctx->thread_count = dec_threads;
>
> - if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
> + if ((ret = avcodec_open2(st->codec_ctx, codec, &movie->dec_opts)) < 0) {
> av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
> return ret;
> }
> --
> 2.35.1
>
will apply the patchset tomorrow if no other comments or objection.
--
Thanks,
Limin Wang
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file
2022-05-08 7:17 [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file lance.lmwang
2022-05-08 7:17 ` [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand lance.lmwang
2022-05-18 13:43 ` [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file lance.lmwang
@ 2022-05-18 14:50 ` "zhilizhao(赵志立)"
2022-05-19 12:14 ` lance.lmwang
2 siblings, 1 reply; 9+ messages in thread
From: "zhilizhao(赵志立)" @ 2022-05-18 14:50 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: lance.lmwang
> On May 8, 2022, at 3:17 PM, lance.lmwang@gmail.com wrote:
>
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> doc/filters.texi | 9 +++++++++
> libavfilter/src_movie.c | 5 ++++-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 367614d2f8..6775cf43ba 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -29652,6 +29652,15 @@ shows how to add protocol_whitelist and protocol_blacklist options:
> ffplay -f lavfi
> "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
> @end example
> +
> +@item dec_opts
> +Specify decode options for the opened file. Format options can be specified
> +as a list of @var{key}=@var{value} pairs separated by ':'. The following example
> +shows how to add export_side_data options:
Looks like ‘Format options’ is copy-paste error from format_opts.
> +@example
> +./ffmpeg -y -f lavfi
> +-i "movie=./input.ts:dec_opts=export_side_data=scte20cc[out0+subcc]" out.srt
> +@end example
> @end table
>
> It allows overlaying a second video on top of the main input of
> diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> index 711854c23c..c7dbd90aa9 100644
> --- a/libavfilter/src_movie.c
> +++ b/libavfilter/src_movie.c
> @@ -70,6 +70,7 @@ typedef struct MovieContext {
> int64_t discontinuity_threshold;
> int64_t ts_offset;
> int dec_threads;
> + AVDictionary *dec_opts;
>
> AVFormatContext *format_ctx;
>
> @@ -96,6 +97,7 @@ static const AVOption movie_options[]= {
> { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS },
> { "dec_threads", "set the number of threads for decoding", OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
> { "format_opts", "set format options for the opened file", OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> + { "dec_opts", "set decode options for the opened file", OFFSET(dec_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> { NULL },
> };
>
> @@ -158,6 +160,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
>
> static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
> {
> + MovieContext *movie = ctx->priv;
> const AVCodec *codec;
> int ret;
>
> @@ -179,7 +182,7 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
> dec_threads = ff_filter_get_nb_threads(ctx);
> st->codec_ctx->thread_count = dec_threads;
>
> - if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
> + if ((ret = avcodec_open2(st->codec_ctx, codec, &movie->dec_opts)) < 0) {
> av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
> return ret;
> }
> --
> 2.35.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".
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand
2022-05-11 13:30 ` lance.lmwang
@ 2022-05-19 9:12 ` Anton Khirnov
2022-05-19 12:31 ` lance.lmwang
0 siblings, 1 reply; 9+ messages in thread
From: Anton Khirnov @ 2022-05-19 9:12 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting lance.lmwang@gmail.com (2022-05-11 15:30:37)
> On Wed, May 11, 2022 at 02:00:10PM +0200, Anton Khirnov wrote:
> > Quoting lance.lmwang@gmail.com (2022-05-08 09:17:01)
> > > From: Limin Wang <lance.lmwang@gmail.com>
> > >
> > > some samples include both A53 and SCTE20 data. Before the commit, both
> > > of the will be exported, so the CC data will be repeated or garbarge
> >
> > Why would it be garbage? That sounds like a bug.
> > Why can't we just export both?
> for A53/SCTE20/DVDCC are exprted by A53_CC side data and they're sharing
> the same a53_buf_ref to store the data, so if stream contains CC wrapped
> as ATSC A53 packets + the same data wrapped as SCTE-20 packets, the CC
> data will repeated. We can consider to add a new side data type if necessary,
> but it's preferable to export A53_CC even it's SCTE20, so we can't export
> both by A53_CC still.
Does this apply to anything other than mpeg2? If not, it should be a
codec-private option rather than a new global flag.
--
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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file
2022-05-18 14:50 ` "zhilizhao(赵志立)"
@ 2022-05-19 12:14 ` lance.lmwang
0 siblings, 0 replies; 9+ messages in thread
From: lance.lmwang @ 2022-05-19 12:14 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, May 18, 2022 at 10:50:58PM +0800, "zhilizhao(赵志立)" wrote:
>
>
> > On May 8, 2022, at 3:17 PM, lance.lmwang@gmail.com wrote:
> >
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > doc/filters.texi | 9 +++++++++
> > libavfilter/src_movie.c | 5 ++++-
> > 2 files changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 367614d2f8..6775cf43ba 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -29652,6 +29652,15 @@ shows how to add protocol_whitelist and protocol_blacklist options:
> > ffplay -f lavfi
> > "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
> > @end example
> > +
> > +@item dec_opts
> > +Specify decode options for the opened file. Format options can be specified
> > +as a list of @var{key}=@var{value} pairs separated by ':'. The following example
> > +shows how to add export_side_data options:
>
> Looks like ‘Format options’ is copy-paste error from format_opts.
Yes, will fix it, thanks.
>
> > +@example
> > +./ffmpeg -y -f lavfi
> > +-i "movie=./input.ts:dec_opts=export_side_data=scte20cc[out0+subcc]" out.srt
> > +@end example
> > @end table
> >
> > It allows overlaying a second video on top of the main input of
> > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > index 711854c23c..c7dbd90aa9 100644
> > --- a/libavfilter/src_movie.c
> > +++ b/libavfilter/src_movie.c
> > @@ -70,6 +70,7 @@ typedef struct MovieContext {
> > int64_t discontinuity_threshold;
> > int64_t ts_offset;
> > int dec_threads;
> > + AVDictionary *dec_opts;
> >
> > AVFormatContext *format_ctx;
> >
> > @@ -96,6 +97,7 @@ static const AVOption movie_options[]= {
> > { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS },
> > { "dec_threads", "set the number of threads for decoding", OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
> > { "format_opts", "set format options for the opened file", OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> > + { "dec_opts", "set decode options for the opened file", OFFSET(dec_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> > { NULL },
> > };
> >
> > @@ -158,6 +160,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
> >
> > static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
> > {
> > + MovieContext *movie = ctx->priv;
> > const AVCodec *codec;
> > int ret;
> >
> > @@ -179,7 +182,7 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
> > dec_threads = ff_filter_get_nb_threads(ctx);
> > st->codec_ctx->thread_count = dec_threads;
> >
> > - if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
> > + if ((ret = avcodec_open2(st->codec_ctx, codec, &movie->dec_opts)) < 0) {
> > av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
> > return ret;
> > }
> > --
> > 2.35.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".
>
--
Thanks,
Limin Wang
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand
2022-05-19 9:12 ` Anton Khirnov
@ 2022-05-19 12:31 ` lance.lmwang
0 siblings, 0 replies; 9+ messages in thread
From: lance.lmwang @ 2022-05-19 12:31 UTC (permalink / raw)
To: ffmpeg-devel
On Thu, May 19, 2022 at 11:12:58AM +0200, Anton Khirnov wrote:
> Quoting lance.lmwang@gmail.com (2022-05-11 15:30:37)
> > On Wed, May 11, 2022 at 02:00:10PM +0200, Anton Khirnov wrote:
> > > Quoting lance.lmwang@gmail.com (2022-05-08 09:17:01)
> > > > From: Limin Wang <lance.lmwang@gmail.com>
> > > >
> > > > some samples include both A53 and SCTE20 data. Before the commit, both
> > > > of the will be exported, so the CC data will be repeated or garbarge
> > >
> > > Why would it be garbage? That sounds like a bug.
> > > Why can't we just export both?
> > for A53/SCTE20/DVDCC are exprted by A53_CC side data and they're sharing
> > the same a53_buf_ref to store the data, so if stream contains CC wrapped
> > as ATSC A53 packets + the same data wrapped as SCTE-20 packets, the CC
> > data will repeated. We can consider to add a new side data type if necessary,
> > but it's preferable to export A53_CC even it's SCTE20, so we can't export
> > both by A53_CC still.
>
> Does this apply to anything other than mpeg2? If not, it should be a
> codec-private option rather than a new global flag.
Yes, it's for mpeg2 only. At first, I think export_side_data option is
proper place to use. But if export_side_data are considered to use for
global, then I'll consider to add a mpeg2-private option for it.
>
> --
> 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-request@ffmpeg.org with subject "unsubscribe".
--
Thanks,
Limin Wang
_______________________________________________
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] 9+ messages in thread
end of thread, other threads:[~2022-05-19 12:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08 7:17 [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file lance.lmwang
2022-05-08 7:17 ` [FFmpeg-devel] [PATCH 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand lance.lmwang
2022-05-11 12:00 ` Anton Khirnov
2022-05-11 13:30 ` lance.lmwang
2022-05-19 9:12 ` Anton Khirnov
2022-05-19 12:31 ` lance.lmwang
2022-05-18 13:43 ` [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file lance.lmwang
2022-05-18 14:50 ` "zhilizhao(赵志立)"
2022-05-19 12:14 ` lance.lmwang
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git