Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] libavformat: add RCWT closed caption muxer
@ 2024-01-06  2:14 Marth64
  2024-01-06 12:33 ` Stefano Sabatini
  0 siblings, 1 reply; 14+ messages in thread
From: Marth64 @ 2024-01-06  2:14 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marth64

Signed-off-by: Marth64 <marth64@proxyid.net>

Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
used open source tool for processing 608/708 closed caption (CC) sources.
It can be used to archive the original, raw CC bitstream and to produce
a source file file for later CC processing or conversion. As a result,
it also allows for interopability with ccextractor for processing CC data
extracted via ffmpeg. The format is simple to parse and can be used
to retain all lines and variants of CC.

A free specification of RCWT can be found here:
https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT
This muxer implements the specification as of 01/05/2024, which has
been stable and unchanged for 10 years as of this writing.

This muxer will have some nuances from the way that ccextractor muxes RCWT.
No compatibility issues when processing the output with ccextractor
have been observed as a result of this so far, but mileage may vary
and outputs will not be a bit-exact match.

Specifically, the differences are:
(1)  This muxer will identify as "FF" as the writing program identifier, so
as to be honest about the output's origin.

(2)  ffmpeg's MPEG-1/2, H264, HEVC, etc. decoders extract closed captioning
data differently than ccextractor from embedded SEI/user data.
For example, DVD captioning bytes will be translated to ATSC A53 format.
This allows ffmpeg to handle 608/708 in a consistant way downstream.
This is a lossless conversion and the meaningful data is retained.

(3)  This muxer will not alter the extracted data except to remove invalid
packets in between valid CC blocks. On the other hand, ccextractor
will by default remove mid-stream padding, and add padding at the end
of the stream (in order to convey the end time of the source video).

---
 libavformat/Makefile     |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtenc.c    | 203 +++++++++++++++++++++++++++++++++++++++
 tests/fate/subtitles.mak |   3 +
 tests/ref/fate/sub-rcwt  |   1 +
 5 files changed, 209 insertions(+)
 create mode 100644 libavformat/rcwtenc.c
 create mode 100644 tests/ref/fate/sub-rcwt

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 45dba53044..03c2c70e67 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -489,6 +489,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)               += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)               += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)          += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)            += rawenc.o
+OBJS-$(CONFIG_RCWT_MUXER)                += rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)          += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)          += redspark.o
 OBJS-$(CONFIG_RKA_DEMUXER)               += rka.o apetag.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index dc2acf575c..fb14f15739 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -388,6 +388,7 @@ extern const AVInputFormat  ff_qoa_demuxer;
 extern const AVInputFormat  ff_r3d_demuxer;
 extern const AVInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFOutputFormat ff_rcwt_muxer;
 extern const AVInputFormat  ff_realtext_demuxer;
 extern const AVInputFormat  ff_redspark_demuxer;
 extern const AVInputFormat  ff_rka_demuxer;
diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
new file mode 100644
index 0000000000..f70a80b175
--- /dev/null
+++ b/libavformat/rcwtenc.c
@@ -0,0 +1,203 @@
+/*
+ * Raw Captions With Time (RCWT) muxer
+ * Author: Marth64 <marth64@proxyid.net>
+ *
+ * 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
+ */
+
+/*
+ * Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
+ * used open source tool for processing 608/708 closed caption (CC) sources.
+ * It can be used to archive the original, raw CC bitstream and to produce
+ * a source file file for later CC processing or conversion. As a result,
+ * it also allows for interopability with ccextractor for processing CC data
+ * extracted via ffmpeg. The format is simple to parse and can be used
+ * to retain all lines and variants of CC.
+ *
+ * A free specification of RCWT can be found here:
+ * https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT
+ * This muxer implements the specification as of 01/05/2024, which has
+ * been stable and unchanged for 10 years as of this writing.
+ *
+ * This muxer will have some nuances from the way that ccextractor muxes RCWT.
+ * No compatibility issues when processing the output with ccextractor
+ * have been observed as a result of this so far, but mileage may vary
+ * and outputs will not be a bit-exact match.
+ *
+ * Specifically, the differences are:
+ * (1)  This muxer will identify as "FF" as the writing program identifier, so
+ *      as to be honest about the output's origin.
+ * (2)  ffmpeg's MPEG-1/2, H264, HEVC, etc. decoders extract closed captioning
+ *      data differently than ccextractor from embedded SEI/user data.
+ *      For example, DVD captioning bytes will be translated to ATSC A53 format.
+ *      This allows ffmpeg to handle 608/708 in a consistant way downstream.
+ *      This is a lossless conversion and the meaningful data is retained.
+ * (3)  This muxer will not alter the extracted data except to remove invalid
+ *      packets in between valid CC blocks. On the other hand, ccextractor
+ *      will by default remove mid-stream padding, and add padding at the end
+ *      of the stream (in order to convey the end time of the source video).
+ */
+
+#include "avformat.h"
+#include "internal.h"
+#include "mux.h"
+#include "libavutil/log.h"
+#include "libavutil/intreadwrite.h"
+
+#define RCWT_CLUSTER_MAX_BLOCKS             65535
+#define RCWT_BLOCK_SIZE                     3 * sizeof(uint8_t)
+
+typedef struct RCWTContext {
+    int cluster_nb_blocks;
+    int cluster_pos;
+    int64_t cluster_pts;
+    uint8_t cluster_buf[RCWT_CLUSTER_MAX_BLOCKS * RCWT_BLOCK_SIZE];
+} RCWTContext;
+
+static void rcwt_init_cluster(AVFormatContext *avf)
+{
+    RCWTContext *rcwt = avf->priv_data;
+
+    rcwt->cluster_nb_blocks = 0;
+    rcwt->cluster_pos = 0;
+    rcwt->cluster_pts = AV_NOPTS_VALUE;
+    memset(rcwt->cluster_buf, 0, sizeof(rcwt->cluster_buf));
+}
+
+static void rcwt_flush_cluster(AVFormatContext *avf)
+{
+    RCWTContext *rcwt = avf->priv_data;
+
+    if (rcwt->cluster_nb_blocks > 0) {
+        avio_wl64(avf->pb, rcwt->cluster_pts);
+        avio_wl16(avf->pb, rcwt->cluster_nb_blocks);
+        avio_write(avf->pb, rcwt->cluster_buf,
+                (rcwt->cluster_nb_blocks * RCWT_BLOCK_SIZE));
+    }
+
+    rcwt_init_cluster(avf);
+}
+
+static int rcwt_write_header(AVFormatContext *avf)
+{
+    if (avf->nb_streams != 1
+            || avf->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE
+            || avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_EIA_608) {
+        av_log(avf, AV_LOG_ERROR,
+               "RCWT supports only one CC (608/708) stream\n");
+        return AVERROR(EINVAL);
+    }
+
+    avpriv_set_pts_info(avf->streams[0], 64, 1, 1000);
+
+    /* magic number */
+    avio_wb16(avf->pb, 0xCCCC);
+    avio_w8(avf->pb, 0xED);
+
+    /* program version (identify as ffmpeg) */
+    avio_wb16(avf->pb, 0xFF00);
+    avio_w8(avf->pb, 0x60);
+
+    /* format version, only version 0.001 supported for now */
+    avio_wb16(avf->pb, 0x0001);
+
+    /* reserved */
+    avio_wb16(avf->pb, 0x000);
+    avio_w8(avf->pb, 0x00);
+
+    rcwt_init_cluster(avf);
+
+    return 0;
+}
+
+static int rcwt_write_packet(AVFormatContext *avf, AVPacket *pkt)
+{
+    RCWTContext *rcwt = avf->priv_data;
+
+    int in_block = 0;
+    int nb_block_bytes = 0;
+
+    if (pkt->size == 0)
+        return 0;
+
+    /* new PTS, new cluster */
+    if (pkt->pts != rcwt->cluster_pts) {
+        rcwt_flush_cluster(avf);
+        rcwt->cluster_pts = pkt->pts;
+    }
+
+    if (pkt->pts == AV_NOPTS_VALUE) {
+        av_log(avf, AV_LOG_WARNING, "Ignoring CC packet with no PTS\n");
+        return 0;
+    }
+
+    for (int i = 0; i < pkt->size; i++) {
+        uint8_t cc_valid;
+        uint8_t cc_type;
+
+        if (rcwt->cluster_nb_blocks == RCWT_CLUSTER_MAX_BLOCKS) {
+            av_log(avf, AV_LOG_WARNING,
+                    "Starting new cluster due to size\n");
+            rcwt_flush_cluster(avf);
+        }
+
+        cc_valid = (pkt->data[i] & 0x04) >> 2;
+        cc_type = pkt->data[i] & 0x03;
+
+        if (!in_block && !(cc_valid || cc_type == 3))
+            continue;
+
+        memcpy(&rcwt->cluster_buf[rcwt->cluster_pos],
+                &pkt->data[i], sizeof(uint8_t));
+        rcwt->cluster_pos++;
+
+        if (!in_block) {
+            in_block = 1;
+            nb_block_bytes = 1;
+            continue;
+        }
+
+        nb_block_bytes++;
+
+        if (nb_block_bytes == RCWT_BLOCK_SIZE) {
+            in_block = 0;
+            nb_block_bytes = 0;
+            rcwt->cluster_nb_blocks++;
+        }
+    }
+
+    return 0;
+}
+
+static int rcwt_write_trailer(AVFormatContext *avf)
+{
+    rcwt_flush_cluster(avf);
+
+    return 0;
+}
+
+const FFOutputFormat ff_rcwt_muxer = {
+    .p.name             = "rcwt",
+    .p.long_name        = NULL_IF_CONFIG_SMALL("Raw Captions With Time"),
+    .p.extensions       = "bin",
+    .p.flags            = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
+    .p.subtitle_codec   = AV_CODEC_ID_EIA_608,
+    .priv_data_size     = sizeof(RCWTContext),
+    .write_header       = rcwt_write_header,
+    .write_packet       = rcwt_write_packet,
+    .write_trailer      = rcwt_write_trailer
+};
diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 59595b9cc1..d7edd31e85 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -118,6 +118,9 @@ fate-sub-scc: CMD = fmtstdout ass -ss 57 -i $(TARGET_SAMPLES)/sub/witch.scc
 FATE_SUBTITLES-$(call DEMMUX, SCC, SCC) += fate-sub-scc-remux
 fate-sub-scc-remux: CMD = fmtstdout scc -i $(TARGET_SAMPLES)/sub/witch.scc -ss 4:00 -map 0 -c copy
 
+FATE_SUBTITLES-$(call DEMMUX, SCC, RCWT) += fate-sub-rcwt
+fate-sub-rcwt: CMD = md5 -i $(TARGET_SAMPLES)/sub/witch.scc -map 0 -c copy -f rcwt
+
 FATE_SUBTITLES-$(call ALLYES, MPEGTS_DEMUXER DVBSUB_DECODER DVBSUB_ENCODER) += fate-sub-dvb
 fate-sub-dvb: CMD = framecrc -i $(TARGET_SAMPLES)/sub/dvbsubtest_filter.ts -map s:0 -c dvbsub
 
diff --git a/tests/ref/fate/sub-rcwt b/tests/ref/fate/sub-rcwt
new file mode 100644
index 0000000000..722cbe1c5b
--- /dev/null
+++ b/tests/ref/fate/sub-rcwt
@@ -0,0 +1 @@
+d86f179094a5752d68aa97d82cf887b0
-- 
2.34.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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH] libavformat: add RCWT closed caption muxer
  2024-01-06  2:14 [FFmpeg-devel] [PATCH] libavformat: add RCWT closed caption muxer Marth64
@ 2024-01-06 12:33 ` Stefano Sabatini
  2024-01-06 21:41   ` [FFmpeg-devel] [PATCH v2] " Marth64
  0 siblings, 1 reply; 14+ messages in thread
From: Stefano Sabatini @ 2024-01-06 12:33 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Marth64

On date Friday 2024-01-05 20:14:58 -0600, Marth64 wrote:
> Signed-off-by: Marth64 <marth64@proxyid.net>
> 
> Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
> used open source tool for processing 608/708 closed caption (CC) sources.
> It can be used to archive the original, raw CC bitstream and to produce
> a source file file for later CC processing or conversion. As a result,

file file

> it also allows for interopability with ccextractor for processing CC data
> extracted via ffmpeg. The format is simple to parse and can be used
> to retain all lines and variants of CC.
> 
> A free specification of RCWT can be found here:
> https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT

> This muxer implements the specification as of 01/05/2024, which has

nit: use 2023-01-05 or EU format (2024/01/05) to avoid ambiguity

> been stable and unchanged for 10 years as of this writing.
> 
> This muxer will have some nuances from the way that ccextractor muxes RCWT.
> No compatibility issues when processing the output with ccextractor
> have been observed as a result of this so far, but mileage may vary
> and outputs will not be a bit-exact match.
> 
> Specifically, the differences are:
> (1)  This muxer will identify as "FF" as the writing program identifier, so
> as to be honest about the output's origin.
> 
> (2)  ffmpeg's MPEG-1/2, H264, HEVC, etc. decoders extract closed captioning
> data differently than ccextractor from embedded SEI/user data.
> For example, DVD captioning bytes will be translated to ATSC A53 format.
> This allows ffmpeg to handle 608/708 in a consistant way downstream.
> This is a lossless conversion and the meaningful data is retained.
> 
> (3)  This muxer will not alter the extracted data except to remove invalid
> packets in between valid CC blocks. On the other hand, ccextractor
> will by default remove mid-stream padding, and add padding at the end
> of the stream (in order to convey the end time of the source video).

This is a nice highlight and should be probably partially moved to
muxers.texi to expose this information to users (although many/most
are not documented, we should start to do so).

> ---
>  libavformat/Makefile     |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/rcwtenc.c    | 203 +++++++++++++++++++++++++++++++++++++++
>  tests/fate/subtitles.mak |   3 +
>  tests/ref/fate/sub-rcwt  |   1 +

missing Changelog entry, and I don't remember if new elements addition
entails a minor library bump (probably it should)

>  5 files changed, 209 insertions(+)
>  create mode 100644 libavformat/rcwtenc.c
>  create mode 100644 tests/ref/fate/sub-rcwt
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 45dba53044..03c2c70e67 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -489,6 +489,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)               += qoadec.o
>  OBJS-$(CONFIG_R3D_DEMUXER)               += r3d.o
>  OBJS-$(CONFIG_RAWVIDEO_DEMUXER)          += rawvideodec.o
>  OBJS-$(CONFIG_RAWVIDEO_MUXER)            += rawenc.o
> +OBJS-$(CONFIG_RCWT_MUXER)                += rcwtenc.o subtitles.o
>  OBJS-$(CONFIG_REALTEXT_DEMUXER)          += realtextdec.o subtitles.o
>  OBJS-$(CONFIG_REDSPARK_DEMUXER)          += redspark.o
>  OBJS-$(CONFIG_RKA_DEMUXER)               += rka.o apetag.o img2.o
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index dc2acf575c..fb14f15739 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -388,6 +388,7 @@ extern const AVInputFormat  ff_qoa_demuxer;
>  extern const AVInputFormat  ff_r3d_demuxer;
>  extern const AVInputFormat  ff_rawvideo_demuxer;
>  extern const FFOutputFormat ff_rawvideo_muxer;
> +extern const FFOutputFormat ff_rcwt_muxer;
>  extern const AVInputFormat  ff_realtext_demuxer;
>  extern const AVInputFormat  ff_redspark_demuxer;
>  extern const AVInputFormat  ff_rka_demuxer;
> diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
> new file mode 100644
> index 0000000000..f70a80b175
> --- /dev/null
> +++ b/libavformat/rcwtenc.c
> @@ -0,0 +1,203 @@
> +/*
> + * Raw Captions With Time (RCWT) muxer
> + * Author: Marth64 <marth64@proxyid.net>
> + *
> + * 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
> + */
> +

> +/*
> + * Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
> + * used open source tool for processing 608/708 closed caption (CC) sources.
> + * It can be used to archive the original, raw CC bitstream and to produce
> + * a source file file for later CC processing or conversion. As a result,
> + * it also allows for interopability with ccextractor for processing CC data
> + * extracted via ffmpeg. The format is simple to parse and can be used
> + * to retain all lines and variants of CC.
> + *
> + * A free specification of RCWT can be found here:
> + * https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT
> + * This muxer implements the specification as of 01/05/2024, which has
> + * been stable and unchanged for 10 years as of this writing.
> + *
> + * This muxer will have some nuances from the way that ccextractor muxes RCWT.
> + * No compatibility issues when processing the output with ccextractor
> + * have been observed as a result of this so far, but mileage may vary
> + * and outputs will not be a bit-exact match.
> + *
> + * Specifically, the differences are:
> + * (1)  This muxer will identify as "FF" as the writing program identifier, so
> + *      as to be honest about the output's origin.
> + * (2)  ffmpeg's MPEG-1/2, H264, HEVC, etc. decoders extract closed captioning
> + *      data differently than ccextractor from embedded SEI/user data.
> + *      For example, DVD captioning bytes will be translated to ATSC A53 format.
> + *      This allows ffmpeg to handle 608/708 in a consistant way downstream.
> + *      This is a lossless conversion and the meaningful data is retained.
> + * (3)  This muxer will not alter the extracted data except to remove invalid
> + *      packets in between valid CC blocks. On the other hand, ccextractor
> + *      will by default remove mid-stream padding, and add padding at the end
> + *      of the stream (in order to convey the end time of the source video).
> + */

ditto

> +
> +#include "avformat.h"
> +#include "internal.h"
> +#include "mux.h"
> +#include "libavutil/log.h"
> +#include "libavutil/intreadwrite.h"
> +
> +#define RCWT_CLUSTER_MAX_BLOCKS             65535

> +#define RCWT_BLOCK_SIZE                     3 * sizeof(uint8_t)

or just use 3

> +
> +typedef struct RCWTContext {
> +    int cluster_nb_blocks;
> +    int cluster_pos;
> +    int64_t cluster_pts;
> +    uint8_t cluster_buf[RCWT_CLUSTER_MAX_BLOCKS * RCWT_BLOCK_SIZE];
> +} RCWTContext;
> +
> +static void rcwt_init_cluster(AVFormatContext *avf)
> +{
> +    RCWTContext *rcwt = avf->priv_data;
> +
> +    rcwt->cluster_nb_blocks = 0;
> +    rcwt->cluster_pos = 0;
> +    rcwt->cluster_pts = AV_NOPTS_VALUE;
> +    memset(rcwt->cluster_buf, 0, sizeof(rcwt->cluster_buf));
> +}
> +
> +static void rcwt_flush_cluster(AVFormatContext *avf)
> +{
> +    RCWTContext *rcwt = avf->priv_data;
> +
> +    if (rcwt->cluster_nb_blocks > 0) {
> +        avio_wl64(avf->pb, rcwt->cluster_pts);
> +        avio_wl16(avf->pb, rcwt->cluster_nb_blocks);

> +        avio_write(avf->pb, rcwt->cluster_buf,
> +                (rcwt->cluster_nb_blocks * RCWT_BLOCK_SIZE));

nit: weird indent

> +    }
> +
> +    rcwt_init_cluster(avf);
> +}
> +
> +static int rcwt_write_header(AVFormatContext *avf)
> +{

> +    if (avf->nb_streams != 1
> +            || avf->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE
> +            || avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_EIA_608) {

nit+: weird indent

> +        av_log(avf, AV_LOG_ERROR,

> +               "RCWT supports only one CC (608/708) stream\n");

this could be more explicit:
"RCWT supports only one CC (608/708) stream, more than one stream was
provided or its codec type was not CC (608/708)\n");

> +        return AVERROR(EINVAL);
> +    }
> +
> +    avpriv_set_pts_info(avf->streams[0], 64, 1, 1000);
> +
> +    /* magic number */
> +    avio_wb16(avf->pb, 0xCCCC);
> +    avio_w8(avf->pb, 0xED);
> +
> +    /* program version (identify as ffmpeg) */
> +    avio_wb16(avf->pb, 0xFF00);
> +    avio_w8(avf->pb, 0x60);
> +
> +    /* format version, only version 0.001 supported for now */
> +    avio_wb16(avf->pb, 0x0001);
> +
> +    /* reserved */
> +    avio_wb16(avf->pb, 0x000);
> +    avio_w8(avf->pb, 0x00);
> +
> +    rcwt_init_cluster(avf);
> +
> +    return 0;
> +}
> +
> +static int rcwt_write_packet(AVFormatContext *avf, AVPacket *pkt)
> +{
> +    RCWTContext *rcwt = avf->priv_data;
> +
> +    int in_block = 0;
> +    int nb_block_bytes = 0;
> +
> +    if (pkt->size == 0)
> +        return 0;
> +
> +    /* new PTS, new cluster */
> +    if (pkt->pts != rcwt->cluster_pts) {
> +        rcwt_flush_cluster(avf);
> +        rcwt->cluster_pts = pkt->pts;
> +    }
> +
> +    if (pkt->pts == AV_NOPTS_VALUE) {
> +        av_log(avf, AV_LOG_WARNING, "Ignoring CC packet with no PTS\n");
> +        return 0;
> +    }
> +
> +    for (int i = 0; i < pkt->size; i++) {
> +        uint8_t cc_valid;
> +        uint8_t cc_type;
> +
> +        if (rcwt->cluster_nb_blocks == RCWT_CLUSTER_MAX_BLOCKS) {
> +            av_log(avf, AV_LOG_WARNING,
> +                    "Starting new cluster due to size\n");
> +            rcwt_flush_cluster(avf);
> +        }
> +

> +        cc_valid = (pkt->data[i] & 0x04) >> 2;

nit: no need to shift

> +        cc_type = pkt->data[i] & 0x03;
> +
> +        if (!in_block && !(cc_valid || cc_type == 3))
> +            continue;
> +

> +        memcpy(&rcwt->cluster_buf[rcwt->cluster_pos],
> +                &pkt->data[i], sizeof(uint8_t));

indent

> +        rcwt->cluster_pos++;
> +
> +        if (!in_block) {
> +            in_block = 1;
> +            nb_block_bytes = 1;
> +            continue;
> +        }
> +
> +        nb_block_bytes++;
> +
> +        if (nb_block_bytes == RCWT_BLOCK_SIZE) {
> +            in_block = 0;
> +            nb_block_bytes = 0;
> +            rcwt->cluster_nb_blocks++;
> +        }
> +    }
> +
> +    return 0;
> +}
> +
> +static int rcwt_write_trailer(AVFormatContext *avf)
> +{
> +    rcwt_flush_cluster(avf);
> +
> +    return 0;
> +}
> +
> +const FFOutputFormat ff_rcwt_muxer = {
> +    .p.name             = "rcwt",
> +    .p.long_name        = NULL_IF_CONFIG_SMALL("Raw Captions With Time"),
> +    .p.extensions       = "bin",
> +    .p.flags            = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
> +    .p.subtitle_codec   = AV_CODEC_ID_EIA_608,
> +    .priv_data_size     = sizeof(RCWTContext),
> +    .write_header       = rcwt_write_header,
> +    .write_packet       = rcwt_write_packet,
> +    .write_trailer      = rcwt_write_trailer
> +};

No more comments from me, thanks.
_______________________________________________
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] 14+ messages in thread

* [FFmpeg-devel] [PATCH v2] libavformat: add RCWT closed caption muxer
  2024-01-06 12:33 ` Stefano Sabatini
