From patchwork Thu Mar 21 03:52:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47280 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a4a:b0:1a3:31a3:7958 with SMTP id zu10csp308764pzb; Wed, 20 Mar 2024 20:52:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUzgj3KZX914GiAyQMItY5+Yva+0DN7yj+vxI9zXroWPgAUgCaQBeV32Po2LgpDyzE71Ytpi5UQ6ogiCvJzZVsF73+RYNkOKzPiOQ== X-Google-Smtp-Source: AGHT+IGBb/8V7+rc1RaKz5Cb0r27CfzwnCxscHgHdxUS8+bMT6aM5iPGlcueN0lgg2YWvdl0g1dh X-Received: by 2002:a17:906:c352:b0:a44:4c9e:8809 with SMTP id ci18-20020a170906c35200b00a444c9e8809mr442704ejb.32.1710993151611; Wed, 20 Mar 2024 20:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710993151; cv=none; d=google.com; s=arc-20160816; b=NWKjA6phVyFP4HzO2ePB7Bw38CTxH5EroG4rOEXOfxL/YinpRhDrscQ/PR3IVdoyD3 UzI1oKi3/dVE68aDJqtUHvozOLqtdX754+OBlJTVXVKuK50eaQYRvKrmuvhvE5f4dWlg HUA9pqR97GfZ7J1uWlL803yDXVtn1V6Yo7H+lQKqJ4MbErpOh2mdGTTkKf/xjMGxod0M anahVDeiuCvp8IqHx2A0PHKVXZgKkg/Ctmm0C72KXR2GMLzndloTCv5nfR6EmkzRj09t X/wzrtmOh1I2I47n2v5W3B6m54iahF6fpe/mouUI/pxAz+wx6CMDGUhFGSjDtzCUthhX r8kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=JiLeTry4RnaLF7HqZYt1rULb9D6zG/Rb8amm0X3gC+Q=; fh=PlWMzmI9LD2qGS7ipLrQl8z0iaQTLQLHzoGuXcBzpCg=; b=o8yWtBUtkOwEe+yTJ22DrKqstc6erZEkjSxaJEo6ruS3ihI2ZNqaAueW3cla7aQSpn 16RwTACBka/bgMksZLT+Vk/yoXrm6449Dg8hIkqjAnJo/0TZS1HkY55CgUxsp1cyZgad I/ZV0ymOaQfc3APZWfeq5dMwRlO5LRi7DPY/qGbqdcq7slTUZsQebX+PBDINA8hDGzlG hNKLr6I9lNrEivYEaHSRmXNwAEoOTvsOGe7Q+eJAUZDo/snrVKSolJS3tq69QRJ0eH6F FkiBXWh1J8f5ckeGS0mcZCDZ1umLGjZbuC3YNTnHuVsjlvf9CFKPxRgnuTQ2Vu3NY7Wr QbZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b="SQba/0Ff"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g11-20020a170906348b00b00a440cbc0b95si7140547ejb.307.2024.03.20.20.52.31; Wed, 20 Mar 2024 20:52:31 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b="SQba/0Ff"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9E90968D50C; Thu, 21 Mar 2024 05:52:21 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ua1-f98.google.com (mail-ua1-f98.google.com [209.85.222.98]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CEB0168D4BD for ; Thu, 21 Mar 2024 05:52:13 +0200 (EET) Received: by mail-ua1-f98.google.com with SMTP id a1e0cc1a2514c-7e09e1871fdso226416241.0 for ; Wed, 20 Mar 2024 20:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1710993132; x=1711597932; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C7ddoKYHF75u8902kbMzlTKnC0vB8Euy1Yn0XRjjHJ8=; b=SQba/0FfefpWJzss8YGBbE6mFSTexje7gzuRTdsQyEb0Dhw5Rq2nlAfH5AuztEsYj4 Lr6Ob7R9s0fudsznlEbAKS01+qxMAMRlzWDSHIvg4Z5qKDKFTmCndXnfpXTbs7ct6DV0 EzAHLKBViKq12WwjPgcf/uOe25uVIpC2HEp8AYCkLLK5eiVKfxPj5IWLDyz922iho+wG Jp0GnyBzNd9GnZOaIMG1WVedTp6Qv1VI4FAA8K0ojWblzdX2r+Uqgkm/1L8EtgEXdbVT /h7eyojhMsvAILjC7eK4GlL3huy4ogKryd6rQA74Cn74QFF1IFMdk3FznvPJwQ14A7Ew aIdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710993132; x=1711597932; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C7ddoKYHF75u8902kbMzlTKnC0vB8Euy1Yn0XRjjHJ8=; b=mQreH6s1hAoJocKzF7thXsJlttUkY618kbrZGAhgaGXbgbKLnipU/Lp+IRVdVqvu0i sKlc+uhDEIKWGANDRzrGQGJJYG2HMZoRpRxt4MQE7rDHUzWmW52juUwkMOJym8Q9+Mh6 4EjX2Iw5/EtCixew3XmWHXReGwjW6BAFx1BjiaFGwfq/fztAMTIqVw9uXbIiRMdKbkQP YLU0Z/bJ+kJqB/CdeU0RJDvJmI5FyvEkhryE15X3q3w7X8lK7vviMEjVItBeAHPzE7gw e6J+5ggvqZrE4ZO4AJkR+uTkmpsbEjEq9XSilOGPtmzsvQWQPdha+w0IfSjmhZ3VWJto DVcw== X-Gm-Message-State: AOJu0YzyrazZHZfpp9c0aSahmm25uHDBBc8MSsjju+aXcNocSjEEDIAB fSoNwuh4dm4MKaTbPM7q1S1DvymUKSVa8DmGc3enMpZifTAs8PCMmObgX8KvP1gfARqZQID5gKJ IUwqDCOPNIak42e8nw7izpcR4JIM9/z2gu1kmxMbN X-Received: by 2002:a1f:f28a:0:b0:4d4:3fa5:e19e with SMTP id q132-20020a1ff28a000000b004d43fa5e19emr742271vkh.2.1710993132398; Wed, 20 Mar 2024 20:52:12 -0700 (PDT) Received: from wsx-cc1-001.. (c-76-141-249-38.hsd1.il.comcast.net. [76.141.249.38]) by smtp-relay.gmail.com with ESMTPS id x125-20020a1f7c83000000b004d14fb3e0b7sm1204250vkc.14.2024.03.20.20.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 20:52:12 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Mar 2024 22:52:03 -0500 Message-Id: <20240321035207.3849560-2-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321035207.3849560-1-marth64@proxyid.net> References: <20240321035207.3849560-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support empty events X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marth64 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: C2RzofJec8OC If ff_subtitles_queue_insert() were to given a NULL buffer with 0 length, it would still attempt to grow the packet or memcpy depending on if merge option is enabled. In this commit, consider a NULL buffer with 0 length as an empty event and do not attempt to modify the packet. This way, if a subtitle demuxer happens to pass an empty cue or wants to use av_get_packet() to read bytes, there are no unnecessary operations on the packet after it is allocated. Signed-off-by: Marth64 --- libavformat/subtitles.c | 4 ++++ libavformat/subtitles.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index 3413763c7b..38d2ffb8a9 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -117,6 +117,8 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, int old_len; sub = q->subs[q->nb_subs - 1]; old_len = sub->size; + if (event == NULL && len == 0) + return sub; if (av_grow_packet(sub, len) < 0) return NULL; memcpy(sub->data + old_len, event, len); @@ -140,6 +142,8 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, subs[q->nb_subs++] = sub; sub->flags |= AV_PKT_FLAG_KEY; sub->pts = sub->dts = 0; + if (event == NULL && len == 0) + return sub; memcpy(sub->data, event, len); } return sub; diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h index 88665663c5..ba162fa503 100644 --- a/libavformat/subtitles.h +++ b/libavformat/subtitles.h @@ -112,7 +112,7 @@ typedef struct { /** * Insert a new subtitle event. * - * @param event the subtitle line, may not be zero terminated + * @param event the subtitle line (not zero terminated), or NULL on empty event * @param len the length of the event (in strlen() sense, so without '\0') * @param merge set to 1 if the current event should be concatenated with the * previous one instead of adding a new entry, 0 otherwise From patchwork Thu Mar 21 03:52:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47281 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a4a:b0:1a3:31a3:7958 with SMTP id zu10csp308816pzb; Wed, 20 Mar 2024 20:52:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXsKR5cEu+H92wHA9n1LgT5Uqg9AAzrmd5349Rildx3eS0PXK/us38M1H5bqOpS4u1TjXhb7qUPSadce3CEGhFfaBnO4I0HE+MwVQ== X-Google-Smtp-Source: AGHT+IFdmOeKo1ELzDLiCBP1BJxG3qm1cQ7d83vUEGkg+qy+E7TTYBrHiXggKFyDrnfrO0c0b6Dl X-Received: by 2002:a05:6402:2cf:b0:56b:b0f9:b7fa with SMTP id b15-20020a05640202cf00b0056bb0f9b7famr2154699edx.2.1710993160383; Wed, 20 Mar 2024 20:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710993160; cv=none; d=google.com; s=arc-20160816; b=wyXE+N/7SSRXCnqVHQZT1KY2kiVzhcSoDk4tHPCZKQ+t/a1Igdvp3JcQc2zE/qMBv2 d7dZmkcQfHPs3mEzkMlkn2czzUAYyKdNHXf5DRZy58hwleHaFHDRcCnp453e58wt0oRA PGWFkvf2ZgqvqgYfxmbjEzcXqlAEHncXM4cbYueJcXcr1mn0cnbGfCRnYz4xH6AlkN7v CUPZmIKRoZlUkjyCnXgUTq6nzf39o+JCFPncDamCCKfbaS4I7UIierITMM17WE5iZTP5 as5r5vTqVx+bzd8EXMGFe2oM+vaZcA+dVTb2xOYf5xcLk2J6fVcjkxKgZqLtwnwDW2XC 39lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=winQWesHgFMQZr5t6MLYmfNn6u7smtoouNOXdT9oVAQ=; fh=PlWMzmI9LD2qGS7ipLrQl8z0iaQTLQLHzoGuXcBzpCg=; b=oyOxTEO7y2erc80EEOcFmhGMzzaMmMflHX9vjdf1HX9fjLSnRgKsjSDvV2bV31OzUL UqSnQKnWxsz4Ki7EykiF9URqSr/clssxKW+vRYgFxJRdNiJdMVsFJdjdWEoUz7stdUoJ gqGADfgElX0xFtmtA1ii6S7AeQx/VdwAQYkJoK4yICDWeNxHOOfyaENPbVjftZ7T6rdr TtqHZGlFOpXm2QTmWfNJOxEywa/nvjS7etr3hQ5bAtGSD0f2+63g16eyK86lZJPmhxK6 X3EqL3D17T0GUgvlRMEC6NAh+tcynLS2c3edQ/HGxV6d3LndCQe2ESNrIXtW+d9Y7vxv mJOQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=U3ZXJSBk; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n2-20020a056402434200b0056b902e4b61si2672071edc.294.2024.03.20.20.52.39; Wed, 20 Mar 2024 20:52:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=U3ZXJSBk; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A8FF968D541; Thu, 21 Mar 2024 05:52:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vk1-f226.google.com (mail-vk1-f226.google.com [209.85.221.226]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 65AE168D517 for ; Thu, 21 Mar 2024 05:52:14 +0200 (EET) Received: by mail-vk1-f226.google.com with SMTP id 71dfb90a1353d-4d458be7fb6so206926e0c.3 for ; Wed, 20 Mar 2024 20:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1710993133; x=1711597933; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SBHkTEVbdeuTSOZ1W+aT1M/JuHDCqdCC9undv/rjwJ8=; b=U3ZXJSBkhgDWK8ocH4nAvaPssjeLSfnlPUYONdFSxzzH7hbD506lLCCF0pvI7nwj59 IRNOKZynBSTH8+3HT0wJCV4N8kUa1KEzgvzPp0WRp0WG8HZAtD8h21JoVL0CJOcCF+0Q 5FdeKLLM+lzLUIZYkGkjOA2Q7d/Eow9thZrfXabSbKZjk7dg8h/d79ZTM4mcJQtvZPJ3 uECxAwlDS28/Sxyn72xYoOVIzht4Ei0qMgRStmX2oKJDX3pNGFZ2vlGiXeox5E2uKexi rgnYdvA1Jk4bctODtG+PIq5DJvczA26d5/Thb4SPdVVVNJqyikKbtU7VI/x5n8fub2J6 fS6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710993133; x=1711597933; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SBHkTEVbdeuTSOZ1W+aT1M/JuHDCqdCC9undv/rjwJ8=; b=DMe5tjafEybtG4M49mjVaDKtStCZZ9qb/3EGT0b2lzqKQi0cZOo025YhFxVxOOiXLa Zt20NcoLXuFj8F/k6q3a/29B2otDISPoROToq2V1wqEH/axHgCSf70oqyim93oh3TW94 ON8OqiBWQZ2jqIgNUdCRB188LsjHMRAomMeFj+FqXLZip7TNxFD8/B0vU/BdTIWEJ0ui o+82Bdgough4hbeQzP8pCGtotHyPWBrb8++afQ9Dj8NOuPvJR8mgMwIho0MayBOI8yGZ FTfpSg676j7SiHidP8Vm5PPf8VDD2rbJLrPl/nNpesuOClfhyPzeV9y1OQMdFaFo5tcV Qvnw== X-Gm-Message-State: AOJu0YwiGpNfa5i+t8HXQIWYqQl8ryUx6kj+NyRQfu/JHX6cXLCGkBge HTKlV9+d4R6fKbnM6VjHWTnL1b4sLQJkNN/15qWOw+OoGUTr23TdmolgxowYSSU+Ihocs87zyns +kX2MsxelBYsBP901HTPtxPhHD1w2whkCaIurDFsU X-Received: by 2002:a05:6122:420f:b0:4c9:d0ee:bd67 with SMTP id cm15-20020a056122420f00b004c9d0eebd67mr4175047vkb.5.1710993132849; Wed, 20 Mar 2024 20:52:12 -0700 (PDT) Received: from wsx-cc1-001.. (c-76-141-249-38.hsd1.il.comcast.net. [76.141.249.38]) by smtp-relay.gmail.com with ESMTPS id x125-20020a1f7c83000000b004d14fb3e0b7sm1204250vkc.14.2024.03.20.20.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 20:52:12 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Mar 2024 22:52:04 -0500 Message-Id: <20240321035207.3849560-3-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321035207.3849560-1-marth64@proxyid.net> References: <20240321035207.3849560-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 2/5] avformat/rcwtdec: add RCWT Closed Captions demuxer X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marth64 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: D/Ynwo2eXpKK RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly used OSS tool for processing 608/708 Closed Captions (CC). RCWT can be used to archive the original extracted CC bitstream. The muxer was added in January 2024. In this commit, add the demuxer. One can now demux RCWT files for rendering in ccaption_dec or interop with ccextractor (which produces RCWT). Using the muxer/demuxer combo, the CC bits can be kept for processing or rendering with either tool. This can be an effective way to backup an original CC stream, including format extensions like EIA-708 and overall original presentation. Signed-off-by: Marth64 --- Changelog | 2 +- doc/demuxers.texi | 30 ++++++++++ libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/rcwtdec.c | 123 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 libavformat/rcwtdec.c diff --git a/Changelog b/Changelog index e3ca52430c..0ae05c6cce 100644 --- a/Changelog +++ b/Changelog @@ -19,7 +19,7 @@ version : - lavu/eval: introduce randomi() function in expressions - VVC decoder - fsync filter -- Raw Captions with Time (RCWT) closed caption muxer +- RCWT (Raw Captions with Time) Closed Captions muxer and demuxer - ffmpeg CLI -bsf option may now be used for input as well as output - ffmpeg CLI options may now be used as -/opt , which is equivalent to -opt > diff --git a/doc/demuxers.texi b/doc/demuxers.texi index b70f3a38d7..b4c4daacd9 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -1038,6 +1038,36 @@ the command: ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw @end example +@anchor{rcwtdec} +@section rcwt + +RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly +used open source tool for processing 608/708 Closed Captions (CC) sources. +For more information on the format, see @ref{rcwtenc,,,ffmpeg-formats}. + +This demuxer implements the specification as of March 2024, which has +been stable and unchanged since April 2014. + +@subsection Examples + +@itemize +@item +Render Closed Captions to ASS, using the CC decoder (cc_dec): +@example +ffmpeg -i CC.rcwt.bin CC.ass +@end example +Note that if your output appears to be empty, you may have to manually +set the decoder's @option{data_field} option to pick the desired CC substream. + +@item +Convert an RCWT backup to SCC format, using the SCC muxer (scc): +@example +ffmpeg -i CC.rcwt.bin -c:s copy CC.scc +@end example +Note that the SCC format does not support all of the possible CC formats +that can be stored in RCWT. +@end itemize + @section sbg SBaGen script demuxer. diff --git a/libavformat/Makefile b/libavformat/Makefile index 94a949f555..a6de720d8c 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -493,6 +493,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_DEMUXER) += rcwtdec.o subtitles.o OBJS-$(CONFIG_RCWT_MUXER) += rcwtenc.o subtitles.o OBJS-$(CONFIG_REALTEXT_DEMUXER) += realtextdec.o subtitles.o OBJS-$(CONFIG_REDSPARK_DEMUXER) += redspark.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index e15d0fa6d7..3140018f8d 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -391,6 +391,7 @@ extern const FFInputFormat ff_qoa_demuxer; extern const FFInputFormat ff_r3d_demuxer; extern const FFInputFormat ff_rawvideo_demuxer; extern const FFOutputFormat ff_rawvideo_muxer; +extern const FFInputFormat ff_rcwt_demuxer; extern const FFOutputFormat ff_rcwt_muxer; extern const FFInputFormat ff_realtext_demuxer; extern const FFInputFormat ff_redspark_demuxer; diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c new file mode 100644 index 0000000000..e5cd05ea3e --- /dev/null +++ b/libavformat/rcwtdec.c @@ -0,0 +1,123 @@ +/* + * RCWT (Raw Captions With Time) demuxer + * + * 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 + */ + +/* + * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly + * used open source tool for processing 608/708 Closed Captions (CC) sources. + * + * This demuxer implements the specification as of March 2024, which has + * been stable and unchanged since April 2014. + * + * 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 "demux.h" +#include "internal.h" +#include "subtitles.h" +#include "libavutil/intreadwrite.h" + +#define RCWT_HEADER_SIZE 11 + +typedef struct RCWTContext { + FFDemuxSubtitlesQueue q; +} RCWTContext; + +static int rcwt_read_header(AVFormatContext *avf) +{ + RCWTContext *rcwt = avf->priv_data; + + AVStream *st; + uint8_t header[RCWT_HEADER_SIZE]; + int nb_bytes; + + /* read header */ + nb_bytes = ffio_read_size(avf->pb, header, RCWT_HEADER_SIZE); + if (nb_bytes != RCWT_HEADER_SIZE) + return AVERROR_INVALIDDATA; + + if (AV_RB16(header + 6) != 0x0001) { + av_log(avf, AV_LOG_ERROR, "RCWT format version is not compatible " + "(only version 0.001 is known)\n"); + return AVERROR_INVALIDDATA; + } + + av_log(avf, AV_LOG_DEBUG, "RCWT writer application: %02X version: %02x\n", + header[3], header[5]); + + /* setup stream */ + st = avformat_new_stream(avf, NULL); + if (!st) + return AVERROR(ENOMEM); + + st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; + st->codecpar->codec_id = AV_CODEC_ID_EIA_608; + + avpriv_set_pts_info(st, 64, 1, 1000); + + /* demux */ + while (!avio_feof(avf->pb)) { + AVPacket *sub; + int ret; + int64_t cluster_pos = avio_tell(avf->pb); + int64_t cluster_pts = avio_rl64(avf->pb); + int cluster_nb_blocks = avio_rl16(avf->pb); + + if (cluster_nb_blocks == 0) + continue; + + sub = ff_subtitles_queue_insert(&rcwt->q, NULL, 0, 0); + if (!sub) + return AVERROR(ENOMEM); + + if ((ret = av_get_packet(avf->pb, sub, cluster_nb_blocks * 3)) < 0) + return ret; + + sub->pos = cluster_pos; + sub->pts = cluster_pts; + } + + ff_subtitles_queue_finalize(avf, &rcwt->q); + + return 0; +} + +static int rcwt_probe(const AVProbeData *p) +{ + return p->buf_size > RCWT_HEADER_SIZE && + AV_RB16(p->buf) == 0xCCCC && + AV_RB8(p->buf + 2) == 0xED && + AV_RB16(p->buf + 6) == 0x0001 ? 50 : 0; +} + +const FFInputFormat ff_rcwt_demuxer = { + .p.name = "rcwt", + .p.long_name = NULL_IF_CONFIG_SMALL("RCWT (Raw Captions With Time)"), + .p.extensions = "bin", + .p.flags = AVFMT_TS_DISCONT, + .priv_data_size = sizeof(RCWTContext), + .flags_internal = FF_FMT_INIT_CLEANUP, + .read_probe = rcwt_probe, + .read_header = rcwt_read_header, + .read_packet = ff_subtitles_read_packet, + .read_seek2 = ff_subtitles_read_seek, + .read_close = ff_subtitles_read_close +}; From patchwork Thu Mar 21 03:52:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47279 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a4a:b0:1a3:31a3:7958 with SMTP id zu10csp308853pzb; Wed, 20 Mar 2024 20:52:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXR+mnlqxyiLbmVRiUPi170Jbjz7oCmdp8r4j3/UxVGEFX79eTPWJ9ZjPGoEF+g5SG1quj04SlV+ioCI8NqOmI3kMkSeShSmZgyow== X-Google-Smtp-Source: AGHT+IFegM21a7SuKggq19CZFMVoXLbtQTgwTSdaF0sw4KNbdHiJeLk2sQ8yIdcOb19+Ws2Nw7SX X-Received: by 2002:a17:907:7643:b0:a46:2100:da56 with SMTP id kj3-20020a170907764300b00a462100da56mr2648320ejc.55.1710993169575; Wed, 20 Mar 2024 20:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710993169; cv=none; d=google.com; s=arc-20160816; b=j7Ep428SwLh935qHgCXWW7kCy+n0k1qMwhjh2aW5TDgs+psjd3+t8HSmrT6b8dHWyN VnwBvrrHrdD2F396yp/b3NAoQ2hMW7evDQ5pdzrK9hQQn52b4KOKTHQVr4uBsvTdQ8tg BL9CogRmAzbsW2ayeUa+4JJrRWQs2QbrFqJk+1HJFy1NVRuLv0NRBNA52qnT/RWAmn30 o+sDZDaKrbfzWIAdzMssI+BXUs2bUZuXCPsq4ZWLMvTWSmbqg3NOTkdzSHPN8MLFAKMe gYvYSHMgO+ywy8yqW5bbWAQj+8/gxFAblJI/NFpYI8Jy2Rrq5fAFg2OU1OKv+CHZbaSK FvYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=SbUGyQcq5wlvJSAG19p05qhL6RigLdzKbxNe4SWr4Rw=; fh=PlWMzmI9LD2qGS7ipLrQl8z0iaQTLQLHzoGuXcBzpCg=; b=xX3Ump/OfmhQOWgccP9t3lh8k3PaLITkaemXDZMhIImgHn/by6SAJBcGO6UZztxJnC V1dm0ubkm8ZOi7uFmd4c6EsWCoxn8l/x/99WGE21vuxZ3eid3tx5qJzZl702ifnM1N4C vuraC/VNkfr9DkwjsT/ULu3OnF9dOHA3ZVFVKMnCqNg0ZCbmjXtoqEbxGsl0qxbLrVD4 9+o+aAaGkoGB/KRgte65R7ykSlAnlD3x1yiKWVH3QfYo3t/NlRfgu/DxHRPE4+QtNght 2TP5iC4bmGxxANoYjOjLU/hvOphcCYem2lSv0eGgNlsszTFESr2RsK+tugqA1cMeSmno c8Ng==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=C+wia4Gd; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j16-20020a17090643d000b00a4307efaeebsi3095037ejn.343.2024.03.20.20.52.49; Wed, 20 Mar 2024 20:52:49 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=C+wia4Gd; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9643068D546; Thu, 21 Mar 2024 05:52:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vk1-f225.google.com (mail-vk1-f225.google.com [209.85.221.225]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9001568D517 for ; Thu, 21 Mar 2024 05:52:14 +0200 (EET) Received: by mail-vk1-f225.google.com with SMTP id 71dfb90a1353d-4d43a1f0188so196276e0c.2 for ; Wed, 20 Mar 2024 20:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1710993133; x=1711597933; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ik0FcCnvFFRtw9RR8I7LtWYXAFcCNn8Sa/fS8uaxNlg=; b=C+wia4GdcXZqfrDaFy7SxY5wC/xcXImtsaTSDponCzQp3sXGpugtWMw4PAkkLnWEyQ 2AWiMUP0MHFMCGkolvQAxCYcb6oI9b8xfCTfdpBrU9oPNsBRNO8vJ2lhW0kEFYW2SbKv v2Wl27c3neSBPQ/+KUnuLG4YmVKnarq8Bf3lRIId6JaSL+c2cCDGzKb9oiT5rKxJ5Z1C HaNjFshc9wMsA679mJfCgjVpl6CaMCi2+rStD/2leMaWIS1s+m0203uw06TjjYP4D3Vb KcFwg/dmOmIXApjf73133dqRP8tVCEt7CAsOEvNghAjK/VQGic5KvW1oQoLx2i7uREQL lnWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710993133; x=1711597933; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ik0FcCnvFFRtw9RR8I7LtWYXAFcCNn8Sa/fS8uaxNlg=; b=l392gvRpMwt1vAcQD5K6W88OVenYHX1uz96GYxHwpdBpyyW04smQpkPoVrNRG7brqk 2DdUYa7CnOOBXBro0WYWXGZVWYXYG5+CUhE9nRkaH9sfE9zILeSDQFOGkNOLDB7IF1SL R5S4t6ffnBDK+wkAcerto0IsQAOS5GvnxeBwhvzOu2qH8GYDwwiPJeir9nrEOJBWT8cX tRAmqHcuY+Hne8fSPQwwH7r7+Qi3ofSfckVDCouF2MZCNZ55C79H3ulySp3CCJzRYML7 x6lh6RbW4xAMUqGl1dcqWQw8160Lq9TfUqj8CX/XKLrmHnFt8kfSqYJwn3YzHJ/x1ZSH 9ORQ== X-Gm-Message-State: AOJu0Yy0zzv7o0KzzXNXZPcL4a5ZGKz6EXXt33rrTTjhxOUobRjpHE5H ayPMr3VeWv6e8hUonl2KYs57p/lp44XEIJ5j9Yg8C4Tq4fAYU2syUFAlsMW5bcpanH7ZP2fYvku BZ98an1bnEEI0jUVqkKdg1N9Oz03+TRCSEyV2oXWw X-Received: by 2002:a05:6122:2107:b0:4d3:45a2:ae4f with SMTP id k7-20020a056122210700b004d345a2ae4fmr763438vkd.14.1710993133279; Wed, 20 Mar 2024 20:52:13 -0700 (PDT) Received: from wsx-cc1-001.. (c-76-141-249-38.hsd1.il.comcast.net. [76.141.249.38]) by smtp-relay.gmail.com with ESMTPS id x125-20020a1f7c83000000b004d14fb3e0b7sm1204250vkc.14.2024.03.20.20.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 20:52:13 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Mar 2024 22:52:05 -0500 Message-Id: <20240321035207.3849560-4-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321035207.3849560-1-marth64@proxyid.net> References: <20240321035207.3849560-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 3/5] avformat/rcwtenc: remove repeated documentation X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marth64 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: mn2FP+l7wDgH The high level summary of RCWT can be delegated doc/muxers, which makes it easier to maintain and more consistent with the documentation of the demuxer. Signed-off-by: Marth64 --- libavformat/rcwtenc.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c index ed72de81ef..a1a8c06533 100644 --- a/libavformat/rcwtenc.c +++ b/libavformat/rcwtenc.c @@ -21,11 +21,6 @@ /* * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly * used open source tool for processing 608/708 Closed Captions (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 March 2024, which has * been stable and unchanged since April 2014. From patchwork Thu Mar 21 03:52:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47282 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a4a:b0:1a3:31a3:7958 with SMTP id zu10csp308889pzb; Wed, 20 Mar 2024 20:52:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXOfdmR6GdxzNGlXKLmRMSQxfoysKbM6B3zeyd/WhJQJQPYQ1jLP0EhZWPBvmzNWfpKgnvG0J2yt5/U7gmEgFQ5Fx6VJdw2m0Wp7Q== X-Google-Smtp-Source: AGHT+IG8JCoYJ1GJqJCmiWA/Y9dLD84gnnysylgoFU77fZZ29w0dl8AVfsy7X82vCj5B9UHQnhtu X-Received: by 2002:a19:e009:0:b0:513:226c:651d with SMTP id x9-20020a19e009000000b00513226c651dmr700826lfg.2.1710993178272; Wed, 20 Mar 2024 20:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710993178; cv=none; d=google.com; s=arc-20160816; b=Nk+60msklkxHii29UxsP8PN7g5sfrIWa0X9V7/FOFKGHcimUeXhbJmJzDWn7LsQr/E Jqh49pRjWTDZXHj2mtX2UrkYlpK42rqoVWEHnuHDQAKa6/KX06PAcQvtka3Knym0b/XP 3pJ6M74kpU+Orio0bj+D2mFoDZTqcPXMcjXgDE7aAbd9lJ27V1A2U6PGNVBIxuuLVj9o ECM3F1fZIicXPfXeWA31ZEQtO628fwa81wTcsrGraF5sXbYuQHG9yyyYahoP6aMaJhTg EuzgjEApBQ27VhxjPdRwKRjVeARWysl7YnN1G7K96DQG96mJlfMuzhRRTTQuhky4eQzk BnUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=L9oMqP1thx/inHg4lvGGJJSXRj9yCjPVaF3D805MOjY=; fh=PlWMzmI9LD2qGS7ipLrQl8z0iaQTLQLHzoGuXcBzpCg=; b=n5CXRoOLT+ZlAFB4+HR6StXtSX6/NRRZ9MiNXQyg7Dzrn1BRmfEzidfpz5i6pYZ57H SJr1YYvj6ki2svqYmtyjT/3zHGQ/dzzBvpBDcsxr9tAzSaGcGNWbn/MkWmRWw1gmNuvH Gl2I4eWlqEQLbWBzOY742l9g+vxhtcZjL7e+2MMVCVSjDoSITlU22PoFcjb18LywNih2 6FVd/W3St6zktzifLDgQU3LQGc8k53MfurVDvKXA3rnN6yyqvJy52Yq+y9R62Lo95pWr tGPb/bwAt//6x4fsejBJcP/8zCj7nWl58C7YEcerSmkDd8cjfDoMB+F4vAaN0AN2p8O8 Xr+w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=Va4EDXEP; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hr11-20020a1709073f8b00b00a46bd59f902si3809940ejc.653.2024.03.20.20.52.57; Wed, 20 Mar 2024 20:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=Va4EDXEP; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 993F668D54C; Thu, 21 Mar 2024 05:52:24 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vk1-f227.google.com (mail-vk1-f227.google.com [209.85.221.227]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0F9B268D517 for ; Thu, 21 Mar 2024 05:52:15 +0200 (EET) Received: by mail-vk1-f227.google.com with SMTP id 71dfb90a1353d-4d427d8f1d2so202018e0c.3 for ; Wed, 20 Mar 2024 20:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1710993134; x=1711597934; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iGTpvi9xGH6CV98V2uDiM76OggFbrqsnPJTCGVM2ebs=; b=Va4EDXEPGBI6uBxxHzNkCmIiAnjzIL/qUchs82jIp2Q7roI2Gy5FBeZfN3RqXvclxX Ki/59d6ILGYDJcaahW8+j+GlGNlrBQadzG5pZ0gsule9Z+vMstIGiJvwXkPeG5VyP/tG eA1PFt+tqCLfLfu2G6fXggGfm/TStzmwwJgBYcGBsFiifB/2faTGLoOrzn1E2indVORP PuvIZ8wNxOFg+t4CLIFzo7nyv8SAHK28igAQ2UcR55ssSZN7ELPK/tszsxmVkVNrSQu6 YO/p81qU4XWWRhzRNvevp/SgeJ9cAbI/tDN7dvtB9TO9M1BGR626lg3aMhzZgqo5oG76 gf+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710993134; x=1711597934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iGTpvi9xGH6CV98V2uDiM76OggFbrqsnPJTCGVM2ebs=; b=f/7WC65FyXZsRewvzvTHZWsI2g4jn8axZazYFfyyHEujLI8CQLJGLtx0Xfock+MJD1 Bl9/8d+c22g6hCC3rKnXVykBmgh9ZYUkmX6QxW7MUUEk9lgAmcgLQS4ryDP/1ysODkUj Pvw/D8a21FsI+6qBrH9lXNZT4NWTy1Eofk816wGCv/fE2HhMIl27zS1zVzO5o/CRV6ny nY0VEJRf/7AmkWU/4UZYYej09ddexds1qVDfYvhvAAdCc/9StTEfwUN46q5qs+Ep/5sS YUHWsihOfLfV0L6YY1Vl41h0VxG4S/G7Pne2JcksPQHl9bAUP+oixfQyUPrOBJpXBoEB A0YA== X-Gm-Message-State: AOJu0Yyv3Kgfb7VMorEzk8AHS/Z5wQlWvfFHy+inOb8J2ge3L9bipohr zIlDShn+zj/YiSpjYJ9tupuBGemDlVefyP5ak1R8N971FaxnJSBzh97ZVb2f1RiI2snFOtplyIG X9XUKEjMHsta8iVZuc4OagJf8Og34VJxm+qKeURZv X-Received: by 2002:a05:6122:4a06:b0:4d3:3adc:b639 with SMTP id ez6-20020a0561224a0600b004d33adcb639mr4325152vkb.6.1710993133715; Wed, 20 Mar 2024 20:52:13 -0700 (PDT) Received: from wsx-cc1-001.. (c-76-141-249-38.hsd1.il.comcast.net. [76.141.249.38]) by smtp-relay.gmail.com with ESMTPS id x125-20020a1f7c83000000b004d14fb3e0b7sm1204250vkc.14.2024.03.20.20.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 20:52:13 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Mar 2024 22:52:06 -0500 Message-Id: <20240321035207.3849560-5-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321035207.3849560-1-marth64@proxyid.net> References: <20240321035207.3849560-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 4/5] doc/muxers: refresh the RCWT muxer's doc to be consistent with the demuxer X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marth64 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: zy5HTXaR2tpP Signed-off-by: Marth64 --- doc/muxers.texi | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index d9dd72e613..0695a317d4 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -2987,19 +2987,18 @@ ogg files can be safely chained. @end table -@anchor{rcwt} +@anchor{rcwtenc} @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. +RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly +used open source tool for processing 608/708 Closed Captions (CC) sources. +It can be used to archive the original extracted CC bitstream and to produce +a source file for later processing or conversion. The format allows +for interoperability between ccextractor and FFmpeg, is simple to parse, +and can be used to create a backup of the CC presentation. -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 implements the specification as of March 2024, which has +been stable and unchanged since April 2014. This muxer will have some nuances from the way that ccextractor muxes RCWT. No compatibility issues when processing the output with ccextractor @@ -3009,6 +3008,16 @@ 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} +@subsection Examples + +@itemize +@item +Extract Closed Captions to RCWT using lavfi: +@example +ffmpeg -f lavfi -i "movie=INPUT.mkv[out+subcc]" -map 0:s:0 -c:s copy CC.rcwt.bin +@end example +@end itemize + @anchor{segment} @section segment, stream_segment, ssegment From patchwork Thu Mar 21 03:52:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47283 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a4a:b0:1a3:31a3:7958 with SMTP id zu10csp308937pzb; Wed, 20 Mar 2024 20:53:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXlb8r5MINjq1rMjcUX2epTzNxnkHZ/JQ78W9luG55U+B7QuilR/CZVV4rt6jbaDUnL+jEVsyVCiJ+67v5ToCcCng6rL6/FLiO60A== X-Google-Smtp-Source: AGHT+IHdGtJQYfjuOyWM/UmyjUa9TfLfeJz9KbxIySHEFk7QK10KG/YLv8XAPdIO2/lb8x+P3J9F X-Received: by 2002:a17:906:2a84:b0:a46:9985:b265 with SMTP id l4-20020a1709062a8400b00a469985b265mr5667371eje.48.1710993188146; Wed, 20 Mar 2024 20:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710993188; cv=none; d=google.com; s=arc-20160816; b=kjwcLL1KtUoV2WDYMO0zWEsJW9VFhi8KClFdcNjtllXhCPi7xJCtWENRcRDCVJtMXR RBU14IlXOdjSXPvp+xtaMkM6q0YfHRrLyAMannQa7wnGPzkCrk+NEzNOk044Ihz+LN+8 FEIuB0qbMMOyoTCqcFex2DyVgC4jwjRnbshSgwycnTBDgYVHNVmNSOk/3C6U+ks/B0nE FFLLtJSj8La7sgsPRgO1e1KFFAKYR9c/qtaJjt+pbdQ8nblD6R0LZKx2iDJMG8Lqk44X PUxBspsL1sW4IxjIVxuLXIAu0qR4p6jILf+NvsqlYRq23FVSKXrTJCaqqczhaUztc888 nDWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=8M/M/jrZ/uPmVLZLdtoA5xd+UJLWkAgvt91AgUkHDBM=; fh=PlWMzmI9LD2qGS7ipLrQl8z0iaQTLQLHzoGuXcBzpCg=; b=e3KQIN/uDYs803wqSQgLPzVKOJCbaqnfKiV/xaTE5Ls3nRxGM+2+qG4yMJ1v5GTa5y MLD0NcPXQiJYcUNBNw3DYTjpadzBUyn7ye39/Y3R6xs/RUoXReRdHpGquCmtgzx0Moae ACLKDhU/gZk9oDAyeVh4WX8jbIN4UXOyowRpWci+wWZMhaH/sR79WoEqetCAhID6TDJL pOJLh2WY2PkXRNknybCntm9J0XhMEhiYuq/S89Kgb890heCEZLcmV+1jJQGVEp3GiHWZ o6UPehFvbYvi8UYCdblvROu6EuEcL5O1BpHsxxbv0tWAN58auPxcimG9m3pFH5XC6Mox RVYg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=BtiKDXfk; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ne9-20020a1709077b8900b00a4670167b36si7361298ejc.722.2024.03.20.20.53.07; Wed, 20 Mar 2024 20:53:08 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=BtiKDXfk; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 91D9368D54E; Thu, 21 Mar 2024 05:52:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vk1-f225.google.com (mail-vk1-f225.google.com [209.85.221.225]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 686CC68D517 for ; Thu, 21 Mar 2024 05:52:15 +0200 (EET) Received: by mail-vk1-f225.google.com with SMTP id 71dfb90a1353d-4d453ae6af5so235416e0c.2 for ; Wed, 20 Mar 2024 20:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1710993134; x=1711597934; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z+IBYe3jELnPzbSGb494ZzRsEwxcNRnyYCoXTg2Ja8I=; b=BtiKDXfkFUYWpldK7EuMofWmJZNXTE1DAzCC4hbsRi1bsPUgCnT5YNZVyCNFK15F6j FRVLi4gt832tziBJm3R97J/GGycfYqqvAyP4dcN+Acfy/ejaF3EMyfrOZgheM04Gr3gR Ym1GhPSHScMEVRI7jOZDATsRxHJ3DYiH+RnHCoeEjn+g92cLgrsK5LdfqykVhWKvHkAP 1BDfutK/+Hc6JTQlyRPUG9NpiAnCpFkrkg2Ignw9VMDzNOlVn7qGyJQUwgVLZM/ucY+M KdXQuOgwL8wlG1dP5aziZVuz8Gb1dHX+ngEhZuD9dXMFHrVJMBTQEHTaxWTZ/0qGa/mg CJqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710993134; x=1711597934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z+IBYe3jELnPzbSGb494ZzRsEwxcNRnyYCoXTg2Ja8I=; b=LdkwTbm1V93YexxnpmKxNKrfAFaLE/tgu0qz9H2tIVJjlUEeH2SIK12aNsYP2PGuZd FjHGIhuBgNXMlGKx+DezKtKj1YN9cu8XLCKgfc3fAOg/YmV1DJya69kbgFtEmp+4bvFk +PvSfikq3LN6TLBA31EEyB2rQq3r57ZUf8+yBfVSxgZxSdP9KjBP9WDvvOkE3ZmpoQRD mMXW8BMZLzJlZa84pAK0BesB7nExAzgoMGKXz3OhmrHkQJm3oR6xOOYu3iImNPYQBxUb ilj+Zp5uVupTx9bkOS5S1O+kuzHQT6ZUPVCybo0/dys2LRiXDwIBxWdQ9TO1qJQSgc52 9E0g== X-Gm-Message-State: AOJu0YyDEAtFWahVu9OrfhJY0tBq2B/s9Yq181y6YoGKp0sX41Gb6tgp ZGHLLIB6kGI/iXAZr4WqRIaiHYLgYuHlvINH3NkIFyYHsrnoqSx6jMDogJ/5XwuFueIJtaPrtCC z9YYGLChwelw1ir3Y2EkQ3y+3bS9qvCZXaoG7Jl0+ X-Received: by 2002:ac5:cdf3:0:b0:4d3:3f2b:dc63 with SMTP id v19-20020ac5cdf3000000b004d33f2bdc63mr13580453vkn.5.1710993134169; Wed, 20 Mar 2024 20:52:14 -0700 (PDT) Received: from wsx-cc1-001.. (c-76-141-249-38.hsd1.il.comcast.net. [76.141.249.38]) by smtp-relay.gmail.com with ESMTPS id x125-20020a1f7c83000000b004d14fb3e0b7sm1204250vkc.14.2024.03.20.20.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 20:52:14 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Mar 2024 22:52:07 -0500 Message-Id: <20240321035207.3849560-6-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321035207.3849560-1-marth64@proxyid.net> References: <20240321035207.3849560-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 5/5] doc/indevs: update CC extraction example to use RCWT muxer X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marth64 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rPx0eYl8+e0C Signed-off-by: Marth64 --- doc/indevs.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/indevs.texi b/doc/indevs.texi index d1b2bacf8b..fc14737181 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -1069,9 +1069,9 @@ ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]" @end example @item -Dump decoded frames to images and closed captions to a file (experimental): +Dump decoded frames to images and Closed Captions to an RCWT backup: @example -ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c copy -f rawvideo subcc.bin +ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c copy subcc.bin @end example @end itemize