From patchwork Tue Dec 5 09:22:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan X-Patchwork-Id: 6555 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp5430199jah; Tue, 5 Dec 2017 01:29:19 -0800 (PST) X-Google-Smtp-Source: AGs4zMajWChL8PSir5ogc9NOmkJYkvROuoHgv7RC+bQOs0X0x1KVk90A3BioKmmY7zJLDeIPrxJw X-Received: by 10.223.150.68 with SMTP id c4mr15276140wra.255.1512466159877; Tue, 05 Dec 2017 01:29:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512466159; cv=none; d=google.com; s=arc-20160816; b=V+UFiTlih+/ijz0q4ZRuatVXGpgAgJMRrXfXbG8jc2NWpOKCH7ipSMgMPkV+pBNWIy 5464N1MwTXimUphrlQVaC/9SqB575/hpOObHfLldCeptidtudB1PpHsP/bNkiQVH6V2y URvR8zMKVUVDv7+IWr9dnkj45h7TuRZuQOYSal3+YsnAmGaRW6BFSI1agM9xWEZ7cQhc VQZzpnMZEQJyIHuBMVAVy8IvMIOiQzIFVDlepYsQlg0kt1jRAzueopzz6/yxiziAEhVD OLkRK2EO8ZrEewJQeUuvIRROoe2F0SsW+DnTQfOTJ4Satd4Nc78Qt+7x06pyNneJaFwz PHQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:dkim-signature:delivered-to :arc-authentication-results; bh=9DvywBuxnT/MKt6xr+5OQO+9Mj+NWyjEYK6bHbKdZe4=; b=WOIGtW3Nv5AuchX9+mXRRSwAlNR0Kc9wN0ldSJwc3XOxD8mViiO3YY1pY9G6QEFPr2 2Ggo1XwOCsLeo8xlfXRF171xSQZLS3GvuhpN0zDZJ7KzlPtpUU3T5Ju/NoQeIwnbzPCw 8BMnsvlj/iNk5tZuLtMdn79DWsHVyd79lCz7UD0cpZ+sJXJg5ZAu+zpqZKxpeN/iObUR A0wW10BokKHbdCVxi2hAG+oli/+7HBk/+zogz1pKHn2qpsaXVfThKLjfPU1PKG+Oq9y2 8SiV6WCpI8fJEcqbK2N+EkR0fP0rI8su0slFqoNy+mQLWQ8pzPf8sgWjS9v9kDPWtsLD QOpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=FFP/VrIT; 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=NONE 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 i27si1166821wrb.493.2017.12.05.01.29.19; Tue, 05 Dec 2017 01:29:19 -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=20161025 header.b=FFP/VrIT; 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=NONE 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 4278468A1FE; Tue, 5 Dec 2017 11:29:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f53.google.com (mail-it0-f53.google.com [209.85.214.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A4AD368A1B8 for ; Tue, 5 Dec 2017 11:29:06 +0200 (EET) Received: by mail-it0-f53.google.com with SMTP id z6so19932529iti.4 for ; Tue, 05 Dec 2017 01:29:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=+dEFtSsFrP/w8AUvl0H7axm96LlCDoV+7+CqZHlU7RA=; b=FFP/VrITkHgeByfBjR78jqk5zaiHs3lWyA+PcDdqduIJQTm8cIgHo65Mb9sxwSW62u mQB1ui5mZRkXyhxAvdbgf6lM2gkxEsHAlHKnbJpZyuPKhtmoXwOpHKVllGl6LS0cS6oj tCijzvOhoLrfGrD8lj0jatGKMrW2DzkN+tN1+QLEFRsilqTP+6uN8M28GjwpVRBTyNzp BFS94LYK9GI2FISryBOigd2uqksDLEgGreMt5cNkfF/xtS9M88CINDSzhOUFnuMr39Sj r7hhPDoK7HPJ6ZAKdWzE0fmpDVYqoA6H8nzUMDAasOUMbIAgKtGlJyxX890RD7CtK8Xx 7DAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=+dEFtSsFrP/w8AUvl0H7axm96LlCDoV+7+CqZHlU7RA=; b=E25rc/O0b/oUS0ACPY+6DGafvpiPwuFeDkNVhLdjpCTX7gJm7SXw1Fs48i6vlJHFa0 NpVf/67QMvpyH4D4zOVkWvNOoPv/ykwwgVcntC8BiE1QOcmmL0TPEQP5qi2/PfRgOSr0 pHN7Ya9c6FRbmT51NFWnIqic19LXWyOXhQdlNkEJj1r4DOcrqYIIY2iTu+XFm+TfquB/ zpOHMnmOCPLjghR0jbOtxD7WO8O4IpWoN0Dou6At+Ed7UrALdwtz7yokU55VhvahWwZy hRmsWmvxJFW2jcF54aYggEWrWxjja3p7duNl7BKIFq4skGCMNb2B9DI4OKrBQfo4F1T1 A5/g== X-Gm-Message-State: AJaThX5xDddr3CiFeK7zRvlgc7wdRtXq13DpEm8RxZhoGjfTkhpGkC5y /eSoSONNxDRL/MU1Wq9kKPSkWWCp X-Received: by 10.107.134.227 with SMTP id q96mr28670457ioi.197.1512465783071; Tue, 05 Dec 2017 01:23:03 -0800 (PST) Received: from [192.168.1.105] ([103.206.133.250]) by smtp.gmail.com with ESMTPSA id q62sm4910665itb.31.2017.12.05.01.23.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 01:23:02 -0800 (PST) To: ffmpeg-devel@ffmpeg.org References: <398ccb48-4ded-9bfb-7508-2a305654ad80@gmail.com> From: Gyan Doshi Message-ID: Date: Tue, 5 Dec 2017 14:52:56 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Subject: Re: [FFmpeg-devel] [PATCH] avcodec/libx265.c - Add named option to set profile 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" On 12/5/2017 2:33 PM, Hendrik Leppkes wrote: > > Please just name the option "profile" to stay consistent with all the > other encoders. Revised patch attached. From bbb8013e7404360139a13b58a377a29d3ca69552 Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Tue, 5 Dec 2017 13:17:53 +0530 Subject: [PATCH] avcodec/libx265 - Add named option to set profile Adds call to x265_param_apply_profile after x265_param_parse. Added as private option since HEVC profiles other than Main, Main 10 and MSP in AVCodecContext are consolidated in a single constant. --- libavcodec/libx265.c | 10 ++++++++++ libavcodec/version.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 4456e300f2..64250ded62 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -45,6 +45,7 @@ typedef struct libx265Context { int forced_idr; char *preset; char *tune; + char *profile; char *x265_opts; } libx265Context; @@ -220,6 +221,14 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) } } + if (ctx->profile) { + if (ctx->api->param_apply_profile(ctx->params, ctx->profile) < 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid or incompatible profile set : %s.\n", ctx->profile); + av_log(avctx, AV_LOG_INFO, "Profile must match bit depth and chroma sampling of output stream.\n"); + return AVERROR(EINVAL); + } + } + ctx->encoder = ctx->api->encoder_open(ctx->params); if (!ctx->encoder) { av_log(avctx, AV_LOG_ERROR, "Cannot open libx265 encoder.\n"); @@ -392,6 +401,7 @@ static const AVOption options[] = { { "forced-idr", "if forcing keyframes, force them as IDR frames", OFFSET(forced_idr),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { "preset", "set the x265 preset", OFFSET(preset), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { "tune", "set the x265 tune parameter", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, + { "profile", "set the x265 profile", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { NULL } }; diff --git a/libavcodec/version.h b/libavcodec/version.h index d67b689142..3b5c3000be 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 6 -#define LIBAVCODEC_VERSION_MICRO 102 +#define LIBAVCODEC_VERSION_MICRO 103 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \