From patchwork Fri Sep 11 16:11:03 2020 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: 22292 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3AD1F44B30D for ; Fri, 11 Sep 2020 19:37:43 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1B8AD68BAEA; Fri, 11 Sep 2020 19:37:43 +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 EAD3668BA3C for ; Fri, 11 Sep 2020 19:37:36 +0300 (EEST) Received: by mail-lf1-f45.google.com with SMTP id x69so6495554lff.3 for ; Fri, 11 Sep 2020 09:37:36 -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=I+1+NlF1rXUVvbeOyDIm+uHD4WbK6JTBHKRcHoljDks=; b=CVpU6DjXNqrJfHzAyqNXCsX67tRZO7h3lbPRC3CtmTGm0S//2dMX7aljIbbGi4mVHo TnhKlbnporYyLJgaRY1ilY1gETOLlx9CuGF8jR5ZCCOns5vEWg0Ui3Q8rGbH2mh/dbkQ oJpiQkLttzrtZADAkqDogomqjQDQ23zYpdgshS6e31xmKNx2QUEefwmiPQ6R9R4GeFGE XeaNSITQzP7uVFHa1yRMtteSr5+QJiD9lKJbACZJgdNDHaYnuCmXCpThUxj0Im9OWqAC 2/dP+RgoREVX6F1HO6ecYZUyAP2uXyQlTLk+S/GNsWmdY3pPB4K48AaQfDXEH//Pv76h 35hQ== 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=I+1+NlF1rXUVvbeOyDIm+uHD4WbK6JTBHKRcHoljDks=; b=EzlGkfe5v9CnRLkYqq2A+g7vDmSWWu1nw1+LtKYJfzb56El7Y68yd70XqpGv+OhqVd 1BG0WG0cwLX1qWZ0shiF+kLkjvo6BXNOJS2UvgZk5FSujduidq5umaywRPxG+SvQxjYq dwrquaB9ZD401mgY0dS9cziSPvHe//ZSTdK6neYARhEJ/68dwDo2UC1uGW6Eab2vYJji UJEOwh7jPBGyt7dBmucuDBcX8YE5hjpF0G+w8lUVq46oS/AQf29GCLnZwnrtWwlQpVcQ mP+MYB0VJEvg9E0h7YxuQ9cYocBWeQ5V6TO2fCHXlhl2xEFhyRmjcguZuLHHXToqPTPZ 8rAA== X-Gm-Message-State: AOAM5307G1HcaIDCx7B0aUQRr2t02RDxc3RvFOJg2F2TsKOQGp90cK4g 17z7dbc4b9VI+xH5WJBF2sS6kWlPjps= X-Google-Smtp-Source: ABdhPJwjReR/4rwXROFNmC3Pq4jBZYioUkouuJJk4fFhlYX+l3TDeXqHPTo0AhAz/JQXWByjAKr0lw== X-Received: by 2002:ac2:495a:: with SMTP id o26mr1010450lfi.94.1599840668726; Fri, 11 Sep 2020 09:11:08 -0700 (PDT) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id 193sm134285lfb.212.2020.09.11.09.11.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 09:11:07 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 11 Sep 2020 19:11:03 +0300 Message-Id: <20200911161107.24870-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 0/4] ffmpeg: late A/V encoder init, AVFrame metadata usage X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" This patch set started with a very simple wish to not have to set color related values manually each time when utilizing ffmpeg.c. I do not have the whole FATE suite locally, so most likely some test will fail due to expectations of the metadata not being set for video - or due to me failing to handle all cases nicely. Still, I thought this was useful enough to post on the mailing list for review. Currently limited to using values for video, but the same capabilities are now available to audio, as I saw no real reason to special case video only. This probably fixes some trac issues, but with a quick look I couldn't find anything that explicitly was due to lack of video color metadata passthrough. Jan Example 1: I have an RGB 3-D render, which I would like to encode into BT.709 YCbCr. The video filter I'm generally using for this (zscale) does flag the matrix in the output AVFrame. Yet to have the video encoder have the correct metadata set, I have to set the value(s) manually. With this patch set, the value(s) from the first AVFrame fed to do_video_out will be utilized. Example 2: I have an input video that sets one or more of the following: matrix/primaries/transfer function/range/chroma location. I just want to re-encode it. All of this metadata gets stripped. With this patch set, the value(s) from the first AVFrame fed to do_video_out will be utilized. Example 3: I have a video which has incorrect metadata tagged. Before, I had to set the correct data data manually. With this patch set, since ffmpeg.c takes color related options as dictionary keys, the AVFrame values will only be utilized if the user has not set the option for a given stream. Thus, this use case still works. Jan Ekström (4): ffmpeg: deduplicate init_output_stream usage logic ffmpeg: move A/V non-streamcopy initialization to a later point ffmpeg: pass decoded or filtered AVFrame to output stream initialization ffmpeg: warn if an encoder has to be initialized without an AVFrame fftools/ffmpeg.c | 108 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 73 insertions(+), 35 deletions(-)