@ 2024-01-06 21:41   ` Marth64
  2024-01-07 12:02     ` Stefano Sabatini
  0 siblings, 1 reply; 14+ messages in thread
From: Marth64 @ 2024-01-06 21:41 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marth64

Signed-off-by: Marth64 <marth64@proxyid.net>

Thank you for the good feedback and review. Most feedback is addressed.

>  nit: no need to shift
I left this alone only since I see it being done this way in lavf/ccfifo
and other documentation. I assumed it could be doing the shift for a reason,
but I can study further why if you think it shouldn't shift.

> I don't remember if new elements addition entails a minor library bump (probably it should)
I reviewed APIchangelog and didn't see similar type of bumps for adding to allformats.
The publically exposed codec ID has been in ffmpeg for a long time.
But I am happy to patch in a version bump with your confirmation.

Much appreciated,
Marth64

---
 Changelog                |   1 +
 doc/muxers.texi          |  40 ++++++++++
 libavformat/Makefile     |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtenc.c    | 166 +++++++++++++++++++++++++++++++++++++++
 tests/fate/subtitles.mak |   3 +
 tests/ref/fate/sub-rcwt  |   1 +
 7 files changed, 213 insertions(+)
 create mode 100644 libavformat/rcwtenc.c
 create mode 100644 tests/ref/fate/sub-rcwt

