From patchwork Wed Feb 2 23:22:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 34076 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp1983959iov; Wed, 2 Feb 2022 15:22:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKOYaHQ1Phb0VhDe+uGA4Z/FOcaGG826G0n1LNXRAqwlMOCwAs5ycG/dlS9XzjpAPbF8lg X-Received: by 2002:a17:907:3f25:: with SMTP id hq37mr27998098ejc.566.1643844159442; Wed, 02 Feb 2022 15:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643844159; cv=none; d=google.com; s=arc-20160816; b=oM+Fk7DHXSUapRqj528Y6E7fkJVmhF/B5nI59NawzpzedlxinJPyksf7zvaAlt/GII TmisKUOAoeb8TAHbbvvRj3EMA8PALrOXzWbjXTrmLsgJsTZRdWmK756ysrboYZU7qDSE pYBYknratuobgK0hTElm4cUobxZrj3aQwdeKQUrwhTWA0g+aQ8/gNFOGWdgUS/UC9X8p c61kPxlV21+D4bxk39FFPTqN2EQojkr6ENEdYSiTcTxan+MbHjwDOQ+BLCITBF9i3Wfw eem7RIBPyVdRZIiZkyJx6cWUsdeovlSvcm+GgMwP+F03Jb4cJnaXGx8o7IhEQ+HPqDRZ hm6w== 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:to:mime-version:fcc:date:message-id:from :dkim-signature:delivered-to; bh=hcZ+3+2ZxIKfSenyp9OEh7Rj4iDJTNQmtmnITXT5svQ=; b=M68wWZbuVCUWEHuqjZGhPZzjjDs+1cfREiBsAY1IQnyXE00ejFdqZ0AqeI8P3PGI6f XnDhmZOsKuHXuC3Jg0RGEOZrm07TA1nasihX2BTqLSX3QYOgaShtA7RZGySgsGSOhUxh 68ih+3wy/vUvO+vR1HFdvHmmX6VGlJ9H59k2DeLDszitLllUFt7s4SQcEEPvBS3kBnrl Az6RiZI9vQAWEuZ1HUEzf3Pw2/w+pnrZZ/15GbGMnUmVaM2oyPP1Iz9ZAiVhtxLZVlPl X1BYRXQVX4VxWZ+SNu20sIc4pn8nv6iWR6JOD5Ya5N4ruLpCRAxX6rcQXbn3pFqYw/g2 w89w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=X4o1F7Vj; 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 z22si11078124ejl.84.2022.02.02.15.22.38; Wed, 02 Feb 2022 15:22:39 -0800 (PST) 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=20210112 header.b=X4o1F7Vj; 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 A89BA68B10A; Thu, 3 Feb 2022 01:22:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 922EF68B07F for ; Thu, 3 Feb 2022 01:22:27 +0200 (EET) Received: by mail-pl1-f176.google.com with SMTP id s6so590334plg.12 for ; Wed, 02 Feb 2022 15:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:date:subject:fcc:content-transfer-encoding :mime-version:to:cc; bh=yDEIMqLe7+G1rlI4O367VMlSn7jMumRfJ+SI0XHzyMc=; b=X4o1F7Vj3bti/7vZvFuY78zrItZNunyt4aK/KO3uBSWgriTjI1IvtDRRupGlTzydX+ HJMtOok72CZSypQovmI5FQfGUgiypfxvvRS4ZUteo4IGMaeMGXlepfmypdFXl52lwADO mL+j9CdmqTr8IOdf1SxjZklM8xKn014izPYHj2AEjLgE3VMIKzySemoSxw0eIoilXdyD carDTwFjkDumYYNbuzKztAqBEpWG29Lm1V73jwmrz6pKUJZGIzmBUSCMzeyGHKlDSuUG 1AHLW+dZW08wRCdEiD4hyovKviSfx/6EN3xQiBMmp41Ee9664BijNUrwoBtFKt0ql1iS kWgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=yDEIMqLe7+G1rlI4O367VMlSn7jMumRfJ+SI0XHzyMc=; b=qOPM6nGjAu2SG4d3qKTHCeyeqQtZrmVg6SMFNTV/RiWC1cNhRD89ygsuSIQeEUfVpZ TT0G7eDPcmg4KFAienNfub9Jzq9Qv1rYMEuKwOLpkSDs2MeRoodWaf2nQJmf45ScJdoa lSG/7PCCJLl8NWKSyHe8IdyL3lAjFL6SL2jrZ1LBPPu6lThoswBlLC7hmMUBxKyRuhbD omNbR3w1fgORohhZ4QuPRgkIlU1uKHY+IuGRtKKpu8nRoy7OBieb8qVSTHIoCTuTwGnN JKp3aFSASWozuDq089+aRI4wUauDIuMRaj3Rt6yd31kcNP4BWuV3fBKV8gtlpRZHg9A5 I17Q== X-Gm-Message-State: AOAM530qQKal5nkjwGDL/itBUs7fx9EsAKOYhH6hnNKD7fupl1r48jn6 4+WwQdZKo0JbZ4og93V3K8hEAhJfC50= X-Received: by 2002:a17:902:e812:: with SMTP id u18mr33070477plg.12.1643844145495; Wed, 02 Feb 2022 15:22:25 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id p4sm14163142pfw.133.2022.02.02.15.22.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Feb 2022 15:22:24 -0800 (PST) From: Bryce Chester Newman X-Google-Original-From: Bryce Chester Newman Message-Id: Date: Wed, 02 Feb 2022 23:22:24 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] [PATCH] libavformat/mov: Expose Quicktime poster_time value as metadata TAG. 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: Bryce Chester Newman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: db42YCiveQLC From: Bryce Chester Newman I need the ability to derive the poster time found in the mvhd, so I can use that value to create a thumbnail from ffmpeg. More details can be found here https://www.mail-archive.com/ffmpeg-user@ffmpeg.org/msg30003.html Signed-off-by: Bryce Chester Newman Signed-off-by: Bryce Chester Newman --- libavformat/mov: Expose Quicktime poster_time value as metadata TAG. I need the ability to derive the poster time found in the mvhd, so I can use that value to create a thumbnail from ffmpeg. More details can be found here https://www.mail-archive.com/ffmpeg-user@ffmpeg.org/msg30003.html Signed-off-by: Bryce Chester Newman bryce.newman@gettyimages.com Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-21%2Fbrycechesternewman%2Fpatch-poster-time-tag-v1 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-21/brycechesternewman/patch-poster-time-tag-v1 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/21 libavformat/mov.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) base-commit: 2e82c610553efd69b4d9b6c359423a19c2868255 diff --git a/libavformat/mov.c b/libavformat/mov.c index a80fcc1606..3d36f6563f 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1487,6 +1487,7 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int i; int64_t creation_time; + int32_t poster_time; int version = avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ @@ -1525,12 +1526,21 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb32(pb); /* preview time */ avio_rb32(pb); /* preview duration */ - avio_rb32(pb); /* poster time */ + poster_time = avio_rb32(pb); /* poster time */ avio_rb32(pb); /* selection time */ avio_rb32(pb); /* selection duration */ avio_rb32(pb); /* current time */ avio_rb32(pb); /* next track ID */ + av_log(c->fc, AV_LOG_TRACE, "poster_time = %i, time_scale = %i\n", poster_time, c->time_scale); + if(poster_time && c->time_scale && c->time_scale > 0) { + char buffer[32]; + float poster_time_location = (float)poster_time / c->time_scale; + snprintf(buffer, sizeof(buffer), "%.2f", poster_time_location); + /* This will appear as a TAG in the format section of FFProbe output using -show_format */ + av_dict_set(&c->fc->metadata, "poster_time", buffer, 0); + } + return 0; }