From patchwork Mon Aug 16 12:26:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 29565 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp1992374iov; Mon, 16 Aug 2021 05:26:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI+59SDAFlSNA3KJ7Nt9NtN5urOR8c+ZyIox/9RxwZOrLVxsGqjhnOcLKBGzwditf4Vjfw X-Received: by 2002:a05:6402:b7a:: with SMTP id cb26mr19925444edb.33.1629116791510; Mon, 16 Aug 2021 05:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629116791; cv=none; d=google.com; s=arc-20160816; b=o2PepQg6DHPGqgIs29zbWY2znSQZqDpKir90CgrItyfG5n7iPoN+j917uqZWk/mKt8 hLaJ26TzeXfsXgvTLVEO1WArRWJcz0JqCq1MOhmGymwTdilqKgdmRu77AUCM2ixBjE6x RRDUMcCI5rdVuwQ0gbdwBVfCoJEVu3f2gCuRH6xnN4e2vdtD3EW7V3wjgxGQKbqcdgqi Wb5TI80oUivNJs5w0uKoxgw5gWkeyOvhdRS5Vyq8CiIMRRzdKamVVGBa5SV7OSQ+2YwH pSATAAhElZV8oeKe5RhCg1JlHlU25jamrfRO7UHJj4Wdzj+nMjOoU5ce7fEM/S0234sA kZxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=6PRztT9bhebp87Tj7oE6tWBL4AIrUBlNdNF3qFqN6F8=; b=0dMWoGoxKyaqaz+u4ja+j5yY/QmVZ3HtaDucw6LzjLclL6dfHftd6Y0rT8VbSSi5lS spuV5M2LvHdn3CR3UwyUrrmwqIJyRV/zoWKUixctm4uFp/oUXonPPNWwshNuTmItr3m4 6hO2C2VT4l1gqtVVVdGdDEa262vGYs81F1CwvjE7KGbmOfsIXMcNRrpLI58GTVXjyMps 8BQlFWxzyxN2sYqy+YPvZ32tNgGNTEksYeisvKh4/hXzL021QWFOgIjAsuldHHy9Mk6c oxcU2Etf2AebxZoRjVgzqhVEgviRkzSlL0EwIHpJnZDPVblDFjppSsES2dqhpFHa4OqS dLuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=IpeSAXcJ; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id la20si13090251ejc.3.2021.08.16.05.26.30; Mon, 16 Aug 2021 05:26: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=@gmail.com header.s=20161025 header.b=IpeSAXcJ; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1C8D268A37E; Mon, 16 Aug 2021 15:26:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D77F1680C01 for ; Mon, 16 Aug 2021 15:26:19 +0300 (EEST) Received: by mail-lf1-f45.google.com with SMTP id p38so34187559lfa.0 for ; Mon, 16 Aug 2021 05:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=TtexEIp+Egaqx6OM3u9v8QF7cTXyQx0pb8L4Ae2uDow=; b=IpeSAXcJth6h3oEWGuswhBChNJNDCsR1+s++kJsF1o4WNKK8AcRnEGG/xdrT67RNSy WXLm+UkRA9Wo1H3N/di4Zcm44oA+d5/TJLoBmpp+RYhnXnJVii0OycjOshWvdx75tAHO c808Zi73iEPfKPcmqC46m7PqvYhFJsnQfPH1uH41s+NzMNvLYenY6yOTul951SHbpNor bPzcqJ7LZPQfQ8mx5gJzbfYoS3AeGPOTVnON/CMqNBFrOXQ2M0QEvJ+g1+sXgRMR/tXg HE6N1PLRg5BrK3xbC1a4AdBOdcNSI7NGz4oe9wbS4gHX959cJiqMuFfRHbcKaUQfnU1h Vvrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=TtexEIp+Egaqx6OM3u9v8QF7cTXyQx0pb8L4Ae2uDow=; b=uGElZB5ElbVMOAsYMdGBMnJI6LA4vJu5H1r7O4seFmZYfVTrbczzCSXyg/4ZimquIi yZkKFO5BLBhSueBJm+ZR8GcjL1xwVQ+r0XV3Hcbou1wlyTYmo3gnwGwMecX8nZQpMBHn nJLT8Fx4gspkyAXjojpF6Hvi6HiEAcG45231imwWasvI/h6sSIS0S8ZcJhi2+HHq/hZh TYkDL4jw3UqJ+lQETTqc4BSJv5y+A4P0ZWV+0dTeIZgT9LlVxJn2kC8FgCfA9R6Lr8el PJhHV/a5C6IO4lj7Pj5Lu6lYx8YR9bhAEN36zc3nY3BP1pPzGb3fmRbviU7s4hdid42a 9IUA== X-Gm-Message-State: AOAM533dJaPGe8/NqmkW88DNvGWDPkoaPwlyeMBRIm+Rrih+HbC1pY2F dkWwd7rHV/FMIhfvmVnFPbq4x/5nfW0= X-Received: by 2002:a05:6512:3b91:: with SMTP id g17mr12002251lfv.77.1629116778873; Mon, 16 Aug 2021 05:26:18 -0700 (PDT) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id i3sm930249lfr.217.2021.08.16.05.26.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 05:26:18 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 16 Aug 2021 15:26:10 +0300 Message-Id: <20210816122612.7444-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 0/2] TTML in MP4, part 1 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HQG0HKfdk4vT To keep it simpler this first part includes only non-fragmented use cases if the built-in sample squashing is utilized. Contains the basic mapping code as well as the function that writes out the squashed documents. Works with both subtitle-only output as well as with other streams. In a separate patch set I will add additional complexity on top by introducing fragmentation matching based on the other streams in the mux (since most things that ingest fragmented MP4 with subtitles want the fragment time ranges to match between the video/audio streams and subtitles in the mux). Changes from v3: * avformat/ttmlenc: added const to the function argument codecpar, and switched included header from avformat.h to specifically libavcodec/codec_par.h according to comments from Andreas. * avformat/movenc_ttml: applied recommendation from Andreas to deduplicate AVFormatContext cleanup. Jan Jan Ekström (2): avformat/ttml: split TTML paragraph based or not check into header avformat/movenc: add support for TTML muxing libavformat/Makefile | 2 +- libavformat/isom.h | 3 + libavformat/movenc.c | 179 ++++++++++++++++++++++++++++++- libavformat/movenc.h | 5 + libavformat/movenc_ttml.c | 171 +++++++++++++++++++++++++++++ libavformat/movenc_ttml.h | 31 ++++++ libavformat/ttmlenc.c | 9 +- libavformat/ttmlenc.h | 39 +++++++ tests/fate/subtitles.mak | 4 + tests/ref/fate/sub-ttml-mp4-dfxp | 44 ++++++++ tests/ref/fate/sub-ttml-mp4-stpp | 44 ++++++++ 11 files changed, 521 insertions(+), 10 deletions(-) create mode 100644 libavformat/movenc_ttml.c create mode 100644 libavformat/movenc_ttml.h create mode 100644 libavformat/ttmlenc.h create mode 100644 tests/ref/fate/sub-ttml-mp4-dfxp create mode 100644 tests/ref/fate/sub-ttml-mp4-stpp