diff --git a/Changelog b/Changelog
index 5b2899d05b..3d60f688ca 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,7 @@ version <next>:
 - lavu/eval: introduce randomi() function in expressions
 - VVC decoder
 - fsync filter
+- Raw Captions with Time (RCWT) closed caption demuxer
 
 version 6.1:
 - libaribcaption decoder
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 7b705b6a9e..0bdeaeeaf3 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2232,6 +2232,46 @@ Extensions: thd
 
 SMPTE 421M / VC-1 video.
 
+@anchor{rcwt}
+@section rcwt
+
+Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 closed caption (CC) sources.
+It can be used to archive the original, raw CC bitstream and to produce
+a source file for later CC processing or conversion. As a result,
+it also allows for interopability with ccextractor for processing CC data
+extracted via ffmpeg. The format is simple to parse and can be used
+to retain all lines and variants of CC.
+
+This muxer implements the specification as of 2024-01-05, which has
+been stable and unchanged for 10 years as of this writing.
+
+This muxer will have some nuances from the way that ccextractor muxes RCWT.
+No compatibility issues when processing the output with ccextractor
+have been observed as a result of this so far, but mileage may vary
+and outputs will not be a bit-exact match.
+
+Specifically, the differences are:
+@enumerate
+@item
+This muxer will identify as "FF" as the writing program identifier, so
+as to be honest about the output's origin.
+@item
+ffmpeg's MPEG-1/2, H264, HEVC, etc. decoders extract closed captioning
+data differently than ccextractor from embedded SEI/user data.
+For example, DVD captioning bytes will be translated to ATSC A53 format.
+This allows ffmpeg to handle 608/708 in a consistant way downstream.
+This is a lossless conversion and the meaningful data is retained.
+@item
+This muxer will not alter the extracted data except to remove invalid
+packets in between valid CC blocks. On the other hand, ccextractor
+will by default remove mid-stream padding, and add padding at the end
+of the stream (in order to convey the end time of the source video).
+@end enumerate
+
+A free specification of RCWT can be found here:
+@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 581e378d95..dcc99eeac4 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -490,6 +490,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)               += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)               += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)          += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)            += rawenc.o
+OBJS-$(CONFIG_RCWT_MUXER)                += rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)          += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)          += redspark.o
 OBJS-$(CONFIG_RKA_DEMUXER)               += rka.o apetag.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ce6be5f04d..b04b43cab3 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -389,6 +389,7 @@ extern const AVInputFormat  ff_qoa_demuxer;
 extern const AVInputFormat  ff_r3d_demuxer;
 extern const AVInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFOutputFormat ff_rcwt_muxer;
 extern const AVInputFormat  ff_realtext_demuxer;
 extern const AVInputFormat  ff_redspark_demuxer;
 extern const AVInputFormat  ff_rka_demuxer;
diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
new file mode 100644
index 0000000000..17382548aa
--- /dev/null
+++ b/libavformat/rcwtenc.c
@@ -0,0 +1,166 @@
+/*
+ * Raw Captions With Time (RCWT) muxer
+ * Author: Marth64 <marth64@proxyid.net>
+ *
+ * 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
+ */
+
+#include "avformat.h"
+#include "internal.h"
+#include "mux.h"
+#include "libavutil/log.h"
+#include "libavutil/intreadwrite.h"
+
+#define RCWT_CLUSTER_MAX_BLOCKS             65535
+#define RCWT_BLOCK_SIZE                     3
+
+typedef struct RCWTContext {
+    int cluster_nb_blocks;
+    int cluster_pos;
+    int64_t cluster_pts;
+    uint8_t cluster_buf[RCWT_CLUSTER_MAX_BLOCKS * RCWT_BLOCK_SIZE];
+} RCWTContext;
+
+static void rcwt_init_cluster(AVFormatContext *avf)
+{
+    RCWTContext *rcwt = avf->priv_data;
+
+    rcwt->cluster_nb_blocks = 0;
+    rcwt->cluster_pos = 0;
+    rcwt->cluster_pts = AV_NOPTS_VALUE;
+    memset(rcwt->cluster_buf, 0, sizeof(rcwt->cluster_buf));
+}
+
+static void rcwt_flush_cluster(AVFormatContext *avf)
+{
+    RCWTContext *rcwt = avf->priv_data;
+
+    if (rcwt->cluster_nb_blocks > 0) {
+        avio_wl64(avf->pb, rcwt->cluster_pts);
+        avio_wl16(avf->pb, rcwt->cluster_nb_blocks);
+        avio_write(avf->pb, rcwt->cluster_buf, (rcwt->cluster_nb_blocks * RCWT_BLOCK_SIZE));
+    }
+
+    rcwt_init_cluster(avf);
+}
+
+static int rcwt_write_header(AVFormatContext *avf)
+{
+    if (avf->nb_streams != 1 || avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_EIA_608) {
+        av_log(avf, AV_LOG_ERROR,
+                "RCWT supports only one CC (608/708) stream, more than one stream was "
+                "provided or its codec type was not CC (608/708)\n");
+        return AVERROR(EINVAL);
+    }
+
+    avpriv_set_pts_info(avf->streams[0], 64, 1, 1000);
+
+    /* magic number */
+    avio_wb16(avf->pb, 0xCCCC);
+    avio_w8(avf->pb, 0xED);
+
+    /* program version (identify as ffmpeg) */
+    avio_wb16(avf->pb, 0xFF00);
+    avio_w8(avf->pb, 0x60);
+
+    /* format version, only version 0.001 supported for now */
+    avio_wb16(avf->pb, 0x0001);
+
+    /* reserved */
+    avio_wb16(avf->pb, 0x000);
+    avio_w8(avf->pb, 0x00);
+
+    rcwt_init_cluster(avf);
+
+    return 0;
+}
+
+static int rcwt_write_packet(AVFormatContext *avf, AVPacket *pkt)
+{
+    RCWTContext *rcwt = avf->priv_data;
+
+    int in_block = 0;
+    int nb_block_bytes = 0;
+
+    if (pkt->size == 0)
+        return 0;
+
+    /* new PTS, new cluster */
+    if (pkt->pts != rcwt->cluster_pts) {
+        rcwt_flush_cluster(avf);
+        rcwt->cluster_pts = pkt->pts;
+    }
+
+    if (pkt->pts == AV_NOPTS_VALUE) {
+        av_log(avf, AV_LOG_WARNING, "Ignoring CC packet with no PTS\n");
+        return 0;
+    }
+
+    for (int i = 0; i < pkt->size; i++) {
+        uint8_t cc_valid;
+        uint8_t cc_type;
+
+        if (rcwt->cluster_nb_blocks == RCWT_CLUSTER_MAX_BLOCKS) {
+            av_log(avf, AV_LOG_WARNING, "Starting new cluster due to size\n");
+            rcwt_flush_cluster(avf);
+        }
+
+        cc_valid = (pkt->data[i] & 0x04) >> 2;
+        cc_type = pkt->data[i] & 0x03;
+
+        if (!in_block && !(cc_valid || cc_type == 3))
+            continue;
+
+        memcpy(&rcwt->cluster_buf[rcwt->cluster_pos], &pkt->data[i], 1);
+        rcwt->cluster_pos++;
+
+        if (!in_block) {
+            in_block = 1;
+            nb_block_bytes = 1;
+            continue;
+        }
+
+        nb_block_bytes++;
+
+        if (nb_block_bytes == RCWT_BLOCK_SIZE) {
+            in_block = 0;
+            nb_block_bytes = 0;
+            rcwt->cluster_nb_blocks++;
+        }
+    }
+
+    return 0;
+}
+
+static int rcwt_write_trailer(AVFormatContext *avf)
+{
+    rcwt_flush_cluster(avf);
+
+    return 0;
+}
+
+const FFOutputFormat ff_rcwt_muxer = {
+    .p.name             = "rcwt",
+    .p.long_name        = NULL_IF_CONFIG_SMALL("Raw Captions With Time"),
+    .p.extensions       = "bin",
+    .p.flags            = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
+    .p.subtitle_codec   = AV_CODEC_ID_EIA_608,
+    .priv_data_size     = sizeof(RCWTContext),
+    .write_header       = rcwt_write_header,
+    .write_packet       = rcwt_write_packet,
+    .write_trailer      = rcwt_write_trailer
+};
diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 59595b9cc1..d7edd31e85 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -118,6 +118,9 @@ fate-sub-scc: CMD = fmtstdout ass -ss 57 -i $(TARGET_SAMPLES)/sub/witch.scc
 FATE_SUBTITLES-$(call DEMMUX, SCC, SCC) += fate-sub-scc-remux
 fate-sub-scc-remux: CMD = fmtstdout scc -i $(TARGET_SAMPLES)/sub/witch.scc -ss 4:00 -map 0 -c copy
 
+FATE_SUBTITLES-$(call DEMMUX, SCC, RCWT) += fate-sub-rcwt
+fate-sub-rcwt: CMD = md5 -i $(TARGET_SAMPLES)/sub/witch.scc -map 0 -c copy -f rcwt
+
 FATE_SUBTITLES-$(call ALLYES, MPEGTS_DEMUXER DVBSUB_DECODER DVBSUB_ENCODER) += fate-sub-dvb
 fate-sub-dvb: CMD = framecrc -i $(TARGET_SAMPLES)/sub/dvbsubtest_filter.ts -map s:0 -c dvbsub
 
diff --git a/tests/ref/fate/sub-rcwt b/tests/ref/fate/sub-rcwt
new file mode 100644
index 0000000000..722cbe1c5b
--- /dev/null
+++ b/tests/ref/fate/sub-rcwt
@@ -0,0 +1 @@
+d86f179094a5752d68aa97d82cf887b0
-- 
2.34.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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] libavformat: add RCWT closed caption muxer
  2024-01-06 21:41   ` [FFmpeg-devel] [PATCH v2] " Marth64
@ 2024-01-07 12:02     ` Stefano Sabatini
  2024-01-07 15:07       ` [FFmpeg-devel] [PATCH v3] " Marth64
  0 siblings, 1 reply; 14+ messages in thread
From: Stefano Sabatini @ 2024-01-07 12:02 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Marth64

On date Saturday 2024-01-06 15:41:05 -0600, Marth64 wrote:
> Signed-off-by: Marth64 <marth64@proxyid.net>
> 
> Thank you for the good feedback and review. Most feedback is addressed.
> 
> >  nit: no need to shift
> I left this alone only since I see it being done this way in lavf/ccfifo
> and other documentation. I assumed it could be doing the shift for a reason,
> but I can study further why if you think it shouldn't shift.
> 
> > I don't remember if new elements addition entails a minor library bump (probably it should)
> I reviewed APIchangelog and didn't see similar type of bumps for adding to allformats.
> The publically exposed codec ID has been in ffmpeg for a long time.
> But I am happy to patch in a version bump with your confirmation.
> 
> Much appreciated,
> Marth64
> 
> ---
>  Changelog                |   1 +
>  doc/muxers.texi          |  40 ++++++++++
>  libavformat/Makefile     |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/rcwtenc.c    | 166 +++++++++++++++++++++++++++++++++++++++
>  tests/fate/subtitles.mak |   3 +
>  tests/ref/fate/sub-rcwt  |   1 +
>  7 files changed, 213 insertions(+)
>  create mode 100644 libavformat/rcwtenc.c
>  create mode 100644 tests/ref/fate/sub-rcwt
> 
> diff --git a/Changelog b/Changelog
> index 5b2899d05b..3d60f688ca 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -18,6 +18,7 @@ version <next>:
>  - lavu/eval: introduce randomi() function in expressions
>  - VVC decoder
>  - fsync filter

> +- Raw Captions with Time (RCWT) closed caption demuxer

demuxer -> muxer?

>  
>  version 6.1:
>  - libaribcaption decoder
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 7b705b6a9e..0bdeaeeaf3 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -2232,6 +2232,46 @@ Extensions: thd
>  
>  SMPTE 421M / VC-1 video.
>  
> +@anchor{rcwt}
> +@section rcwt
> +
> +Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
> +used open source tool for processing 608/708 closed caption (CC) sources.
> +It can be used to archive the original, raw CC bitstream and to produce
> +a source file for later CC processing or conversion. As a result,
> +it also allows for interopability with ccextractor for processing CC data
> +extracted via ffmpeg. The format is simple to parse and can be used
> +to retain all lines and variants of CC.

> +This muxer implements the specification as of 2024-01-05, which has
> +been stable and unchanged for 10 years as of this writing.
> +
> +This muxer will have some nuances from the way that ccextractor muxes RCWT.
> +No compatibility issues when processing the output with ccextractor
> +have been observed as a result of this so far, but mileage may vary
> +and outputs will not be a bit-exact match.
> +
> +Specifically, the differences are:
> +@enumerate
> +@item
> +This muxer will identify as "FF" as the writing program identifier, so
> +as to be honest about the output's origin.
> +@item
> +ffmpeg's MPEG-1/2, H264, HEVC, etc. decoders extract closed captioning
> +data differently than ccextractor from embedded SEI/user data.
> +For example, DVD captioning bytes will be translated to ATSC A53 format.
> +This allows ffmpeg to handle 608/708 in a consistant way downstream.
> +This is a lossless conversion and the meaningful data is retained.
> +@item
> +This muxer will not alter the extracted data except to remove invalid
> +packets in between valid CC blocks. On the other hand, ccextractor
> +will by default remove mid-stream padding, and add padding at the end
> +of the stream (in order to convey the end time of the source video).
> +@end enumerate

This part is probably a bit too technical for user documentation,
especially for the details related to the implmentation (which might
change), so probably can/should be left out.

You might keep the link to the file format below though.

[...]

LGTM otherwise.
_______________________________________________
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] 14+ messages in thread

* [FFmpeg-devel] [PATCH v3] libavformat: add RCWT closed caption muxer
  2024-01-07 12:02     ` Stefano Sabatini
@ 2024-01-07 15:07       ` Marth64
  2024-01-07 15:24         ` Stefano Sabatini
  0 siblings, 1 reply; 14+ messages in thread
From: Marth64 @ 2024-01-07 15:07 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marth64

Thanks, long night. Should come together nicer now.

Signed-off-by: Marth64 <marth64@proxyid.net>
---
 Changelog                |   1 +
 doc/muxers.texi          |  22 +++++
 libavformat/Makefile     |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtenc.c    | 202 +++++++++++++++++++++++++++++++++++++++
 tests/fate/subtitles.mak |   3 +
 tests/ref/fate/sub-rcwt  |   1 +
 7 files changed, 231 insertions(+)
 create mode 100644 libavformat/rcwtenc.c
 create mode 100644 tests/ref/fate/sub-rcwt

diff --git a/Changelog b/Changelog
index 5b2899d05b..4e7c1ce2c1 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,7 @@ version <next>:
 - lavu/eval: introduce randomi() function in expressions
 - VVC decoder
 - fsync filter
+- Raw Captions with Time (RCWT) closed caption muxer
 
 version 6.1:
 - libaribcaption decoder
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 7b705b6a9e..9cacbfc23e 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2232,6 +2232,28 @@ Extensions: thd
 
 SMPTE 421M / VC-1 video.
 
+@anchor{rcwt}
+@section rcwt
+
+Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 closed caption (CC) sources.
+It can be used to archive the original, raw CC bitstream and to produce
+a source file for later CC processing or conversion. As a result,
+it also allows for interopability with ccextractor for processing CC data
+extracted via ffmpeg. The format is simple to parse and can be used
+to retain all lines and variants of CC.
+
+This muxer implements the specification as of 2024-01-05, which has
+been stable and unchanged for 10 years as of this writing.
+
+This muxer will have some nuances from the way that ccextractor muxes RCWT.
+No compatibility issues when processing the output with ccextractor
+have been observed as a result of this so far, but mileage may vary
+and outputs will not be a bit-exact match.
+
+A free specification of RCWT can be found here:
+@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 581e378d95..dcc99eeac4 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -490,6 +490,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)               += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)               += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)          += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)            += rawenc.o
+OBJS-$(CONFIG_RCWT_MUXER)                += rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)          += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)          += redspark.o
 OBJS-$(CONFIG_RKA_DEMUXER)               += rka.o apetag.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ce6be5f04d..b04b43cab3 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -389,6 +389,7 @@ extern const AVInputFormat  ff_qoa_demuxer;
 extern const AVInputFormat  ff_r3d_demuxer;
 extern const AVInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFOutputFormat ff_rcwt_muxer;
 extern const AVInputFormat  ff_realtext_demuxer;
 extern const AVInputFormat  ff_redspark_demuxer;
 extern const AVInputFormat  ff_rka_demuxer;
diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
new file mode 100644
index 0000000000..839436ce84
--- /dev/null
+++ b/libavformat/rcwtenc.c
@@ -0,0 +1,202 @@
+/*
+ * Raw Captions With Time (RCWT) muxer
+ * Author: Marth64 <marth64@proxyid.net>
+ *
+ * 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
+ */
+
+/*
+ * Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
+ * used open source tool for processing 608/708 closed caption (CC) sources.
+ * It can be used to archive the original, raw CC bitstream and to produce
+ * a source file for later CC processing or conversion. As a result,
+ * it also allows for interopability with ccextractor for processing CC data
+ * extracted via ffmpeg. The format is simple to parse and can be used
+ * to retain all lines and variants of CC.
+ *
+ * This muxer implements the specification as of 2024-01-05, which has
+ * been stable and unchanged for 10 years as of this writing.
+ *
+ * This muxer will have some nuances from the way that ccextractor muxes RCWT.
+ * No compatibility issues when processing the output with ccextractor
+ * have been observed as a result of this so far, but mileage may vary
+ * and outputs will not be a bit-exact match.
+ *
+ * Specifically, the differences are:
+ * (1) This muxer will identify as "FF" as the writing program identifier, so
+ *     as to be honest about the output's origin.
+ *
+ * (2) ffmpeg's MPEG-1/2, H264, HEVC, etc. decoders extract closed captioning
+ *     data differently than ccextractor from embedded SEI/user data.
+ *     For example, DVD captioning bytes will be translated to ATSC A53 format.
+ *     This allows ffmpeg to handle 608/708 in a consistant way downstream.
+ *     This is a lossless conversion and the meaningful data is retained.
+ *
+ * (3) This muxer will not alter the extracted data except to remove invalid
+ *     packets in between valid CC blocks. On the other hand, ccextractor
+ *     will by default remove mid-stream padding, and add padding at the end
+ *     of the stream (in order to convey the end time of the source video).
+ *
+ * A free specification of RCWT can be found here:
+ * @url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
+ */
+
+#include "avformat.h"
+#include "internal.h"
+#include "mux.h"
+#include "libavutil/log.h"
+#include "libavutil/intreadwrite.h"
+
+#define RCWT_CLUSTER_MAX_BLOCKS             65535
+#define RCWT_BLOCK_SIZE                     3
+
+typedef struct RCWTContext {
+    int cluster_nb_blocks;
+    int cluster_pos;
+    int64_t cluster_pts;
+    uint8_t cluster_buf[RCWT_CLUSTER_MAX_BLOCKS * RCWT_BLOCK_SIZE];
+} RCWTContext;
+
+static void rcwt_init_cluster(AVFormatContext *avf)
+{
+    RCWTContext *rcwt = avf->priv_data;
+
+    rcwt->cluster_nb_blocks = 0;
+    rcwt->cluster_pos = 0;
+    rcwt->cluster_pts = AV_NOPTS_VALUE;
+    memset(rcwt->cluster_buf, 0, sizeof(rcwt->cluster_buf));
+}
+
+static void rcwt_flush_cluster(AVFormatContext *avf)
+{
+    RCWTContext *rcwt = avf->priv_data;
+
+    if (rcwt->cluster_nb_blocks > 0) {
+        avio_wl64(avf->pb, rcwt->cluster_pts);
+        avio_wl16(avf->pb, rcwt->cluster_nb_blocks);
+        avio_write(avf->pb, rcwt->cluster_buf, (rcwt->cluster_nb_blocks * RCWT_BLOCK_SIZE));
+    }
+
+    rcwt_init_cluster(avf);
+}
+
+static int rcwt_write_header(AVFormatContext *avf)
+{
+    if (avf->nb_streams != 1 || avf->streams[0]->codecpar->codec_id != AV_CODEC_ID_EIA_608) {
+        av_log(avf, AV_LOG_ERROR,
+                "RCWT supports only one CC (608/708) stream, more than one stream was "
+                "provided or its codec type was not CC (608/708)\n");
+        return AVERROR(EINVAL);
+    }
+
+    avpriv_set_pts_info(avf->streams[0], 64, 1, 1000);
+
+    /* magic number */
+    avio_wb16(avf->pb, 0xCCCC);
+    avio_w8(avf->pb, 0xED);
+
+    /* program version (identify as ffmpeg) */
+    avio_wb16(avf->pb, 0xFF00);
+    avio_w8(avf->pb, 0x60);
+
+    /* format version, only version 0.001 supported for now */
+    avio_wb16(avf->pb, 0x0001);
+
+    /* reserved */
+    avio_wb16(avf->pb, 0x000);
+    avio_w8(avf->pb, 0x00);
+
+    rcwt_init_cluster(avf);
+
+    return 0;
+}
+
+static int rcwt_write_packet(AVFormatContext *avf, AVPacket *pkt)
+{
+    RCWTContext *rcwt = avf->priv_data;
+
+    int in_block = 0;
+    int nb_block_bytes = 0;
+
+    if (pkt->size == 0)
+        return 0;
+
+    /* new PTS, new cluster */
+    if (pkt->pts != rcwt->cluster_pts) {
+        rcwt_flush_cluster(avf);
+        rcwt->cluster_pts = pkt->pts;
+    }
+
+    if (pkt->pts == AV_NOPTS_VALUE) {
+        av_log(avf, AV_LOG_WARNING, "Ignoring CC packet with no PTS\n");
+        return 0;
+    }
+
+    for (int i = 0; i < pkt->size; i++) {
+        uint8_t cc_valid;
+        uint8_t cc_type;
+
+        if (rcwt->cluster_nb_blocks == RCWT_CLUSTER_MAX_BLOCKS) {
+            av_log(avf, AV_LOG_WARNING, "Starting new cluster due to size\n");
+            rcwt_flush_cluster(avf);
+        }
+
+        cc_valid = (pkt->data[i] & 0x04) >> 2;
+        cc_type = pkt->data[i] & 0x03;
+
+        if (!in_block && !(cc_valid || cc_type == 3))
+            continue;
+
+        memcpy(&rcwt->cluster_buf[rcwt->cluster_pos], &pkt->data[i], 1);
+        rcwt->cluster_pos++;
+
+        if (!in_block) {
+            in_block = 1;
+            nb_block_bytes = 1;
+            continue;
+        }
+
+        nb_block_bytes++;
+
+        if (nb_block_bytes == RCWT_BLOCK_SIZE) {
+            in_block = 0;
+            nb_block_bytes = 0;
+            rcwt->cluster_nb_blocks++;
+        }
+    }
+
+    return 0;
+}
+
+static int rcwt_write_trailer(AVFormatContext *avf)
+{
+    rcwt_flush_cluster(avf);
+
+    return 0;
+}
+
+const FFOutputFormat ff_rcwt_muxer = {
+    .p.name             = "rcwt",
+    .p.long_name        = NULL_IF_CONFIG_SMALL("Raw Captions With Time"),
+    .p.extensions       = "bin",
+    .p.flags            = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
+    .p.subtitle_codec   = AV_CODEC_ID_EIA_608,
+    .priv_data_size     = sizeof(RCWTContext),
+    .write_header       = rcwt_write_header,
+    .write_packet       = rcwt_write_packet,
+    .write_trailer      = rcwt_write_trailer
+};
diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 59595b9cc1..d7edd31e85 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -118,6 +118,9 @@ fate-sub-scc: CMD = fmtstdout ass -ss 57 -i $(TARGET_SAMPLES)/sub/witch.scc
 FATE_SUBTITLES-$(call DEMMUX, SCC, SCC) += fate-sub-scc-remux
 fate-sub-scc-remux: CMD = fmtstdout scc -i $(TARGET_SAMPLES)/sub/witch.scc -ss 4:00 -map 0 -c copy
 
+FATE_SUBTITLES-$(call DEMMUX, SCC, RCWT) += fate-sub-rcwt
+fate-sub-rcwt: CMD = md5 -i $(TARGET_SAMPLES)/sub/witch.scc -map 0 -c copy -f rcwt
+
 FATE_SUBTITLES-$(call ALLYES, MPEGTS_DEMUXER DVBSUB_DECODER DVBSUB_ENCODER) += fate-sub-dvb
 fate-sub-dvb: CMD = framecrc -i $(TARGET_SAMPLES)/sub/dvbsubtest_filter.ts -map s:0 -c dvbsub
 
