From patchwork Thu Mar 28 20:11:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47599 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp1588807pzb; Thu, 28 Mar 2024 13:11:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWAOe+oTTMQHKEW+91n8dXyndE8DYKnxyVazdAv88yiwJ0EwJQ6SRPBhLfhhPr6AYhueYVBZEkJF3onIC7ZxUbSE3PYgmzVuNBp6g== X-Google-Smtp-Source: AGHT+IEZYoR2zN58vwKO80vIKx/YptWpoZSdqlmjXxNS49Xhdkn7lS5iervXYVw6iQbCMUGCqzEE X-Received: by 2002:a50:c047:0:b0:568:c6a2:f411 with SMTP id u7-20020a50c047000000b00568c6a2f411mr237974edd.32.1711656716360; Thu, 28 Mar 2024 13:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711656716; cv=none; d=google.com; s=arc-20160816; b=Y1sn0PtwYelDd8Qzm+b933BIBTMKm3A6hcmVHh7dy/IURMWq6y2Hm1KYFbZlIlywNf SbT4YXmmOvlOOMwRlZezGmw0YJWyVWm8EBXZYwUSeLYoqU8bCBdV2/2L8E9i+5P2hhN/ a+H5Q9tTXQbvs4ffV2qWG/S7yA5866rDzue2h3kVkM7Xr9DIWCu0UMh56cf7cRYjHuVC wfEAuljdZiqXwbeWzsGWfBIz5CXrI/dnDCsGLSa0Wzd9QZ5nkxr7Ku1Jd/NlhEQLEx4g PVo1W7880t0dJPPVogXxXHJkL0T96uXmhkdLqbCBLw6yXBhbCU1PEcratTmSrlGcgHH9 zBCg== 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=6ztIIYG5hsfvwNx45jrwVXyyvFhO1yrczFTrqW5o7OI=; fh=PlWMzmI9LD2qGS7ipLrQl8z0iaQTLQLHzoGuXcBzpCg=; b=r77tHdHg/s5r+Mp5MBS80UOM3gvSSkjK0BxC7YKpnbA4lv7UpL1V6EC3X7JNhCVaVD 03aNCm454ZSTDiw89v8iOS+lPBx3c3kiilGYJJNX+yP4lLANAaHamDcCxRfnnvUOlL+9 mUtk4OyVespo9/P+GzcPA4dlCreYhFJ6hodOCcj5eFYnR95LOLKr4wPxBN6AraOkeIzF 1TeR6SVLYvhR7xIaeHe+oJdYayWJcOuiZNZM3PFy/k6H3RESasv38rpncB8kremTEol7 BJxWBvQP0ZRMFox3fX+ZOgX8f6dB1CZvpIR+mF77Br3MLCTLI4CpzWMPDbQJ5ZKIQUAM 43lw==; 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=BonlGSwl; 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 z16-20020a05640235d000b0056b8075f140si1067630edc.322.2024.03.28.13.11.55; Thu, 28 Mar 2024 13:11:56 -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=BonlGSwl; 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 934A568D714; Thu, 28 Mar 2024 22:11:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f228.google.com (mail-pl1-f228.google.com [209.85.214.228]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3185868D509 for ; Thu, 28 Mar 2024 22:11:38 +0200 (EET) Received: by mail-pl1-f228.google.com with SMTP id d9443c01a7336-1e2232e30f4so6571265ad.2 for ; Thu, 28 Mar 2024 13:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1711656696; x=1712261496; 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=D1yE8al03Ym+FCEbux3/VxG1QcAx/KooNH4mSPGo0LQ=; b=BonlGSwlpfZq+k83QDXH35s9JyLPRGX43AX9Zl3dcDHs0nMOUNIxksy1sFbzvQcNhJ ZjzMKhvo+zSA59JwYpJVkI1Ig1tp+f3nofsFzTWSstyR9LwMG4f08dNEXxhUMutCfCL5 8kftO44sx6xjeK9xDB1Y6HYbiRZZeHjZwRYlPxD3fbjSjfaPFh2D4JjvKNKfVO8j/Z27 MGq08Jz0NBQL8gyz8JtcZncqrNKqelxcejRn4OSPJoA+LnqyufoERx1efdGBcHrbvuyC oWSO3Xu0tn86eVRJFjnm5Ra0jeSkkbnlMSROG5gMEvy94rrCCfxDYntL/mXS7RUNXpbL nUmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711656696; x=1712261496; 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=D1yE8al03Ym+FCEbux3/VxG1QcAx/KooNH4mSPGo0LQ=; b=GQ4wxTfX5cIpJkU8kzh4Hy8uxRaObmeGFKafOdyCT89QA34oZgpKm/Y6eIlUWp8ZBr HasufUEWZqgfxHCA46g8fWN21y2tj3ryiJ1NCXFY5pO7lcT1epTnNEzu2SnAEkFEo8DS 6OMpdM5CB7Dzm25aQqDwmBvCgmO3Ky0izcbLGPWGb/Svd+1jnQdpdfGRcKjfhV4iQpNi Gg+RRujE6G4fqmi8BzXMjKfca0b3xStjTbDkF3GDNk3i4kuhEeTFGOk8ybz1HdsN0jSQ dCH899GhC+Kr9Xd6ZmK/GRAlYFnKOLBMCGVuKyCYqtlweD8vlCBaR8rGtfHrwXH74DD6 ISkw== X-Gm-Message-State: AOJu0YzeaynEf6G4OsZCNmSV/jN2YGWMpGpdPaUKoraiCXL9DSYgLYFg gtEctEPtJYTDM4lpqiQHNCP73DLCphes5odFLAL+E6hAWHxUidkYhAXm34EaqVytpii0nbIp0Uu ykhPDiRE0VioxayTKz0ANaRn5LfhiWoF8MiG77m6T X-Received: by 2002:a17:902:f552:b0:1e0:9aab:7500 with SMTP id h18-20020a170902f55200b001e09aab7500mr595734plf.44.1711656696316; Thu, 28 Mar 2024 13:11:36 -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 b8-20020a170902d88800b001e0c9462e9fsm61791plz.57.2024.03.28.13.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:11:36 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2024 15:11:28 -0500 Message-Id: <20240328201132.1804716-2-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328201132.1804716-1-marth64@proxyid.net> References: <20240328201132.1804716-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support not yet available 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: TNkYqA34RKse If ff_subtitles_queue_insert() were 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, allow passing a NULL buffer with 0 length without attempting to do such operations. 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 | 23 +++++++++++++++-------- libavformat/subtitles.h | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index 3413763c7b..1c9b229f5b 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -21,6 +21,7 @@ #include "avformat.h" #include "subtitles.h" #include "avio_internal.h" +#include "libavutil/avassert.h" #include "libavutil/avstring.h" void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb) @@ -111,15 +112,19 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, { AVPacket **subs, *sub; + av_assert1(event || len == 0); + if (merge && q->nb_subs > 0) { /* merge with previous event */ int old_len; sub = q->subs[q->nb_subs - 1]; old_len = sub->size; - if (av_grow_packet(sub, len) < 0) - return NULL; - memcpy(sub->data + old_len, event, len); + if (event) { + if (av_grow_packet(sub, len) < 0) + return NULL; + memcpy(sub->data + old_len, event, len); + } } else { /* new event */ @@ -133,14 +138,16 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, sub = av_packet_alloc(); if (!sub) return NULL; - if (av_new_packet(sub, len) < 0) { - av_packet_free(&sub); - return NULL; + if (event) { + if (av_new_packet(sub, len) < 0) { + av_packet_free(&sub); + return NULL; + } + memcpy(sub->data, event, len); } - subs[q->nb_subs++] = sub; sub->flags |= AV_PKT_FLAG_KEY; sub->pts = sub->dts = 0; - memcpy(sub->data, event, len); + subs[q->nb_subs++] = sub; } return sub; } diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h index 88665663c5..ad6b96ca6a 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 not yet available 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 28 20:11:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47600 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp1588897pzb; Thu, 28 Mar 2024 13:12:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUESSVl/byDszuFQmwoliPBhMvvnIXPRMXszdiRCEoY7xOPjNuc0vv/X9rJY2P6kMnPbrhV4+MwI/0cuUN7CqsFRFEl8J3JjpMq3g== X-Google-Smtp-Source: AGHT+IE2mEwLK9meCF34K240Z5yRtLLdU3mfTDxIqjmuixTN7xkg9A4K2Nh5egN+j+QooHnbdyPC X-Received: by 2002:a17:907:3605:b0:a47:398f:1a22 with SMTP id bk5-20020a170907360500b00a47398f1a22mr245110ejc.0.1711656724902; Thu, 28 Mar 2024 13:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711656724; cv=none; d=google.com; s=arc-20160816; b=xeEs6FSMDRI8iFzLxbZQnHHK4r4p/zJir+2BWgPydU3lEZ892sKYAO+6N+suu8/cZy m55HM01R1o/6Ep5AnGZKnwzfQc7oYTcinTeyIqAOo2DplIynQm92aWBFGLTCPGsN32OH yux6vkatSmsiXJYlULOQlXqhJKYa7fV+Lrw2nWQ4d3cIHGnCTQl3YOCANdLQs88DBIgR hbuLtWL9cNBQ4IZQZ47GTAnnJYIphcPIxreWTPY9AUw4xgKiEY+Ws7SwXVDysE1d9KnZ 3nd5reo8EcetI8Ia3X3VppOup1psR5JxQn387AYkrvJg1PYdcvmfru7IW81g1c/YmuQd tnpg== 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=7NI35x4dUUv94MUd11HLNMj/FGvevhfk/ylr27Y34IA=; fh=PlWMzmI9LD2qGS7ipLrQl8z0iaQTLQLHzoGuXcBzpCg=; b=imM08WnZuvuEqxf6Xc3D5KWZi4uG0707X4uzMgmaCIEaaKTIw6xZFvfLnBbitt657r rF6G2R0tq2ewGGpUcAgdNpQm8B08XyvytanNuepgIpMcnxu037nCQWDzIKXF1pLQwVtl XKpgJfHDqo2dwb+gtwLfrQnF9qvQ+EE+SzFBy03CnMywAHZaoB6B+AAQAo6wmFkWCfsA NHADEdFuYJiy3izRyA4OQvv5dl9yTBRvAAezmNn03X+DHV4OtHMOHUnkgGePZ+cFajsv qaINc1QH47bEhIF52WATFCLAyNh1MfV/7eYFvThRnTDIptV7WnoeKyc9pXZVALXuwc5j PwFw==; 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=Zu6GATAv; 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 s24-20020a170906c31800b00a46b9fdb7a4si1053394ejz.296.2024.03.28.13.12.04; Thu, 28 Mar 2024 13:12:04 -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=Zu6GATAv; 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 BE3A068D71D; Thu, 28 Mar 2024 22:11:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f226.google.com (mail-pg1-f226.google.com [209.85.215.226]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A359568D509 for ; Thu, 28 Mar 2024 22:11:38 +0200 (EET) Received: by mail-pg1-f226.google.com with SMTP id 41be03b00d2f7-5d8b519e438so970742a12.1 for ; Thu, 28 Mar 2024 13:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1711656697; x=1712261497; 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=BU8eMuxMknOtFLRkxiQPhmlrle0IHWgIEE1Al1uUkTM=; b=Zu6GATAvodkYVDA58WTOv922WTkn6/Z8NPtna4b7sUKTqTzIG1Q4K20dDvv3BBz0tq vaGru25SoUBFCF8/w7pleM57iqznvkavp6IT14tujIAoAbeKB4meAeYau9EwLf5ZwMpN BNpWAdtpIbhUVF8eOROM1VdT98V7B0zyuCe99y0VNseAXcb7a35gwsRz5t8AoTlJrRxF FIE2A1XmXs/211fgjcLQAQ2WU8XIUeLjr2UmsoEmSAH9PPpogxB5Y8YBTPJZ46z64+yz 18FA36DGBirqD2Dgy9PrR6RIYk+rSaEXwYg9+ivbGJm4ej2QLcV4ZJcCXy3CYdSAr67+ 9jgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711656697; x=1712261497; 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=BU8eMuxMknOtFLRkxiQPhmlrle0IHWgIEE1Al1uUkTM=; b=AV0CsZ6MQdUIdCMO2lByQN8lV+2RxQvyIsJEzfQeO3h7apv9L4kCDPUq8rdyB2y4mA ZhB+eTM3th4lu9lhqKv4BY27mK6Xzuj14D8l2L70qK6OEhCF+QA1CWldNDhxWNr9FCVM u8seCxlj4ecxoQm1piYK6OB28aypEhrb4KBz3sHFVUnDilNKsllsJ+upEUAe2yM1Psze /lBXDnsG1xwg/msBe5pagFJkS4N8gETLIduaHDWkIvr0OjZFjiYZ/Tu0VIWblA/w8c8k wmZtalJOxSUC7Ax2UlpuiOoRNFQuU1PIRiFktHaLpgMIL7vGq88a606FUH0PDndmd0O1 0oYA== X-Gm-Message-State: AOJu0YyAFZwD7R/V4SinOuqFp32/my1an66YdL4BUEIJI7RqtkVlXpSu X0B2QfmT7LQYhQrynVt1zl9zZIAdwknDoSSkoCzjWZFT9q3yL4tUepduNfsaB933KAChKr7QYp/ nBYsf0CdKl+tXDrJch7q5mxmbk3l9s056wvNdlJP0 X-Received: by 2002:a17:903:248:b0:1e0:f51b:12e2 with SMTP id j8-20020a170903024800b001e0f51b12e2mr590770plh.2.1711656696932; Thu, 28 Mar 2024 13:11:36 -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 b8-20020a170902d88800b001e0c9462e9fsm61791plz.57.2024.03.28.13.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:11:36 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2024 15:11:29 -0500 Message-Id: <20240328201132.1804716-3-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328201132.1804716-1-marth64@proxyid.net> References: <20240328201132.1804716-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 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: mqFSZ3QRQAfY 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 --- doc/demuxers.texi | 30 ++++++++++ libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/rcwtdec.c | 123 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 libavformat/rcwtdec.c diff --git a/doc/demuxers.texi b/doc/demuxers.texi index b70f3a38d7..04293c4813 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 CC to ASS using the built-in decoder: +@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 Scenarist (SCC) format: +@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 extensions +that can be stored in RCWT (such as EIA-708). +@end itemize + @section sbg SBaGen script demuxer. diff --git a/libavformat/Makefile b/libavformat/Makefile index 44aa485029..5d77cba7f1 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 9df42bb87a..ae925dcf60 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..91f994c3ab --- /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 ret; + + /* read header */ + ret = ffio_read_size(avf->pb, header, RCWT_HEADER_SIZE); + if (ret < 0) + return ret; + + 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; + 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); + + ret = av_get_packet(avf->pb, sub, cluster_nb_blocks * 3); + if (ret < 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_INFMT_FLAG_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 28 20:11:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47601 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp1588994pzb; Thu, 28 Mar 2024 13:12:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXrF+LpXQWen8UNeNpze8Oopgn76l0Gx1SToMbkrgOyPVqDyfWQOp/duFkyYRX79crivAKM3WR8X1WXIdf4UMKTudAovVwKuQpeXw== X-Google-Smtp-Source: AGHT+IFJxgamkkSWsLpHXKNLcFe59hk3a3k4LtcZ0u9PfMVJky1+f+okNHz31YbjDMTe8yFYQsoH X-Received: by 2002:a17:906:3644:b0:a4e:2baa:5967 with SMTP id r4-20020a170906364400b00a4e2baa5967mr197734ejb.50.1711656734311; Thu, 28 Mar 2024 13:12:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711656734; cv=none; d=google.com; s=arc-20160816; b=YEzCHWCNLJZbrc8JyaYkYfx6oNnrbAyjSIOxQW1b0JWh9s0MDa+dDtgIemlScKJHR6 lJhF7QOU97F4dq+cGiH222XVGst60pInbvQpBKr3oQTIB6SWlAnuBkFrnCnnNDszj9Ft WRQ1EbnZP8yblxvS82yBkqh25+JjHPCKaFCO+BfBi43MF8McxiJ22p0qh6cwFPg5IeWT kh00167xghmnEIBH5iaaqLCqysrQgoeBJoCXehOSZkcWsqJO/C3+sIs+8J2/ld9AJksa F1xSNMnfcue/tUXYCpS+lPV5LEDfyya3LG0XzdrTCWY0js73z9k+z3u1+aVolzbVYeO3 waHw== 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=Hy8p7sKqe3dEHmwqqJi3lTIXcAh5+TUVSxbM5YeE0ww=; fh=PlWMzmI9LD2qGS7ipLrQl8z0iaQTLQLHzoGuXcBzpCg=; b=ZesZo9+Gw3zbAuIYmBVtF23svnEh0/Xpqm0JWCBwmQP+xB29D5gWPuAHue+yHBQEVy Xp/XpB+UrVjU/Jqm8q1hybzJ3ViJ3glzF6pSkIuYyN6n76QKRDhgljZZ2MaVLLqsDgJZ Vu683SxXU67H6wFZV2z5HO5AWN5EXULc9QMwS1RUJIgwj7eM59ZTZAq7hnsXZozpX2BH +ZIjFTYmdRcTp2LNxDdxdChfNVIf40asYw83AQj8DHWLIgD72YXLFBXUd9JKAUtlCvfw GTVnbw0voPi6z5R7gtFcAuqTM6NSpDiOGJftYBxT0uA5EbqJ4RfbqRqDFTl7aEBTmcAc 2+Vw==; 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=Bgnty9T6; 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 b10-20020a170906194a00b00a4df61cc2b9si1011923eje.1051.2024.03.28.13.12.12; Thu, 28 Mar 2024 13:12:14 -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=Bgnty9T6; 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 CFCB668D728; Thu, 28 Mar 2024 22:11:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f225.google.com (mail-pl1-f225.google.com [209.85.214.225]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 41A7D68D647 for ; Thu, 28 Mar 2024 22:11:39 +0200 (EET) Received: by mail-pl1-f225.google.com with SMTP id d9443c01a7336-1df01161b39so12777085ad.3 for ; Thu, 28 Mar 2024 13:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1711656697; x=1712261497; 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=G1zOtCFR4/Ejw86NzpN8wQCFMi2I65hE4VVN+39QttI=; b=Bgnty9T6AfKwsq0PCS+Pj7xBaW9SACN8umu27jZrpFwUcyfHCRI9JZmnRXHD+AOAHJ Wy5C6gXuYWb7H1lhTOFklpIeF6EYalsX9GS6dXqx10/6UbVwUjm/I2Rqoo2tWWFgXSJb wu08lNXrE7wX5z2qZhuJJW+tP+AhSpsYxBJBXFgAjZfB+a5VWt0ga+Jd74dB9iTNX9ZE S+gvoQ/EOmJi6KHyTaUBJs7NLVKpeGRJRTsgefB8sAvRJH06Q3FDRVWQ4UNmOMUoxUuG pnIphabLsD9Xn/YBaBteL2kXg+MQqS4jfS5jc+Ieqc1dR0+ZOhhoaR+lOqhOPJTrsoZN sJbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711656697; x=1712261497; 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=G1zOtCFR4/Ejw86NzpN8wQCFMi2I65hE4VVN+39QttI=; b=myY1cv0jTbxs1payMj188qg7ADYuiu1O8HE81XWdCB0feh9NRzAUF/YMVpZjdmaqUo hMcAmGenqhdlnTn3zDy3QESfKC5P+Hva4L1r5cHLv4VgZOuFEUC0+pbqKICgEBharguU Q5d2xmdEcwHmLfknz+OY8fkCKjfIZKs1VjdiOckU1xeH2bu5PA6+1bYEoM9bvGy+JYby nkE0W6sXAW/HAMm3oB9WdaZwida7XpNF5yYRAMQD+hn5hs48wYvc739piLPVA36CMNaV 1IVu7XUb+0gZVpe1tiEmIn26PSO319Nn+kZSPKG10lMTM1HgPGEWPsrtC+nI4wGlT7I+ bkNw== X-Gm-Message-State: AOJu0YwOi329fdMT330zQgLUoi9ozT0XW+nxwTIo7jZDzhkNaHLqzdC9 d+iEc2oUp3YalLTeS2wAl5DLpBSEmIIgA5/Tno0CWwr97IeNoHRt8+HAuf60sPQeeBV4QZIAw1u 1+ry948+E99vnBaGrdXgjEyh9npeWDe0jamX5IuxP X-Received: by 2002:a17:902:e84f:b0:1e2:1db3:ebeb with SMTP id t15-20020a170902e84f00b001e21db3ebebmr513427plg.57.1711656697572; Thu, 28 Mar 2024 13:11:37 -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 b8-20020a170902d88800b001e0c9462e9fsm61791plz.57.2024.03.28.13.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:11:37 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2024 15:11:30 -0500 Message-Id: <20240328201132.1804716-4-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328201132.1804716-1-marth64@proxyid.net> References: <20240328201132.1804716-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 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: rWOtK5QX0JzE 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 f2459ef1d3..e06bc4b734 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 28 20:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47602 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp1589075pzb; Thu, 28 Mar 2024 13:12:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX4b57n24p2zLumXKcGqKUZwbBIBcF4j8V20+xI+rlSPc3IFGeQDEfbDSdlRjr3jJOrDG5R8T8qzBApBHlYHMcLwJ4uREh2m5A/iw== X-Google-Smtp-Source: AGHT+IEvlpLTLB/uyv5lW3Mtv/7Yz9XwyGc+N7yvmnp889WLYIXoElLk3rW41KiOg2RqBzz4gXci X-Received: by 2002:a05:6512:2389:b0:513:30fd:2991 with SMTP id c9-20020a056512238900b0051330fd2991mr448774lfv.0.1711656742382; Thu, 28 Mar 2024 13:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711656742; cv=none; d=google.com; s=arc-20160816; b=xuDLXov3Wu4sFRA9lSsrNDeKEa2L+GjwjE5TbR9kGkaBCPrWWGeJRmnDLwLkKUPhzC tpuV1D/njtZdrlc09OWdgGr2VOgI1fMOUQllkWfSwV8s1ro4uZiVkZaY4vchxXT8W3+W EuQQmpToqevj5ba+g5V9dNrNUx4fBLP1Dr9i0hwV1fqnff7qHK/NWrBcloNTD+Ax/pv6 /+JNQDxI+Lrk1CzElxmE1PLT4T3DgnE4fvGlfJcbzPJQ/pCggBnhVMJ0aAUsI4Va3bAR iHyz92XU3cKj/9R7+GJPnDRKyxccQJyacZH6T2FxJPhwt1Kxl/ZV4BdmXmb3CS2Dp4Ue ldFA== 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=7dUqaDMRooslTAFrIEd3kKvw4Cobp/Tqvvf1NujJw/8=; fh=PlWMzmI9LD2qGS7ipLrQl8z0iaQTLQLHzoGuXcBzpCg=; b=eUscOr648mBjTs3M5cTO/a7lc7gg3GrTix9tH4Sp28sW0n3Ty9i0O5S5jxVGCEZjiA zyc/j5ljWOM4wTShzBrmCf1CdnJbMQVzvl6sWwk0D9SPkHTYHnbs7WdJZTTPheLnVOKO wmuj7jW6xUVsAA39NRD/4fPhjQ1IgTqoZ/0UZzG5E1j1vWYfXy/USohYvy66pIIBBdDO psTX6+B37lM+suoIQtdeo25B2NmHUdXT4k92tlz+kmnf7Ma/HloG8dZDB66Hwt3sPW5E JBClV7DJswJHG0J3yp2mojeq5ocb8POirXEzMPNb+gWzmIlLf1maYhFtwGidcHmxtgXm tdKA==; 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=a2e8Hnx2; 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 s10-20020a170906bc4a00b00a46a9e0c35asi1050354ejv.152.2024.03.28.13.12.21; Thu, 28 Mar 2024 13:12:22 -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=a2e8Hnx2; 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 E72A368D71C; Thu, 28 Mar 2024 22:11:50 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f226.google.com (mail-pl1-f226.google.com [209.85.214.226]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E72FE68D5CC for ; Thu, 28 Mar 2024 22:11:39 +0200 (EET) Received: by mail-pl1-f226.google.com with SMTP id d9443c01a7336-1e2232e30f4so6571445ad.2 for ; Thu, 28 Mar 2024 13:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1711656698; x=1712261498; 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=Tu3xPEMlQocjPY2MXErqKe95m6no5xMG5V7DB1sHkYw=; b=a2e8Hnx2hqYX2MeLUjKmLOwA+iY5POpe3Vof64fuJw5YsPTjz8/NhpnN18yY8PO378 REmzRBAxY16GcEHoEZHcoFw817Uvl9BqMrheENsK2M5OaigipNHFWMx9ivZI9/CkXAp2 Nhtn4e5GIRGGRALSVq51ldX0t1577aJsjRfE3hGORqPCyfI3p15UCIr0VHCh3JUxNWIr dDU/Juxl2uuvYrxe7lifEBGe9YdAsg/SJymhL4/AMdPfuX4/DxMq9Pm9YHnV2YPjg5Ri +w6TxfVT4e/dM4N9wQ2HcuzosYBB1CD6ycFs6Kye/o4cOCjkHGWIdbZTplGhxZnIAw2N 1jSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711656698; x=1712261498; 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=Tu3xPEMlQocjPY2MXErqKe95m6no5xMG5V7DB1sHkYw=; b=wtkbxp2+ZvX9E8GntjMjmX/wIuoRuYulzRb5OpJXTPuhXLKR5F4WR4CiifaVSEvJTE gAzsSSAcO3uNSiz2eEgKibJGDXHFqbqRF6j0s/oNX7SMqsN2CXnDenN7s9WdzScoif6G PtOnLzyudDLhW5QZQMD6B0C62x5OGjK7UcoitTHmZnfqHBy2htLp4LrPGPhullUe0jw3 /TD4lcyZIReFXFBri+G7gg4n9e9+oDEKuPSv2MUiuf4mLglg6LdaBIEXBmf7Ekqzd/1R AmatpLc4quKt9dxMqj165vqkVCDRboMuDHzvZGGbpiAi3fKSFqpjl2iJFX87EGZABvTs S0Fg== X-Gm-Message-State: AOJu0YwfS4wX7PB4b+bX1IWFZLAwnt/BmoBhecQm4tVwoLn9fUMJ80ln yxLpls69n/wsbYLRxw5f89YfqezTKBOa7biwlQfRLj+Qd423HbPCydcnQQAnQRWxlWCcGIqbTA8 CSbo78ujClCVkHXkTCYK6ZHN/KlMzRIVO1WkB2xKe X-Received: by 2002:a17:902:f684:b0:1e0:f473:fd8d with SMTP id l4-20020a170902f68400b001e0f473fd8dmr618647plg.48.1711656698195; Thu, 28 Mar 2024 13:11:38 -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 b8-20020a170902d88800b001e0c9462e9fsm61791plz.57.2024.03.28.13.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:11:38 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2024 15:11:31 -0500 Message-Id: <20240328201132.1804716-5-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328201132.1804716-1-marth64@proxyid.net> References: <20240328201132.1804716-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 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: jpAuluKmlf43 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 a10a8e216f..4161401059 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -3038,19 +3038,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 @@ -3060,6 +3059,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 28 20:11:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 47603 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp1589147pzb; Thu, 28 Mar 2024 13:12:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWQIDRt1SLLaG+zErZXYSZ/QBxNsbTeeQB0JFiPaitew94pcyYINHV9qxNM4AXbPERFeBN8MWt/KtYX3szSS348m/y1Ga0V4LL2Fw== X-Google-Smtp-Source: AGHT+IH2IokgEBwySAt44GfYlWGDCPisCYjqKxEea4WWANt6zk1glCIjdo/ogbwWTys+JCgNnWEB X-Received: by 2002:a05:6402:51c9:b0:568:9c6b:eb0f with SMTP id r9-20020a05640251c900b005689c6beb0fmr275861edd.21.1711656751409; Thu, 28 Mar 2024 13:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711656751; cv=none; d=google.com; s=arc-20160816; b=fWikUE6RmG1VYFm97lHn0EKWxWY79t5ak/nKRzOv+GydTARlOU8dgDKV+L+WmJwsvZ P2B708/KOtgevavbJnc4/33jobQOVNIkT6FsQbRjFw0uMn00mrvE86toHS/hVHq0fABh esgntZg0b403MBnkrB/aaFYHFZ8SfekSv3e+tYj7H8ZUPPFtrulSmcnwJImQ6bkkT/gu FePDzc8ChrkOyZ0d3ahJiEhtqZo8zz74dxveM8Xxs5j62uCpZadfFrqnYLNukY9vxGf7 /9x0YWZUtmKPknIAKkBL1K5UmSmVXGw2OWANKPgMDK2SHSR5hLcayLBdgzBQrvY/KIcE SSLg== 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=lf2di/UfpT2itxKbvXdqXlNtKByIAvbwK2m1LmbjXxPkYJFOvRG1lQt15lUTejEmLp OkROQRlyIpq+4v6SbwAPGl1pzac3hqWGv5eknNytoSyCfm/b4cvbO6Z8/Vn8ZYLIxn8z oO94wVzYOGmUGgpJeAfnMstWORQFJMululzCVpCUrzvo2qMP4rtUnlvzxsctjNV9HPO6 0JmuT5qEFrlIFPT2TfKUsFFONWDlKLGvwM2H/ZoGt0GuvuxRwHHdaROCFubVekO2rC4v EnDGD07t1R7/iSfNH8jrZaryM5EFV2hSEkWq/pchycO05TDHC41yVMlzWEfX37m52Gdz nbwQ==; 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=de5Dwetl; 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 u7-20020a50c047000000b0056be61b7e34si1059239edd.321.2024.03.28.13.12.31; Thu, 28 Mar 2024 13:12: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=de5Dwetl; 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 DEE4A68D733; Thu, 28 Mar 2024 22:11:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f227.google.com (mail-pl1-f227.google.com [209.85.214.227]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 76F9B68D560 for ; Thu, 28 Mar 2024 22:11:40 +0200 (EET) Received: by mail-pl1-f227.google.com with SMTP id d9443c01a7336-1e2266655b1so4225775ad.2 for ; Thu, 28 Mar 2024 13:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1711656699; x=1712261499; 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=de5DwetlQ+5NWSC7p97blY347Cx9aVzXYNtfkTkwWrVDsFVhtz21p4UL/ME7WzBQfX wsTaOGCxuL0uRAi9DpnxM3yLPptfm0ELCIm106mzo9Uav0YPDvsM2lnnFJ/8xOs3hIfX qnv7vKhCFqRX1RlXodhJmY083uldlYhAhNFC7hXv7u/BxxUXQLNKXKgpTt6miqjjMo5+ lW2XQcE1kLW2h5AkFH47g4qNWKzQwdeOHVZcB/Z65F3M7YQEYGjyHTw3TOGCBfV6m4IQ bOYoyznqzGsas+fXtHR7U1NLFwvW50hmY5jwZxXrpH5r++fz5Vp4zY0+hr/BCf8NYlGi lk7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711656699; x=1712261499; 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=uNLwW5A3FSRchYu8O57VEgSNH5Kuan1gH+3hOIEcKOp+3hX2JdRav83rADI4QJpXn5 yfYzexDYnzXv/X5XR/wvCnuBObTagsOQtEUPKGlkS6Bn2NYmWM9qk5gZGaYOl4qzzGVU S4iCWCQHudzvLI2YC3qyi2AWWsWdse84us9erC8sR1JizBHUhmHvPLmljXr7+nuUTzEO R7FAOQCsEF715ZfHp0qY18dAclFuYu5AOSwPicsh/X/cK+4m1GxqT85IKoOgzfX3Jwdo 7dNnGOr9ShiEj9MAcLAoOyR5XWfJ2lD5jl/SYP+u9V2NivOaktLW5V5Epk33sPShsXKt F6HQ== X-Gm-Message-State: AOJu0Yzib8AhJGYFmnyUGVQRpk0h7HUy8vvHB/quASa35rVo1//o+GuA elpP+bl5rnkZu0wSB6P4Ii1Hl5n5h4dJZGSWPfB6aHY8Y6UoPG67V67q2Pub3ZhZcE6eLKFMvLN +srj4KBIJDwj6TGaLIuMxr6oUpw3FUEg94q4XULEQ X-Received: by 2002:a17:902:d503:b0:1df:fd30:8b2d with SMTP id b3-20020a170902d50300b001dffd308b2dmr533607plg.50.1711656698811; Thu, 28 Mar 2024 13:11:38 -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 b8-20020a170902d88800b001e0c9462e9fsm61791plz.57.2024.03.28.13.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:11:38 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2024 15:11:32 -0500 Message-Id: <20240328201132.1804716-6-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328201132.1804716-1-marth64@proxyid.net> References: <20240328201132.1804716-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 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: tkTUhsWbFeha 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