From patchwork Tue Oct 11 15:47:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Eromenko X-Patchwork-Id: 956 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp8411vsd; Tue, 11 Oct 2016 08:47:55 -0700 (PDT) X-Received: by 10.194.146.195 with SMTP id te3mr5955396wjb.51.1476200874935; Tue, 11 Oct 2016 08:47:54 -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 op1si5558835wjc.291.2016.10.11.08.47.53; Tue, 11 Oct 2016 08:47:54 -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=@gmail.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; dmarc=fail (p=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 9741B689A6B; Tue, 11 Oct 2016 18:47:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f48.google.com (mail-it0-f48.google.com [209.85.214.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 219C66898D8 for ; Tue, 11 Oct 2016 18:47:45 +0300 (EEST) Received: by mail-it0-f48.google.com with SMTP id l13so108403998itl.1 for ; Tue, 11 Oct 2016 08:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=WBNjPNhIaLK5HwwL25Z0C8aB5f+z9koVelRiFqlZzMs=; b=Mbcu/SvTQIMLC6JjnUZaZ2lzF2U/7bmDfEpbfoIW1drDln0ocf4Vj3IfhFLzqeSTrd x6yWJWIRtENasDZTHReT38TUht2/BAbLiH6vioBlLscBNDHDdhH3SH+YTfIby6tX+zVh CJ/MC7U4IrIfRlPrdPjBKgsM72/IQG1OrQY0Kxnf8NN/wTU0Utk4shsYCXtijj2Yvjus IbxZd0/qCY11gFh7kNz2oXL0Ti0IhWScfb8wRzLxs1m9YuwalEyxpQlGF914T71PTxP6 DPvf9+EY9aJuC599AmXCd3sQM+Z8ZKhjeZh/jBY518u8Jr/amiJkhj96XgBFZN4gxMr+ oXiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=WBNjPNhIaLK5HwwL25Z0C8aB5f+z9koVelRiFqlZzMs=; b=Q5oRMYgY4lBp2f49BT4JAAmeOtVSRGYECwSS6IAehItH+xTnEghqJzTikOj3dZNete 5xkth40peen3J2kUCpeq6Q0Gg8IKxBIdlUJL6TUwW2c03F7HvtMMOcYCnA0GfYHMCO3+ N/hU7vbe6dktavGQSB3GBuogmxBFVhbvCB4ZQUgwytv/HHZ88fKykCi4va2j51MajKch uzZPDTaG9Q0fO8ju2BTlCIKCM9TLdIRWRsW3vXcpGtjFNGmCM0TVdMaSClVJ+eFoFz9L bNX2t/KPlAT5JNSXQIpjfTa2vdIaYTv5o7GhgnwtuXi5NnmnUJ/qOzdrbomKAGnzYv0c WadQ== X-Gm-Message-State: AA6/9Rm5WYfcPRFv2yoJFAqy+pP7b+PGkqRH7RbkMRJUxId/JJZnnIDCb/NInSdsoVyYHACtbEMwEYdiqmdWhw== X-Received: by 10.36.36.214 with SMTP id f205mr19373887ita.50.1476200863452; Tue, 11 Oct 2016 08:47:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.3.193 with HTTP; Tue, 11 Oct 2016 08:47:23 -0700 (PDT) In-Reply-To: References: <20161011113030.76374-1-josh@itanimul.li> <20161011114930.GB1186@sunshine.barsnick.net> <20161011134956.GB4602@nb4> <20161011152517.GC651@kimiko.pkh.me> From: Alexey Eromenko Date: Tue, 11 Oct 2016 17:47:23 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH] 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" So, in which cases a large timebase would help ? Okay, I have allowed to manually over-ride the auto-detect setting via -video_track_timescale parameter, if someone really knows what he's doing. But the default settings (after my patch) work fine, with Windows Media Player, Quicktime, iTunes and VLC, both for normal input and broken input videos, both in MP4 and MOV output containers. GMail keep wrapping text, but this is the closes I could get: ffmpeg-apple-fix-v3.patch Specify a shorter timebase\n" - "or choose different container.\n"); if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->tag == MKTAG('r','a','w',' ')) { enum AVPixelFormat pix_fmt = track->par->format; if (pix_fmt == AV_PIX_FMT_NONE && track->par->bits_per_coded_sample == 1) pix_fmt = AV_PIX_FMT_MONOWHITE; diff -uNr -U 6 ffmpeg-git-orig/libavformat/movenc.c ffmpeg-git/libavformat/movenc.c --- ffmpeg-git-orig/libavformat/movenc.c 2016-10-11 10:42:02.599749985 -0400 +++ ffmpeg-git/libavformat/movenc.c 2016-10-11 11:10:22.793393487 -0400 @@ -5669,22 +5669,27 @@ track->timescale = mov->video_track_timescale; } else { track->timescale = st->time_base.den; while(track->timescale < 10000) track->timescale *= 2; } + if (track->timescale > 100000 && (!mov->video_track_timescale)) { + unsigned int timescale_new = (unsigned int)((double)(st->time_base.den) + * 1000 / (double)(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 Apple Quicktime. Auto-setting\n" + "a shorter timebase %u instead of %d.\n", timescale_new, track->timescale); + track->timescale = timescale_new; + } 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); + av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", + st->codecpar->width, st->codecpar->height); ret = AVERROR(EINVAL); goto error; } - if (track->mode == MODE_MOV && track->timescale > 100000) - 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.