From patchwork Fri Apr 7 07:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Davy Durham X-Patchwork-Id: 41009 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4645:b0:e3:3194:9d20 with SMTP id eb5csp184488pzb; Fri, 7 Apr 2023 00:50:21 -0700 (PDT) X-Google-Smtp-Source: AKy350a1A90I/IX/LyVxV/kOzmLOAEh0CmLBChMvbGCUT6Ew+exg6lpHhkNeyBd9zx0sTfKnUd7D X-Received: by 2002:a50:fa8c:0:b0:502:2265:8417 with SMTP id w12-20020a50fa8c000000b0050222658417mr1878922edr.17.1680853821561; Fri, 07 Apr 2023 00:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680853821; cv=none; d=google.com; s=arc-20160816; b=QY95vbDt8MY3s+oXoDE2K4LHOsk8VYeJkyP2PQEn/J12345pvF9x+xoz8+EwI1zj2Q WatVbbZt7cDK9AqtuaIRERaXbs9QO0JUUd+u+4qG8lDoayl6YRrqz33nvRJpPjQqFLp/ frdRUstCXFN0tt0+ZCPjKaTpkVLIE36cziu0w/MLcOipTL212Buw2MfzZuaGOqpT8oRQ oa1DBVnVl7lgMTFNGOJrCrRhtkb1eYlFyuIwRjYj5Bs0gwh2J6fpUnOYKG/Ld5rvjKD0 qJ7QQ7f4LqsfSPGOIwnibjJxVWQn05oIAcEFSqq3877cLm7a04pgX3etAPGNjYd3KeFC 8aPA== 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:content-language:to:from:user-agent:mime-version :date:message-id:dkim-signature:delivered-to; bh=Mb+Bn/0kY0Tj2xvofpb4OkE+CmNzbNIvKxbgs7ntvcM=; b=S48B0/VtyUuACzF2IL6CBWQTgXTFo0+ZZspecY2v0rmh55b4w5Yc4kNN61e3Zhq2Ww ctSnTZ4FS3ZnI2xCV8RUT1YpgioE5uWrTrgyhoGmRmpY4ctYHb9Bt8T9/uhlaLxCC009 cy2jtIX4jyA2dOHwcFZ+N8roIksayuXZSEb8tSlDCWA/gymPBCMJXsRaT1VkGk2F7gkZ OY5kmLmOuQUAfsWmHpIJvILMfkjHf6k+KcSPzSA1LQC6V7Bpv393y5nYm7siQDKvt1bJ Yos2W0UXwiIm9Qj7MPp9Mn+vNnaaq1W5EoMM5mQ1r5n1lf48gABxSHCiYJUv5W0BDkN7 /XyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@davyandbeth-com.20210112.gappssmtp.com header.s=20210112 header.b=s49y5mA3; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g24-20020aa7c598000000b005025028826bsi1362083edq.296.2023.04.07.00.50.20; Fri, 07 Apr 2023 00:50:21 -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=@davyandbeth-com.20210112.gappssmtp.com header.s=20210112 header.b=s49y5mA3; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5728268ACF2; Fri, 7 Apr 2023 10:50:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF31968057F for ; Fri, 7 Apr 2023 10:50:10 +0300 (EEST) Received: by mail-yb1-f182.google.com with SMTP id i20so1744829ybg.10 for ; Fri, 07 Apr 2023 00:50:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davyandbeth-com.20210112.gappssmtp.com; s=20210112; t=1680853809; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=hYZ2bmJkpYYtjXYX5jfGvZjlb2CJp1cTpPW5cBaQtCs=; b=s49y5mA3W3T4MFRwpo71QLGDfcCVdVMLJBo8r5xmcBjMTdJAl2LCbJy4P+RKxE2SV0 RiOMLp2aa/IzmOjMpLlc/vqZC2AtwtyLaq+QnzNrWeD9WpPVuvyj4Llhe/pUg2sxbMm5 0rak5LLUI0+mYCGM9REVvLhJA6lPhPEccbetXVOnNq0AB9unWGn4Ihlm9VpBtqVx+9Fe S6FIrOxumPo/qoRkJ5Rb+ICa2RYlpvdmk3lD/oLhapMmdMKCPR4SjZnxsNBzxOlJFYSP bF2VD0S6SPCicKLV+SzA9W1ROHbm9EdMRcMC/ulM/3mWkgg5tdQgAE4N4+/wZZykLX5H Rajg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680853809; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=hYZ2bmJkpYYtjXYX5jfGvZjlb2CJp1cTpPW5cBaQtCs=; b=Jg34Qf09c94YUqi/M9KEZBGmg/XBsr7UQRLcs3NLPHY8ivK54WsEntmwTpGdJdOJbZ oeMAaN5GdaqI98+66+GK6S3aEY/mzX3CpYBbNtf1DvySAPtIW/jtHB2dvkstbCzZyPnJ tKfEGUgJEK0ZLwoLjHziRsS9JBXRrgYVD2jHGUiWQP87lDPSZNzcHm/oDki8qv0VSv6N SzlJXa+AgsnJhrjDPZUz0gAqcTx2lA8cJAEdzK99jeJaBZacwSAjatRYThAO2EsiBYZf p4rncI3Q5uMRGCPTTFTkOpNqS98aB+jcMBN0HJc9OpNNuAVp9Pb3rKSp0UNW7c4TLiD1 ZC2A== X-Gm-Message-State: AAQBX9f9ae1n8fgLYdukPIZvqMh2BwPg+y0BmLILcObDbrzNB9EaEDKj o5nA2r9aZRDurprRwCpsv3EGebnz3j6fDSFkvZN2nA== X-Received: by 2002:a25:1846:0:b0:b72:9470:2234 with SMTP id 67-20020a251846000000b00b7294702234mr2372547yby.46.1680853809147; Fri, 07 Apr 2023 00:50:09 -0700 (PDT) Received: from [192.168.1.92] ([68.249.219.17]) by smtp.googlemail.com with ESMTPSA id bw26-20020a056902161a00b00b8c08669033sm457870ybb.40.2023.04.07.00.50.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Apr 2023 00:50:08 -0700 (PDT) Message-ID: Date: Fri, 7 Apr 2023 02:50:07 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 From: Davy Durham To: ffmpeg-devel@ffmpeg.org Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] fftools/ffmpeg: Added ability to set a input burst time before readrate is enforced 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: zeDy9BPunR91 Implemented is the -irb flag (i.e. "initial read burst") that causes ffmpeg to read the specified number of seconds of input before a given readrate starts to be enforced. All inputs have to reach this point before the readrate is enforced. The reason for this change is, in the scenario of live-streaming by transcoding from an pre-recorded or delayed source to an HLS or DASH webroot, we can more quickly prime the system of the first few seconds before the real-world read rate is imposed. Else, one must wait for an entire segment length before the data can be fetched from the web server. Signed-off-by: Davy Durham --- doc/ffmpeg.texi | 2 ++ fftools/ffmpeg.h | 2 ++ fftools/ffmpeg_opt.c | 3 +++ 3 files changed, 7 insertions(+) { "target", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_target }, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" " "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" }, diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index d433d60ce9..a519fea192 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1709,6 +1709,8 @@ it may cause packet loss. It is useful for when flow speed of output packets is important, such as live streaming. @item -re (@emph{input}) Read input at native frame rate. This is equivalent to setting @code{-readrate 1}. +@item -irb @var{seconds} +Set an initial read burst time, in seconds, after which any specified readrate will be enforced. @item -vsync @var{parameter} (@emph{global}) @itemx -fps_mode[:@var{stream_specifier}] @var{parameter} (@emph{output,per-stream}) Set video sync method / framerate mode. vsync is applied to all output video streams diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 823218e214..e057e6da3a 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -124,6 +124,7 @@ typedef struct OptionsContext { int loop; int rate_emu; float readrate; + double initial_read_burst; int accurate_seek; int thread_queue_size; int input_sync_ref; @@ -475,6 +476,7 @@ typedef struct InputFile { int rate_emu; float readrate; + double initial_read_burst; int accurate_seek; /* when looping the input file, this queue is used by decoders to report diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 055275d813..6c55b6cb01 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1443,6 +1443,9 @@ const OptionDef options[] = { { "readrate", HAS_ARG | OPT_FLOAT | OPT_OFFSET | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(readrate) }, "read input at specified rate", "speed" }, + { "irb", HAS_ARG | OPT_DOUBLE | OPT_OFFSET | + OPT_EXPERT | OPT_INPUT, { .off = OFFSET(initial_read_burst) }, + "The initial amount of input to burst read before imposing any readrate", "seconds" },