From patchwork Mon May 4 16:24:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vectronic X-Patchwork-Id: 19493 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 B149B44A6F1 for ; Mon, 4 May 2020 19:29:55 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8707668BC9B; Mon, 4 May 2020 19:29:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 031D268BC7A for ; Mon, 4 May 2020 19:29:49 +0300 (EEST) Received: by mail-wm1-f68.google.com with SMTP id x4so187840wmj.1 for ; Mon, 04 May 2020 09:29:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T3WWVgZXdooDUYjWTYh79S7Y2YKZNfUZVA3nbYP9i4U=; b=L3JMKXMrvQ+O0b+RjxfJEa2rFICdc2dQrKN5qHOB9I0Bi8lND2QCg9pt5LggLUrcwV EwoBz0RannsIhUwOUjW2DSzsvH3fnf95xRwUxZCqd9Ov6R90VTUSSYqit1KaeWch+xne rXK980WQOKLBZ+iUTtMz60K7nnlz9o5wHTa+FaAye+gIvQIykBsJ4HiSSldDL+kadOsR LveOrEuy8hrjcWDNJlRfX+JfUxGQnuNLJggfBLZsd7Iys8eRYDRSdufIb7b17vnzm1tL +zTm7pyCyu/3ZwiWJh+XBJKlieiTz3ADbk7IioVdmWwgWdOk/gr0W4Fs9aozoBZwaXbB abig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T3WWVgZXdooDUYjWTYh79S7Y2YKZNfUZVA3nbYP9i4U=; b=IJlnZ06+WhZha+yZuXxDmfFMSC1kTjtMi4ZFWGZTBfJMtBk9bANUSF2YHwAfSpgw1L /tpH5m/cWzR1r/x/aPdLh8svInToYVR3slIq/oPLPnAywuE205o2YiiEvLOwweqOL0kO 51FHD5/o9rYEGFTnPpVpUtzBYuSiIDAH7Mi5E5U7rZfyLYnNAhCbquCUiOGsvX57qFFR VKiWWcKzE5dmUikZtAcMjjBj1Lbf9paettZ1gR8onAX9PBDSqYj/WRJ8VhGytbQ8hwjm y65rQttJXszKRptJB6mJ6NiuXLA73Y2WHzbA+QGRtTc1O8ooM96UMqkbNU3s7f2iQnJt b+Mw== X-Gm-Message-State: AGi0PuZV1BKTih4tNH6kXL3CZfYtIZ8EPiFojmSAFt84kYjuCFZteP7v W55piCKrV+PHljIHD6T43sccvO1CQP4= X-Google-Smtp-Source: APiQypKuTMrH9cujguhh2W5XfBBRutuQbRQs5RW2q8wZS+rocuPXJVMgxxV8ckadYQnUN7ExspPChA== X-Received: by 2002:a1c:dc55:: with SMTP id t82mr16569634wmg.12.1588609475679; Mon, 04 May 2020 09:24:35 -0700 (PDT) Received: from mechagodzilla.chapatronic.net (cpc76904-dals22-2-0-cust471.20-2.cable.virginm.net. [81.106.45.216]) by smtp.gmail.com with ESMTPSA id q184sm14733085wma.25.2020.05.04.09.24.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2020 09:24:35 -0700 (PDT) From: vectronic To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 May 2020 17:24:27 +0100 Message-Id: <20200504162428.85535-2-hello.vectronic@gmail.com> X-Mailer: git-send-email 2.24.2 (Apple Git-127) In-Reply-To: <20200504162428.85535-1-hello.vectronic@gmail.com> References: <20200504162428.85535-1-hello.vectronic@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avformat movenc add flag to disable silent limit on timescale 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 Cc: vectronic Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Add a flag to allow user to disable the forcing of a track timescale to be greater than 10000. Log a debug message if the timescale is forced to be greater than 10000. Signed-off-by: vectronic --- libavformat/movenc.c | 4 ++++ libavformat/movenc.h | 1 + 2 files changed, 5 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 32e8109268..143b00063d 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -107,6 +107,7 @@ static const AVOption options[] = { { "wallclock", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_WALLCLOCK}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"}, { "pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_PTS}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"}, { "empty_hdlr_name", "write zero-length name string in hdlr atoms within mdia and minf atoms", offsetof(MOVMuxContext, empty_hdlr_name), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, + { "allow_small_timescale", "Do not force track timescale to be >= 10000", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_ALLOW_SMALL_TSCALE}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { NULL }, }; @@ -6460,8 +6461,11 @@ static int mov_init(AVFormatContext *s) av_log(s, AV_LOG_WARNING, "Warning: some tools, like mp4split, assume a timescale of 10000000 for ISMV.\n"); } else { track->timescale = st->time_base.den; + if (!(mov->flags & FF_MOV_FLAG_ALLOW_SMALL_TSCALE)) { while(track->timescale < 10000) track->timescale *= 2; + av_log(s, AV_LOG_DEBUG, "track timescale was less than 10000, it has been forced to %d\n", track->timescale); + } } if (st->codecpar->width > 65535 || st->codecpar->height > 65535) { av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", st->codecpar->width, st->codecpar->height); diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 997b2d61c0..f91cd3420f 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -261,6 +261,7 @@ typedef struct MOVMuxContext { #define FF_MOV_FLAG_SKIP_SIDX (1 << 21) #define FF_MOV_FLAG_CMAF (1 << 22) #define FF_MOV_FLAG_PREFER_ICC (1 << 23) +#define FF_MOV_FLAG_ALLOW_SMALL_TSCALE (1 << 24) int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);