From patchwork Wed Dec 6 06:36:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan X-Patchwork-Id: 6563 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp6592064jah; Tue, 5 Dec 2017 22:36:48 -0800 (PST) X-Google-Smtp-Source: AGs4zMYWrNKxrvPPcIDkgs5+ockWq8ot5dmSSbuCIQLMMap67uXQJYliLjFymB0uZLRUYglf9cKa X-Received: by 10.223.195.50 with SMTP id n47mr19537490wrf.139.1512542208774; Tue, 05 Dec 2017 22:36:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512542208; cv=none; d=google.com; s=arc-20160816; b=JMV58A5VEqtWY5vLLx+T/Eew3Y/XIJGRMCtHUXS0KxIte1ufDGSL7OtvGKTifpUGzC RpwaV/BfY5LvKZObF9Ckb4oSleWmuvsjzJFpN/CmbtJbRh6LrpIeQAnjzWs0BjE1IX6b PRB+jOvTd5JgDtS4L3vpXqPKfkkaLB7VepZA4NTPnjwunEk6NOYATrDE7kbW1oOWU84t odd5dY8LHfz/y+mfXG3xXmgwZX8axBkMk0Vy+4hL1yFLppFLQLEWcltE0eGfIzJJ9Jbc OKdXEPwD5eNTCw4qLHUo+0lGsbaQk/RbFW+AtN9B2cFtnZlJcbuA1cYJr7tQu2wtHcbu rcFA== 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=j5yWYPrPtZWveD3iYInVekzuiYX3F9/cXXjCcNsG6J8=; b=T3oNnnlpU6Unfznb/Z81RGB1tirPb4oWWdjt45f9Wyf9AHEjeYv0RxG9CJhgArG/9c CwMBVbSm3J8BKlyE41QsIgQtI0wrCTlcwxt3HkDMigFfd5z451fCAWU4HkF0Rs1XoMs/ hqv2ZHZqTVIgqiUp6NVwuNbhhuPtPVtCo0wsOgUqYfQeCKFw1Hh0MnyaIaDoL0tDS4XY k8YzgkQTvrAuYC/P3jxZA5YReWE1WjBtd72QkVJHRMT51f05+7QwkDPfcdNE/ZLXC7+B O1QhB1MPyVJFwfvJ0wbZxTjYAnwjzcoAaFymWcCxNgUjn9bFACQ/EBn88u1O3L9J07XD y+dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=g0RnTH0k; 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 184si463281wmv.207.2017.12.05.22.36.47; Tue, 05 Dec 2017 22:36:48 -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=g0RnTH0k; 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 7328668A276; Wed, 6 Dec 2017 08:36:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 81F7F689881 for ; Wed, 6 Dec 2017 08:36:39 +0200 (EET) Received: by mail-io0-f170.google.com with SMTP id v186so1474830iod.7 for ; Tue, 05 Dec 2017 22:36:44 -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=bfJUbaYwlOjmZroqXezPchaxT21Y3lt22mXRDpOcur0=; b=g0RnTH0kByzE3eBUPLdSTBKoYD7wN/THHypU/yblK16FFXX5yyBrEW8oOqoPeeYgmQ pwFmcNIwImTGeyDFqMsr/RoAqQkgqzq+EBPTDMSgQTn1Sy5Eq4iKMG6w2veeadgWn5RT X6ZbH0aux8/qeU7nns1mmQuNW/7tCXqs0xt2BEzajFb9vuHCFJ/XRErA+QJCJixLVgxr BpNYNYrZD4ivtGqp3WBasdWsxUh81+Rq0VW1pye81vF+3j8LxpUMDTWRBhOkwErvS147 t+oAeLKgkBfFIXyECbeJVTMdu54mk7Hs67L7m/AXwcPSyys4ucvLygWldUVG6InHOqgT /iOQ== 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=bfJUbaYwlOjmZroqXezPchaxT21Y3lt22mXRDpOcur0=; b=nLPXuFnKYVw0N0WzrM4z3vfgjYlyYmGYhvro3zcjYwOUuEjWVxtaYTBPRJ/FmZixEH UD0nrZXkSU5dK9AWHnMGpSHq1csdGTQyWD8yGDkab0EAGdUAVMUVLWJzdsWnamN4IeM5 UV4jD/EBiXalWC0vF5YCMaprxjNnM/KSg3In4f2yuggCrRG+0VN7CDr/qV0aw0vJ3Hgi WAp+JzXka0cJadbb08kLvQgzZFDQJQUB/LHRugui8WhMTJooi4fsd66r5Hnxitc72/tT 285t0lQ734vazV9Ycd2Sr4w3saA5eLL44InJAb1HRn0pOkBMNiei9tY6K2Ol9YDntpKE RZtg== X-Gm-Message-State: AJaThX5/MgUyg+qqfbXHCWGcUGRw3VNG9fpxnkv18HbyFfWtTEbd5iyI 18FQdRnYekzs3jKueyOM6/wLbeEZ X-Received: by 10.107.11.36 with SMTP id v36mr32216354ioi.13.1512542202484; Tue, 05 Dec 2017 22:36:42 -0800 (PST) Received: from [192.168.1.105] ([103.206.133.250]) by smtp.gmail.com with ESMTPSA id p193sm940641iop.3.2017.12.05.22.36.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 22:36:41 -0800 (PST) To: ffmpeg-devel@ffmpeg.org References: <398ccb48-4ded-9bfb-7508-2a305654ad80@gmail.com> <16c0476c-2741-e059-3874-4f32f20997b5@gmail.com> <4e0efb5e-4cfd-c759-4360-11e310ed928e@gmail.com> <26db60f0-441b-5dfc-90e7-bcccfa5ccadf@gmail.com> <20171205133856.73fdae8d@jagoff.localdomain> From: Gyan Doshi Message-ID: Date: Wed, 6 Dec 2017 12:06:33 +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: <20171205133856.73fdae8d@jagoff.localdomain> 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/6/2017 4:08 AM, Lou Logan wrote: > > Nit: change "set :" to "set:". > > Would it be possible to list the profiles with x265_profile_names > similar to what is done for libx264? Both done. From 607ed6fd623cee0e2d49a70d9446b8360c799498 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 | 14 ++++++++++++++ libavcodec/version.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 4456e300f2..cbb106aeed 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,18 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) } } + if (ctx->profile) { + if (ctx->api->param_apply_profile(ctx->params, ctx->profile) < 0) { + int i; + av_log(avctx, AV_LOG_ERROR, "Invalid or incompatible profile set: %s.\n", ctx->profile); + av_log(avctx, AV_LOG_INFO, "Possible profiles:"); + for (i = 0; x265_profile_names[i]; i++) + av_log(avctx, AV_LOG_INFO, " %s", x265_profile_names[i]); + av_log(avctx, AV_LOG_INFO, "\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 +405,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, \