From patchwork Tue Oct 11 19:06:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Dekker X-Patchwork-Id: 961 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp59311vsd; Tue, 11 Oct 2016 12:06:55 -0700 (PDT) X-Received: by 10.28.91.83 with SMTP id p80mr205644wmb.53.1476212815205; Tue, 11 Oct 2016 12:06:55 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i4si227302wmh.73.2016.10.11.12.06.54; Tue, 11 Oct 2016 12:06:55 -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=@itanimul.li; dkim=neutral (body hash did not verify) header.i=@messagingengine.com; 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 1E331689B51; Tue, 11 Oct 2016 22:06:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 30B41687EEB for ; Tue, 11 Oct 2016 22:06:46 +0300 (EEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 303DA20757 for ; Tue, 11 Oct 2016 15:06:45 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Tue, 11 Oct 2016 15:06:45 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=itanimul.li; h= date:from:in-reply-to:message-id:references:subject:to :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=v5cTaxAMHS3fayrNMo1r6AltwwU =; b=n2SLWAHKyylUR/CiYb0HWJ/d6yONU2WCgCEikWiYNWmZyC/bNDiebAys9RK 8rE8gJCmlgvA49DGr9Lz7EG91f+NHY1L1b5+nchP65MYcKxLrBB9h9oW4mJWWpuP geeBcu45EfHdNyY8vSeonEe3um6U6pIgfg9N95mxuBp42Wh0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:in-reply-to:message-id :references:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=v5cT axAMHS3fayrNMo1r6AltwwU=; b=loCNURnM1qnBQkRLzfLJgqoKWo+R6ZNPVS0n e3XIDBx6XjAdPeXBUQzsu5na5L2pR/6E/aqAMEtLN0MDGP2F9IkC8C9z9/fxesmF L2P1K1KXGXJpaXRnWAaujzyHo9Wy9Ch8My4go40he9b+FE0nnlxsVo2KN/ikkjSE HqcnaZQ= X-Sasl-enc: sKopW+lwT5d5Y0CYZ5qEFBWVgDxxbhaLzUAHwi+yPUWL 1476212804 Received: from localhost (cpc75394-sotn16-2-0-cust168.15-1.cable.virginm.net [82.22.8.169]) by mail.messagingengine.com (Postfix) with ESMTPA id B7520F29CE for ; Tue, 11 Oct 2016 15:06:44 -0400 (EDT) From: Josh de Kock To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Oct 2016 20:06:39 +0100 Message-Id: <20161011190639.79085-1-josh@itanimul.li> X-Mailer: git-send-email 2.8.4 (Apple Git-73) In-Reply-To: <20161011114930.GB1186@sunshine.barsnick.net> References: <20161011114930.GB1186@sunshine.barsnick.net> Subject: [FFmpeg-devel] [PATCH v2] lavf/movenc: suggest video_track_timescale for invalid 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes ticket #5882. While it doesn't automatically set the timescale for the user as that would destroy data without prompt, it will tell the user how they could set the timescale (as this is mostly likely what they want). Signed-off-by: Josh de Kock --- >Would it be useful to print the max duration? I'm not entirely sure, open to suggestions though. libavformat/movenc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index d7c7158..6bada25 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5677,11 +5677,16 @@ static int mov_write_header(AVFormatContext *s) ret = AVERROR(EINVAL); goto error; } - if (track->mode == MODE_MOV && track->timescale > 100000) + if (track->mode == MODE_MOV && track->timescale > 100000) { + /* NOTE: forcing setting the suggested timescale manually means ffmpeg won't destroy + * timestamps without explicit instruction. */ + unsigned int suggested = (unsigned int)av_rescale(st->time_base.den, 1000, st->time_base.num); av_log(s, AV_LOG_WARNING, "WARNING codec timebase is very high. If duration is too long,\n" "file may not be playable by quicktime. Specify a shorter timebase\n" - "or choose different container.\n"); + "or choose different container. Using -video_track_timescale %d\n" + "may fix this issue.\n", suggested); + } if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->tag == MKTAG('r','a','w',' ')) {