diff --git a/tests/ref/fate/sub-rcwt b/tests/ref/fate/sub-rcwt
new file mode 100644
index 0000000000..722cbe1c5b
--- /dev/null
+++ b/tests/ref/fate/sub-rcwt
@@ -0,0 +1 @@
+d86f179094a5752d68aa97d82cf887b0
-- 
2.34.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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3] libavformat: add RCWT closed caption muxer
  2024-01-07 15:07       ` [FFmpeg-devel] [PATCH v3] " Marth64
@ 2024-01-07 15:24         ` Stefano Sabatini
  2024-01-14 14:16           ` Stefano Sabatini
  0 siblings, 1 reply; 14+ messages in thread
From: Stefano Sabatini @ 2024-01-07 15:24 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Marth64

On date Sunday 2024-01-07 09:07:01 -0600, Marth64 wrote:
> Thanks, long night. Should come together nicer now.
> 
> Signed-off-by: Marth64 <marth64@proxyid.net>
> ---
>  Changelog                |   1 +
>  doc/muxers.texi          |  22 +++++
>  libavformat/Makefile     |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/rcwtenc.c    | 202 +++++++++++++++++++++++++++++++++++++++
>  tests/fate/subtitles.mak |   3 +
>  tests/ref/fate/sub-rcwt  |   1 +
>  7 files changed, 231 insertions(+)
>  create mode 100644 libavformat/rcwtenc.c
>  create mode 100644 tests/ref/fate/sub-rcwt

LGTM, I'll wait a few days to see if there are more comments before
pushing (if I forget please ping).

Thanks.
_______________________________________________
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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3] libavformat: add RCWT closed caption muxer
  2024-01-07 15:24         ` Stefano Sabatini
@ 2024-01-14 14:16           ` Stefano Sabatini
  2024-01-14 16:57             ` Marth64
  2024-01-15  4:25             ` Xiang, Haihao
  0 siblings, 2 replies; 14+ messages in thread
From: Stefano Sabatini @ 2024-01-14 14:16 UTC (permalink / raw)
  To: FFmpeg development discussions and patches, Marth64

On date Sunday 2024-01-07 16:24:07 +0100, Stefano Sabatini wrote:
> On date Sunday 2024-01-07 09:07:01 -0600, Marth64 wrote:
> > Thanks, long night. Should come together nicer now.
> > 
> > Signed-off-by: Marth64 <marth64@proxyid.net>
> > ---
> >  Changelog                |   1 +
> >  doc/muxers.texi          |  22 +++++
> >  libavformat/Makefile     |   1 +
> >  libavformat/allformats.c |   1 +
> >  libavformat/rcwtenc.c    | 202 +++++++++++++++++++++++++++++++++++++++
> >  tests/fate/subtitles.mak |   3 +
> >  tests/ref/fate/sub-rcwt  |   1 +
> >  7 files changed, 231 insertions(+)
> >  create mode 100644 libavformat/rcwtenc.c
> >  create mode 100644 tests/ref/fate/sub-rcwt
> 

> LGTM, I'll wait a few days to see if there are more comments before
> pushing (if I forget please ping).

Applied, thanks.

(BTW for the future when updating a patch, generate the patch with git
format-patch and attach it to the email, in order to avoid manual
editing on the committer side).
_______________________________________________
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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3] libavformat: add RCWT closed caption muxer
  2024-01-14 14:16           ` Stefano Sabatini
@ 2024-01-14 16:57             ` Marth64
  2024-01-15  4:25             ` Xiang, Haihao
  1 sibling, 0 replies; 14+ messages in thread
From: Marth64 @ 2024-01-14 16:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches, Marth64

Thank you, Stefano. I had thought I did , but next time I will also test
applying the patch too on local : )

On Sun, Jan 14, 2024 at 08:16 Stefano Sabatini <stefasab@gmail.com> wrote:

> On date Sunday 2024-01-07 16:24:07 +0100, Stefano Sabatini wrote:
> > On date Sunday 2024-01-07 09:07:01 -0600, Marth64 wrote:
> > > Thanks, long night. Should come together nicer now.
> > >
> > > Signed-off-by: Marth64 <marth64@proxyid.net>
> > > ---
> > >  Changelog                |   1 +
> > >  doc/muxers.texi          |  22 +++++
> > >  libavformat/Makefile     |   1 +
> > >  libavformat/allformats.c |   1 +
> > >  libavformat/rcwtenc.c    | 202 +++++++++++++++++++++++++++++++++++++++
> > >  tests/fate/subtitles.mak |   3 +
> > >  tests/ref/fate/sub-rcwt  |   1 +
> > >  7 files changed, 231 insertions(+)
> > >  create mode 100644 libavformat/rcwtenc.c
> > >  create mode 100644 tests/ref/fate/sub-rcwt
> >
>
> > LGTM, I'll wait a few days to see if there are more comments before
> > pushing (if I forget please ping).
>
> Applied, thanks.
>
> (BTW for the future when updating a patch, generate the patch with git
> format-patch and attach it to the email, in order to avoid manual
> editing on the committer side).
>
_______________________________________________
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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3] libavformat: add RCWT closed caption muxer
  2024-01-14 14:16           ` Stefano Sabatini
  2024-01-14 16:57             ` Marth64
@ 2024-01-15  4:25             ` Xiang, Haihao
  2024-01-15  4:33               ` Marth64
  2024-01-15  4:38               ` [FFmpeg-devel] [PATCH] rcwtenc: add sub-rcwt fate test ref Marth64
  1 sibling, 2 replies; 14+ messages in thread
From: Xiang, Haihao @ 2024-01-15  4:25 UTC (permalink / raw)
  To: ffmpeg-devel, marth64

On So, 2024-01-14 at 15:16 +0100, Stefano Sabatini wrote:
> On date Sunday 2024-01-07 16:24:07 +0100, Stefano Sabatini wrote:
> > On date Sunday 2024-01-07 09:07:01 -0600, Marth64 wrote:
> > > Thanks, long night. Should come together nicer now.
> > > 
> > > Signed-off-by: Marth64 <marth64@proxyid.net>
> > > ---
> > >  Changelog                |   1 +
> > >  doc/muxers.texi          |  22 +++++
> > >  libavformat/Makefile     |   1 +
> > >  libavformat/allformats.c |   1 +
> > >  libavformat/rcwtenc.c    | 202 +++++++++++++++++++++++++++++++++++++++
> > >  tests/fate/subtitles.mak |   3 +
> > >  tests/ref/fate/sub-rcwt  |   1 +
> > >  7 files changed, 231 insertions(+)
> > >  create mode 100644 libavformat/rcwtenc.c
> > >  create mode 100644 tests/ref/fate/sub-rcwt
> > 
> 
> > LGTM, I'll wait a few days to see if there are more comments before
> > pushing (if I forget please ping).
> 
> Applied, thanks.
> 
> (BTW for the future when updating a patch, generate the patch with git
> format-patch and attach it to the email, in order to avoid manual
> editing on the committer side).

$ make fate-sub-rcwt KEEP=1 V=2
[...]
reference file './tests/ref/fate/sub-rcwt' not found

Thanks
Haihao

_______________________________________________
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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3] libavformat: add RCWT closed caption muxer
  2024-01-15  4:25             ` Xiang, Haihao
@ 2024-01-15  4:33               ` Marth64
  2024-01-15  4:38               ` [FFmpeg-devel] [PATCH] rcwtenc: add sub-rcwt fate test ref Marth64
  1 sibling, 0 replies; 14+ messages in thread
From: Marth64 @ 2024-01-15  4:33 UTC (permalink / raw)
  To: Xiang, Haihao; +Cc: marth64, ffmpeg-devel

 Hello, seems this file didn't make it during merge. Patch coming very
shortly. Thank you,

On Sun, Jan 14, 2024 at 10:25 PM Xiang, Haihao <haihao.xiang@intel.com>
wrote:

> On So, 2024-01-14 at 15:16 +0100, Stefano Sabatini wrote:
> > On date Sunday 2024-01-07 16:24:07 +0100, Stefano Sabatini wrote:
> > > On date Sunday 2024-01-07 09:07:01 -0600, Marth64 wrote:
> > > > Thanks, long night. Should come together nicer now.
> > > >
> > > > Signed-off-by: Marth64 <marth64@proxyid.net>
> > > > ---
> > > >  Changelog                |   1 +
> > > >  doc/muxers.texi          |  22 +++++
> > > >  libavformat/Makefile     |   1 +
> > > >  libavformat/allformats.c |   1 +
> > > >  libavformat/rcwtenc.c    | 202
> +++++++++++++++++++++++++++++++++++++++
> > > >  tests/fate/subtitles.mak |   3 +
> > > >  tests/ref/fate/sub-rcwt  |   1 +
> > > >  7 files changed, 231 insertions(+)
> > > >  create mode 100644 libavformat/rcwtenc.c
> > > >  create mode 100644 tests/ref/fate/sub-rcwt
> > >
> >
> > > LGTM, I'll wait a few days to see if there are more comments before
> > > pushing (if I forget please ping).
> >
> > Applied, thanks.
> >
> > (BTW for the future when updating a patch, generate the patch with git
> > format-patch and attach it to the email, in order to avoid manual
> > editing on the committer side).
>
> $ make fate-sub-rcwt KEEP=1 V=2
> [...]
> reference file './tests/ref/fate/sub-rcwt' not found
>
> Thanks
> Haihao
>
>
_______________________________________________
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] 14+ messages in thread

* [FFmpeg-devel] [PATCH] rcwtenc: add sub-rcwt fate test ref
  2024-01-15  4:25             ` Xiang, Haihao
  2024-01-15  4:33               ` Marth64
@ 2024-01-15  4:38               ` Marth64
  2024-01-15  5:06                 ` Xiang, Haihao
  1 sibling, 1 reply; 14+ messages in thread
From: Marth64 @ 2024-01-15  4:38 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marth64

Resolves the issue. Patch generated with git format-patch and validated to apply.
I reget any inconvenience this may have caused. Respectfully,

Signed-off-by: Marth64 <marth64@proxyid.net>
---
 tests/ref/fate/sub-rcwt | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 tests/ref/fate/sub-rcwt

diff --git a/tests/ref/fate/sub-rcwt b/tests/ref/fate/sub-rcwt
new file mode 100644
index 0000000000..722cbe1c5b
--- /dev/null
+++ b/tests/ref/fate/sub-rcwt
@@ -0,0 +1 @@
+d86f179094a5752d68aa97d82cf887b0
-- 
2.34.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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH] rcwtenc: add sub-rcwt fate test ref
  2024-01-15  4:38               ` [FFmpeg-devel] [PATCH] rcwtenc: add sub-rcwt fate test ref Marth64
@ 2024-01-15  5:06                 ` Xiang, Haihao
  2024-01-15  5:20                   ` Marth64
  0 siblings, 1 reply; 14+ messages in thread
From: Xiang, Haihao @ 2024-01-15  5:06 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: marth64

On So, 2024-01-14 at 22:38 -0600, Marth64 wrote:
> Resolves the issue. Patch generated with git format-patch and validated to
> apply.
> I reget any inconvenience this may have caused. Respectfully,
> 
> Signed-off-by: Marth64 <marth64@proxyid.net>
> ---
>  tests/ref/fate/sub-rcwt | 1 +
>  1 file changed, 1 insertion(+)
>  create mode 100644 tests/ref/fate/sub-rcwt
> 
> diff --git a/tests/ref/fate/sub-rcwt b/tests/ref/fate/sub-rcwt
> new file mode 100644
> index 0000000000..722cbe1c5b
> --- /dev/null
> +++ b/tests/ref/fate/sub-rcwt
> @@ -0,0 +1 @@
> +d86f179094a5752d68aa97d82cf887b0

Thanks for your quick fix, it works well for me.

BRs
Haihao

_______________________________________________
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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH] rcwtenc: add sub-rcwt fate test ref
  2024-01-15  5:06                 ` Xiang, Haihao
@ 2024-01-15  5:20                   ` Marth64
  2024-01-15 23:55                     ` Marth64
  0 siblings, 1 reply; 14+ messages in thread
From: Marth64 @ 2024-01-15  5:20 UTC (permalink / raw)
  To: Xiang, Haihao; +Cc: marth64, ffmpeg-devel

Great, thank you for the confirmation.

On Sun, Jan 14, 2024 at 11:06 PM Xiang, Haihao <haihao.xiang@intel.com>
wrote:

> On So, 2024-01-14 at 22:38 -0600, Marth64 wrote:
> > Resolves the issue. Patch generated with git format-patch and validated
> to
> > apply.
> > I reget any inconvenience this may have caused. Respectfully,
> >
> > Signed-off-by: Marth64 <marth64@proxyid.net>
> > ---
> >  tests/ref/fate/sub-rcwt | 1 +
> >  1 file changed, 1 insertion(+)
> >  create mode 100644 tests/ref/fate/sub-rcwt
> >
> > diff --git a/tests/ref/fate/sub-rcwt b/tests/ref/fate/sub-rcwt
> > new file mode 100644
> > index 0000000000..722cbe1c5b
> > --- /dev/null
> > +++ b/tests/ref/fate/sub-rcwt
> > @@ -0,0 +1 @@
> > +d86f179094a5752d68aa97d82cf887b0
>
> Thanks for your quick fix, it works well for me.
>
> BRs
> Haihao
>
>
_______________________________________________
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] 14+ messages in thread

* Re: [FFmpeg-devel] [PATCH] rcwtenc: add sub-rcwt fate test ref
  2024-01-15  5:20                   ` Marth64
@ 2024-01-15 23:55                     ` Marth64
  0 siblings, 0 replies; 14+ messages in thread
From: Marth64 @ 2024-01-15 23:55 UTC (permalink / raw)
  To: Marth64; +Cc: Xiang, Haihao, ffmpeg-devel

Looks like someone has pushed a simplified version of this patch, this is
not needed anymore. Thanks.

On Sun, Jan 14, 2024 at 11:20 PM Marth64 <marth64@proxyid.net> wrote:

> Great, thank you for the confirmation.
>
> On Sun, Jan 14, 2024 at 11:06 PM Xiang, Haihao <haihao.xiang@intel.com>
> wrote:
>
>> On So, 2024-01-14 at 22:38 -0600, Marth64 wrote:
>> > Resolves the issue. Patch generated with git format-patch and validated
>> to
>> > apply.
>> > I reget any inconvenience this may have caused. Respectfully,
>> >
>> > Signed-off-by: Marth64 <marth64@proxyid.net>
>> > ---
>> >  tests/ref/fate/sub-rcwt | 1 +
>> >  1 file changed, 1 insertion(+)
>> >  create mode 100644 tests/ref/fate/sub-rcwt
>> >
>> > diff --git a/tests/ref/fate/sub-rcwt b/tests/ref/fate/sub-rcwt
>> > new file mode 100644
>> > index 0000000000..722cbe1c5b
>> > --- /dev/null
>> > +++ b/tests/ref/fate/sub-rcwt
>> > @@ -0,0 +1 @@
>> > +d86f179094a5752d68aa97d82cf887b0
>>
>> Thanks for your quick fix, it works well for me.
>>
>> BRs
>> Haihao
>>
>>
_______________________________________________
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] 14+ messages in thread

end of thread, other threads:[~2024-01-15 23:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-06  2:14 [FFmpeg-devel] [PATCH] libavformat: add RCWT closed caption muxer Marth64
2024-01-06 12:33 ` Stefano Sabatini
2024-01-06 21:41   ` [FFmpeg-devel] [PATCH v2] " Marth64
2024-01-07 12:02     ` Stefano Sabatini
2024-01-07 15:07       ` [FFmpeg-devel] [PATCH v3] " Marth64
2024-01-07 15:24         ` Stefano Sabatini
2024-01-14 14:16           ` Stefano Sabatini
2024-01-14 16:57             ` Marth64
2024-01-15  4:25             ` Xiang, Haihao
2024-01-15  4:33               ` Marth64
2024-01-15  4:38               ` [FFmpeg-devel] [PATCH] rcwtenc: add sub-rcwt fate test ref Marth64
2024-01-15  5:06                 ` Xiang, Haihao
2024-01-15  5:20                   ` Marth64
2024-01-15 23:55                     ` Marth64

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