From patchwork Fri Sep 10 09:34:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 30105 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp1344353iov; Fri, 10 Sep 2021 02:35:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOI+SGdcAu23bSHbqXxQBeOX8+/Yq2TPPiGXHWSn/1BgPe9XchTj1eN7S/BWtuIbaIkDMA X-Received: by 2002:a17:906:180a:: with SMTP id v10mr8637522eje.112.1631266502634; Fri, 10 Sep 2021 02:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631266502; cv=none; d=google.com; s=arc-20160816; b=yJ4wb6asDuWZAJWyl3kvWbsPyVKgYmCEWP8C6Y0tS6TSRSlNnj+KTcLJesC6yP1/Vp Cb6vdnVV1uR3zznbjorEwaiKmlk6HBR1HQb2rrsbVSfWt0WXzk0oR9U6cURX4Oeupcya 7dJCmGKHW/c8nNteD0g2+IwBFbME4+D100Qe6ttOFScx+AwswNCWKikpsR8kP/hgG+mW hI1f5irScQbqD7bjPWLVGqAEaluQq9GsPC7Cj/Q53yQLQRUzH+N14Un1IvhOvoH4vyQD cOfskKeO4uIN2AlGkbPrgj64qGdWFkgU5SJIEQ++kDBA6wn+Lpa9hGfU3FDJzGezONHb ry0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=z3jnhmvxMZBdKCZ1/rCJ8WtFOHSQsFrlYqVSYy3smi8=; b=BkTKo8gMPdNVOQZ+CiSsZYLGC9jwAHOMv2/ZDHAcwOeeNTIHCt5J5+sTw8FbZeA3td NtRW0eWxGXR36wjKoUD6CRC5UkYbdXnS8AYTDZMNrjNEssbwyFQEEk07mkUSb9rheEyp 0onDC91mrVcUp6+Ik69d45W3cTuBmp0aKWrgD7FOFKkDb/2sSyTFtgYHGxIrWANXp8bD 4eHMDAyjKFMV0i5D9ahbjp2VSTHHA6nlrLE9qwUvQQ6HSKVm2zAApWBukdx5ep/qTmxY UjMJrnaFz3S4OU/Jqeu5lE3uBB8XnJZcM9nQVWpW7uWAmu1wBfaYJ54xjf4yWDGLGgmU wJAg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id cc17si4921410edb.406.2021.09.10.02.35.02; Fri, 10 Sep 2021 02:35:02 -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; 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 B977A680157; Fri, 10 Sep 2021 12:34:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from srv-infra-1.infra.inf.glb.tvvideoms.com (www.inf.tvvideoms.com [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7571068A5E4 for ; Fri, 10 Sep 2021 12:34:14 +0300 (EEST) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-1.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id C435F28483; Fri, 10 Sep 2021 09:34:12 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Sep 2021 11:34:08 +0200 Message-Id: <20210910093410.47858-2-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210910093410.47858-1-nicolas.gaullier@cji.paris> References: <20210910093410.47858-1-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/h264_parser: Set AVCodecContext.framerate 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 Cc: Nicolas Gaullier Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: YhIlpOIvLzPG Signed-off-by: Nicolas Gaullier --- libavcodec/h264_parser.c | 11 + tests/ref/fate/h264-lossless | 18 +- tests/ref/fate/h264_mp4toannexb_ticket2991 | 238 ++++++++++----------- 3 files changed, 139 insertions(+), 128 deletions(-) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index cff801f613..bb84cea821 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -247,6 +247,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t * const buf, int buf_size) { H264ParseContext *p = s->priv_data; + H264Context *h = avctx->priv_data; H2645RBSP rbsp = { NULL }; H2645NAL nal = { NULL }; int buf_index, next_avc; @@ -264,6 +265,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, ff_h264_sei_uninit(&p->sei); p->sei.frame_packing.arrangement_cancel_flag = -1; + p->sei.unregistered.x264_build = -1; if (!buf_size) return 0; @@ -551,6 +553,15 @@ static inline int parse_nal_units(AVCodecParserContext *s, p->last_picture_structure = s->picture_structure; p->last_frame_num = p->poc.frame_num; } + if (h && sps->timing_info_present_flag) { + int64_t den = sps->time_scale; + if (p->sei.unregistered.x264_build >= 0) + h->x264_build = p->sei.unregistered.x264_build; + if (h->x264_build < 44U) + den *= 2; + av_reduce(&avctx->framerate.den, &avctx->framerate.num, + sps->num_units_in_tick * avctx->ticks_per_frame, den, 1 << 30); + } av_freep(&rbsp.rbsp_buffer); return 0; /* no need to evaluate the rest */ diff --git a/tests/ref/fate/h264-lossless b/tests/ref/fate/h264-lossless index 9c86db8ccd..7368b18fd4 100644 --- a/tests/ref/fate/h264-lossless +++ b/tests/ref/fate/h264-lossless @@ -4,12 +4,12 @@ #dimensions 0: 640x480 #sar 0: 0/1 0, 0, 0, 1, 460800, 0x7731dd2f -0, 2, 2, 1, 460800, 0x944b8c64 -0, 3, 3, 1, 460800, 0xbe833041 -0, 4, 4, 1, 460800, 0xbe95d96a -0, 5, 5, 1, 460800, 0xfe7ea5e6 -0, 6, 6, 1, 460800, 0x381743c7 -0, 7, 7, 1, 460800, 0x63fcc2e9 -0, 8, 8, 1, 460800, 0x79574960 -0, 9, 9, 1, 460800, 0xdab9e18a -0, 10, 10, 1, 460800, 0xd88e8fe8 +0, 1, 1, 1, 460800, 0x944b8c64 +0, 2, 2, 1, 460800, 0xbe833041 +0, 3, 3, 1, 460800, 0xbe95d96a +0, 4, 4, 1, 460800, 0xfe7ea5e6 +0, 5, 5, 1, 460800, 0x381743c7 +0, 6, 6, 1, 460800, 0x63fcc2e9 +0, 7, 7, 1, 460800, 0x79574960 +0, 8, 8, 1, 460800, 0xdab9e18a +0, 9, 9, 1, 460800, 0xd88e8fe8 diff --git a/tests/ref/fate/h264_mp4toannexb_ticket2991 b/tests/ref/fate/h264_mp4toannexb_ticket2991 index 76bdf3cae7..f8e3e920d4 100644 --- a/tests/ref/fate/h264_mp4toannexb_ticket2991 +++ b/tests/ref/fate/h264_mp4toannexb_ticket2991 @@ -6,122 +6,122 @@ #codec_id 0: h264 #dimensions 0: 1280x720 #sar 0: 3/4 -0, 0, 0, 48000, 37126, 0xb020184c -0, 48000, 48000, 40040, 6920, 0x8512361a, F=0x0 -0, 88040, 88040, 40040, 7550, 0x1bc56ed4, F=0x0 -0, 128081, 128081, 40040, 8752, 0xb8c6f0a1, F=0x0 -0, 168121, 168121, 40040, 13022, 0xe36b6255, F=0x0 -0, 208162, 208162, 40040, 12982, 0x7c993297, F=0x0 -0, 248202, 248202, 40040, 13982, 0x24fe5e0f, F=0x0 -0, 288242, 288242, 40040, 13958, 0x9a22230d, F=0x0 -0, 328283, 328283, 40040, 15346, 0xf0f1a59c, F=0x0 -0, 368323, 368323, 40040, 21016, 0x8d061e7f, F=0x0 -0, 408364, 408364, 40040, 14786, 0x7b1e889d, F=0x0 -0, 448404, 448404, 40040, 11917, 0xf7742a9d, F=0x0 -0, 488444, 488444, 40040, 11234, 0x83cbd9fd, F=0x0 -0, 528485, 528485, 40040, 17616, 0xfdf95104, F=0x0 -0, 568525, 568525, 40040, 10689, 0x9633d32b, F=0x0 -0, 608566, 608566, 40040, 45291, 0x543c2cf6 -0, 648606, 648606, 40040, 20837, 0x051abfab, F=0x0 -0, 688646, 688646, 40040, 21418, 0xe2a59d70, F=0x0 -0, 728687, 728687, 40040, 15643, 0x15cf2cec, F=0x0 -0, 768727, 768727, 40040, 11956, 0x5aef382e, F=0x0 -0, 808768, 808768, 40040, 15393, 0x951dd757, F=0x0 -0, 848808, 848808, 40040, 14839, 0x2d33151c, F=0x0 -0, 888848, 888848, 40040, 14580, 0x2a895aa6, F=0x0 -0, 928889, 928889, 40040, 17571, 0xb3a115f0, F=0x0 -0, 968929, 968929, 40040, 15621, 0x2cc6577d, F=0x0 -0, 1008970, 1008970, 40040, 13653, 0xb6a3ac6e, F=0x0 -0, 1049010, 1049010, 40040, 16274, 0xe8b9b09d, F=0x0 -0, 1089050, 1089050, 40040, 13130, 0xcbb6bb8e, F=0x0 -0, 1129091, 1129091, 40040, 16180, 0x5d188a7a, F=0x0 -0, 1169131, 1169131, 40040, 14961, 0x9ff2f463, F=0x0 -0, 1209172, 1209172, 40040, 54296, 0xe6ec30ed -0, 1249212, 1249212, 40040, 11500, 0x8c4852c9, F=0x0 -0, 1289252, 1289252, 40040, 12065, 0xfb7954c3, F=0x0 -0, 1329293, 1329293, 40040, 12532, 0xf0a935d3, F=0x0 -0, 1369333, 1369333, 40040, 16284, 0xc5c18561, F=0x0 -0, 1409374, 1409374, 40040, 17657, 0x08ce58cc, F=0x0 -0, 1449414, 1449414, 40040, 21336, 0xd0965202, F=0x0 -0, 1489454, 1489454, 40040, 18549, 0x9e9a42ef, F=0x0 -0, 1529495, 1529495, 40040, 14351, 0xa864d2be, F=0x0 -0, 1569535, 1569535, 40040, 15205, 0x5bd7b98e, F=0x0 -0, 1609576, 1609576, 40040, 18040, 0x287af301, F=0x0 -0, 1649616, 1649616, 40040, 15917, 0x2db52580, F=0x0 -0, 1689656, 1689656, 40040, 13250, 0xfed0deb8, F=0x0 -0, 1729697, 1729697, 40040, 13360, 0xbf92d476, F=0x0 -0, 1769737, 1769737, 40040, 11749, 0x3041eaf1, F=0x0 -0, 1809778, 1809778, 40040, 23997, 0xdbe6d5c4 -0, 1849818, 1849818, 40040, 16065, 0xe8f715b7, F=0x0 -0, 1889858, 1889858, 40040, 16441, 0x0a4e060f, F=0x0 -0, 1929899, 1929899, 40040, 17395, 0xa8edecc2, F=0x0 -0, 1969939, 1969939, 40040, 22295, 0xd5173c68, F=0x0 -0, 2009980, 2009980, 40040, 22778, 0xf5e522ce, F=0x0 -0, 2050020, 2050020, 40040, 20590, 0x2fd6b2ca, F=0x0 -0, 2090060, 2090060, 40040, 19937, 0xe109dda5, F=0x0 -0, 2130101, 2130101, 40040, 23833, 0xd12691cb, F=0x0 -0, 2170141, 2170141, 40040, 17969, 0x9baad67a, F=0x0 -0, 2210182, 2210182, 40040, 16645, 0x53fb3099, F=0x0 -0, 2250222, 2250222, 40040, 15307, 0xbc5bac8d, F=0x0 -0, 2290262, 2290262, 40040, 13748, 0xed26aeb4, F=0x0 -0, 2330303, 2330303, 40040, 15092, 0x3c983538, F=0x0 -0, 2370343, 2370343, 40040, 14636, 0x9b278a6c, F=0x0 -0, 2410384, 2410384, 40040, 29134, 0xf784be18 -0, 2450424, 2450424, 40040, 10232, 0x5408e15b, F=0x0 -0, 2490464, 2490464, 40040, 9769, 0xc93cb7f9, F=0x0 -0, 2530505, 2530505, 40040, 14454, 0x45230dbe, F=0x0 -0, 2570545, 2570545, 40040, 14481, 0x4e111562, F=0x0 -0, 2610586, 2610586, 40040, 13439, 0x0e096eeb, F=0x0 -0, 2650626, 2650626, 40040, 13543, 0xc24569d9, F=0x0 -0, 2690666, 2690666, 40040, 16012, 0x81543332, F=0x0 -0, 2730707, 2730707, 40040, 15769, 0x2ddfa189, F=0x0 -0, 2770747, 2770747, 40040, 14208, 0x1379add2, F=0x0 -0, 2810788, 2810788, 40040, 11479, 0xdfc14b55, F=0x0 -0, 2850828, 2850828, 40040, 11130, 0x0ab5959b, F=0x0 -0, 2890868, 2890868, 40040, 14801, 0x40bae016, F=0x0 -0, 2930909, 2930909, 40040, 17303, 0x9ce1fd31, F=0x0 -0, 2970949, 2970949, 40040, 17678, 0x9bd66141, F=0x0 -0, 3010990, 3010990, 40040, 48672, 0x3215ce46 -0, 3051030, 3051030, 40040, 11894, 0x12e1fece, F=0x0 -0, 3091070, 3091070, 40040, 16514, 0xc57aed05, F=0x0 -0, 3131111, 3131111, 40040, 13044, 0x61914fa0, F=0x0 -0, 3171151, 3171151, 40040, 16155, 0xb46c958a, F=0x0 -0, 3211192, 3211192, 40040, 12950, 0xa676f605, F=0x0 -0, 3251232, 3251232, 40040, 17870, 0x7a5aa03a, F=0x0 -0, 3291272, 3291272, 40040, 13192, 0x3c9e9d99, F=0x0 -0, 3331313, 3331313, 40040, 25559, 0x93e0becb, F=0x0 -0, 3371353, 3371353, 40040, 14695, 0x19ace95a, F=0x0 -0, 3411394, 3411394, 40040, 15484, 0x6e3bd0d2, F=0x0 -0, 3451434, 3451434, 40040, 17096, 0x2fd93b48, F=0x0 -0, 3491474, 3491474, 40040, 12208, 0x81a587c0, F=0x0 -0, 3531515, 3531515, 40040, 14709, 0x5dffbe04, F=0x0 -0, 3571555, 3571555, 40040, 14390, 0xbfd1e041, F=0x0 -0, 3611596, 3611596, 40040, 37236, 0xe7f924b1 -0, 3651636, 3651636, 40040, 14056, 0x24714c7c, F=0x0 -0, 3691676, 3691676, 40040, 19438, 0x0c50dcd5, F=0x0 -0, 3731717, 3731717, 40040, 21728, 0x7eea4a11, F=0x0 -0, 3771757, 3771757, 40040, 17966, 0xac7ac988, F=0x0 -0, 3811798, 3811798, 40040, 14868, 0x0eecb1be, F=0x0 -0, 3851838, 3851838, 40040, 15608, 0x1449377e, F=0x0 -0, 3891878, 3891878, 40040, 12484, 0xc9881139, F=0x0 -0, 3931919, 3931919, 40040, 18226, 0xdcda8dfa, F=0x0 -0, 3971959, 3971959, 40040, 19199, 0xe7ea4c92, F=0x0 -0, 4012000, 4012000, 40040, 19042, 0xa5ade66f, F=0x0 -0, 4052040, 4052040, 40040, 15662, 0x19ac319a, F=0x0 -0, 4092080, 4092080, 40040, 16878, 0x98efbae2, F=0x0 -0, 4132121, 4132121, 40040, 14685, 0x1bf78d65, F=0x0 -0, 4172161, 4172161, 40040, 13127, 0x0b91881d, F=0x0 -0, 4212202, 4212202, 40040, 29390, 0xf6a5ed6b -0, 4252242, 4252242, 40040, 12576, 0xe9845ded, F=0x0 -0, 4292282, 4292282, 40040, 12599, 0x96a79ab8, F=0x0 -0, 4332323, 4332323, 40040, 16134, 0xb4c36d3f, F=0x0 -0, 4372363, 4372363, 40040, 15630, 0x33f65a2e, F=0x0 -0, 4412404, 4412404, 40040, 13087, 0xb4b3886d, F=0x0 -0, 4452444, 4452444, 40040, 10728, 0xbffd10fa, F=0x0 -0, 4492484, 4492484, 40040, 10353, 0xccfe3506, F=0x0 -0, 4532525, 4532525, 40040, 9534, 0xd42083f5, F=0x0 -0, 4572565, 4572565, 40040, 12641, 0x93e8abbd, F=0x0 -0, 4612606, 4612606, 40040, 11198, 0x6a9de1fb, F=0x0 -0, 4652646, 4652646, 40040, 15572, 0xd6cb6c4b, F=0x0 -0, 4692686, 4692686, 40040, 12072, 0x8928b77f, F=0x0 -0, 4732727, 4732727, 40040, 19172, 0x549b6b87, F=0x0 +0, 0, 0, 40040, 37126, 0xb020184c +0, 40040, 40040, 40040, 6920, 0x8512361a, F=0x0 +0, 80081, 80081, 40040, 7550, 0x1bc56ed4, F=0x0 +0, 120121, 120121, 40040, 8752, 0xb8c6f0a1, F=0x0 +0, 160162, 160162, 40040, 13022, 0xe36b6255, F=0x0 +0, 200202, 200202, 40040, 12982, 0x7c993297, F=0x0 +0, 240242, 240242, 40040, 13982, 0x24fe5e0f, F=0x0 +0, 280283, 280283, 40040, 13958, 0x9a22230d, F=0x0 +0, 320323, 320323, 40040, 15346, 0xf0f1a59c, F=0x0 +0, 360364, 360364, 40040, 21016, 0x8d061e7f, F=0x0 +0, 400404, 400404, 40040, 14786, 0x7b1e889d, F=0x0 +0, 440444, 440444, 40040, 11917, 0xf7742a9d, F=0x0 +0, 480485, 480485, 40040, 11234, 0x83cbd9fd, F=0x0 +0, 520525, 520525, 40040, 17616, 0xfdf95104, F=0x0 +0, 560566, 560566, 40040, 10689, 0x9633d32b, F=0x0 +0, 600606, 600606, 40040, 45291, 0x543c2cf6 +0, 640646, 640646, 40040, 20837, 0x051abfab, F=0x0 +0, 680687, 680687, 40040, 21418, 0xe2a59d70, F=0x0 +0, 720727, 720727, 40040, 15643, 0x15cf2cec, F=0x0 +0, 760768, 760768, 40040, 11956, 0x5aef382e, F=0x0 +0, 800808, 800808, 40040, 15393, 0x951dd757, F=0x0 +0, 840848, 840848, 40040, 14839, 0x2d33151c, F=0x0 +0, 880889, 880889, 40040, 14580, 0x2a895aa6, F=0x0 +0, 920929, 920929, 40040, 17571, 0xb3a115f0, F=0x0 +0, 960970, 960970, 40040, 15621, 0x2cc6577d, F=0x0 +0, 1001010, 1001010, 40040, 13653, 0xb6a3ac6e, F=0x0 +0, 1041050, 1041050, 40040, 16274, 0xe8b9b09d, F=0x0 +0, 1081091, 1081091, 40040, 13130, 0xcbb6bb8e, F=0x0 +0, 1121131, 1121131, 40040, 16180, 0x5d188a7a, F=0x0 +0, 1161172, 1161172, 40040, 14961, 0x9ff2f463, F=0x0 +0, 1201212, 1201212, 40040, 54296, 0xe6ec30ed +0, 1241252, 1241252, 40040, 11500, 0x8c4852c9, F=0x0 +0, 1281293, 1281293, 40040, 12065, 0xfb7954c3, F=0x0 +0, 1321333, 1321333, 40040, 12532, 0xf0a935d3, F=0x0 +0, 1361374, 1361374, 40040, 16284, 0xc5c18561, F=0x0 +0, 1401414, 1401414, 40040, 17657, 0x08ce58cc, F=0x0 +0, 1441454, 1441454, 40040, 21336, 0xd0965202, F=0x0 +0, 1481495, 1481495, 40040, 18549, 0x9e9a42ef, F=0x0 +0, 1521535, 1521535, 40040, 14351, 0xa864d2be, F=0x0 +0, 1561576, 1561576, 40040, 15205, 0x5bd7b98e, F=0x0 +0, 1601616, 1601616, 40040, 18040, 0x287af301, F=0x0 +0, 1641656, 1641656, 40040, 15917, 0x2db52580, F=0x0 +0, 1681697, 1681697, 40040, 13250, 0xfed0deb8, F=0x0 +0, 1721737, 1721737, 40040, 13360, 0xbf92d476, F=0x0 +0, 1761778, 1761778, 40040, 11749, 0x3041eaf1, F=0x0 +0, 1801818, 1801818, 40040, 23997, 0xdbe6d5c4 +0, 1841858, 1841858, 40040, 16065, 0xe8f715b7, F=0x0 +0, 1881899, 1881899, 40040, 16441, 0x0a4e060f, F=0x0 +0, 1921939, 1921939, 40040, 17395, 0xa8edecc2, F=0x0 +0, 1961980, 1961980, 40040, 22295, 0xd5173c68, F=0x0 +0, 2002020, 2002020, 40040, 22778, 0xf5e522ce, F=0x0 +0, 2042060, 2042060, 40040, 20590, 0x2fd6b2ca, F=0x0 +0, 2082101, 2082101, 40040, 19937, 0xe109dda5, F=0x0 +0, 2122141, 2122141, 40040, 23833, 0xd12691cb, F=0x0 +0, 2162182, 2162182, 40040, 17969, 0x9baad67a, F=0x0 +0, 2202222, 2202222, 40040, 16645, 0x53fb3099, F=0x0 +0, 2242262, 2242262, 40040, 15307, 0xbc5bac8d, F=0x0 +0, 2282303, 2282303, 40040, 13748, 0xed26aeb4, F=0x0 +0, 2322343, 2322343, 40040, 15092, 0x3c983538, F=0x0 +0, 2362384, 2362384, 40040, 14636, 0x9b278a6c, F=0x0 +0, 2402424, 2402424, 40040, 29134, 0xf784be18 +0, 2442464, 2442464, 40040, 10232, 0x5408e15b, F=0x0 +0, 2482505, 2482505, 40040, 9769, 0xc93cb7f9, F=0x0 +0, 2522545, 2522545, 40040, 14454, 0x45230dbe, F=0x0 +0, 2562586, 2562586, 40040, 14481, 0x4e111562, F=0x0 +0, 2602626, 2602626, 40040, 13439, 0x0e096eeb, F=0x0 +0, 2642666, 2642666, 40040, 13543, 0xc24569d9, F=0x0 +0, 2682707, 2682707, 40040, 16012, 0x81543332, F=0x0 +0, 2722747, 2722747, 40040, 15769, 0x2ddfa189, F=0x0 +0, 2762788, 2762788, 40040, 14208, 0x1379add2, F=0x0 +0, 2802828, 2802828, 40040, 11479, 0xdfc14b55, F=0x0 +0, 2842868, 2842868, 40040, 11130, 0x0ab5959b, F=0x0 +0, 2882909, 2882909, 40040, 14801, 0x40bae016, F=0x0 +0, 2922949, 2922949, 40040, 17303, 0x9ce1fd31, F=0x0 +0, 2962990, 2962990, 40040, 17678, 0x9bd66141, F=0x0 +0, 3003030, 3003030, 40040, 48672, 0x3215ce46 +0, 3043070, 3043070, 40040, 11894, 0x12e1fece, F=0x0 +0, 3083111, 3083111, 40040, 16514, 0xc57aed05, F=0x0 +0, 3123151, 3123151, 40040, 13044, 0x61914fa0, F=0x0 +0, 3163192, 3163192, 40040, 16155, 0xb46c958a, F=0x0 +0, 3203232, 3203232, 40040, 12950, 0xa676f605, F=0x0 +0, 3243272, 3243272, 40040, 17870, 0x7a5aa03a, F=0x0 +0, 3283313, 3283313, 40040, 13192, 0x3c9e9d99, F=0x0 +0, 3323353, 3323353, 40040, 25559, 0x93e0becb, F=0x0 +0, 3363394, 3363394, 40040, 14695, 0x19ace95a, F=0x0 +0, 3403434, 3403434, 40040, 15484, 0x6e3bd0d2, F=0x0 +0, 3443474, 3443474, 40040, 17096, 0x2fd93b48, F=0x0 +0, 3483515, 3483515, 40040, 12208, 0x81a587c0, F=0x0 +0, 3523555, 3523555, 40040, 14709, 0x5dffbe04, F=0x0 +0, 3563596, 3563596, 40040, 14390, 0xbfd1e041, F=0x0 +0, 3603636, 3603636, 40040, 37236, 0xe7f924b1 +0, 3643676, 3643676, 40040, 14056, 0x24714c7c, F=0x0 +0, 3683717, 3683717, 40040, 19438, 0x0c50dcd5, F=0x0 +0, 3723757, 3723757, 40040, 21728, 0x7eea4a11, F=0x0 +0, 3763798, 3763798, 40040, 17966, 0xac7ac988, F=0x0 +0, 3803838, 3803838, 40040, 14868, 0x0eecb1be, F=0x0 +0, 3843878, 3843878, 40040, 15608, 0x1449377e, F=0x0 +0, 3883919, 3883919, 40040, 12484, 0xc9881139, F=0x0 +0, 3923959, 3923959, 40040, 18226, 0xdcda8dfa, F=0x0 +0, 3964000, 3964000, 40040, 19199, 0xe7ea4c92, F=0x0 +0, 4004040, 4004040, 40040, 19042, 0xa5ade66f, F=0x0 +0, 4044080, 4044080, 40040, 15662, 0x19ac319a, F=0x0 +0, 4084121, 4084121, 40040, 16878, 0x98efbae2, F=0x0 +0, 4124161, 4124161, 40040, 14685, 0x1bf78d65, F=0x0 +0, 4164202, 4164202, 40040, 13127, 0x0b91881d, F=0x0 +0, 4204242, 4204242, 40040, 29390, 0xf6a5ed6b +0, 4244282, 4244282, 40040, 12576, 0xe9845ded, F=0x0 +0, 4284323, 4284323, 40040, 12599, 0x96a79ab8, F=0x0 +0, 4324363, 4324363, 40040, 16134, 0xb4c36d3f, F=0x0 +0, 4364404, 4364404, 40040, 15630, 0x33f65a2e, F=0x0 +0, 4404444, 4404444, 40040, 13087, 0xb4b3886d, F=0x0 +0, 4444484, 4444484, 40040, 10728, 0xbffd10fa, F=0x0 +0, 4484525, 4484525, 40040, 10353, 0xccfe3506, F=0x0 +0, 4524565, 4524565, 40040, 9534, 0xd42083f5, F=0x0 +0, 4564606, 4564606, 40040, 12641, 0x93e8abbd, F=0x0 +0, 4604646, 4604646, 40040, 11198, 0x6a9de1fb, F=0x0 +0, 4644686, 4644686, 40040, 15572, 0xd6cb6c4b, F=0x0 +0, 4684727, 4684727, 40040, 12072, 0x8928b77f, F=0x0 +0, 4724767, 4724767, 40040, 19172, 0x549b6b87, F=0x0 From patchwork Fri Sep 10 09:34:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 30106 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp1344167iov; Fri, 10 Sep 2021 02:34:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz144YDOrWzfehlgie5R+LMvABXyhvnMHwyy2cBXL+99NtbUc6z5PZaXb4xcyR9hgTmbusU X-Received: by 2002:aa7:c5d4:: with SMTP id h20mr8003412eds.88.1631266484432; Fri, 10 Sep 2021 02:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631266484; cv=none; d=google.com; s=arc-20160816; b=SiL66bPd2JPMOaTKhVUYBpIIe8ZSinF/SMrvrIzCeCBf1FTPQFCaJpKlBJwEPPlgCj n9AjdOH71Jku7SkuN8yuBTap14+k51nmKyMCTOVE5JX+Ar7TMD0ZOpXQhW82SncaWpa/ HOvD75CQ+x6/UIYynBhxS2nSYja99O9r11cYbnFXAtTG2mg/pMxr6S0ZGW2Ec3KXeBpE jUlckD2K3nhjJIf4BZ4JVwRrLhCU8gKA6oFESnjeuL0yjGSQmep9lSChCKqYuRpZ67jD r2L9thXZIBAAWyi093KqTjkdeE6zF1rhs8G62TDDeNklRyX30ulk3+SBHk3++fGYrQye 6ePQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=LUdxQzj7/ET0I+A9/NKMa9zW3YeZspSRvdZN0ESQlZ8=; b=o47kbBTSUimJn696ZF2315Rn8ZFxsLZxPTC6j0UBaEa3tEFurC2eXWaO2zbpWWw52e RlLNJerI7X3/8vm0hreHU6QaG/C2ksioZbig9sQIEY8DsGBDL9RtIwh9oFU8u2J2HH4u 4Kloz8Wdb8E2tpKEtL607YvAq+2AuECayf1OZXP1FJ7Bg+yCSvQt6CnJImK6SsFhHjN2 1mZixP/+6HYFeMfH6IIqed06F3heZQoZScB5PWq1j2FfFoTqTfUTPnlQRTGeN9LXS1uR c7bgQ9EyzFkTgtDS3HjYfzgr9OJP2MGY8gNPn9PY5o/IShSnSPIzeYcgfxvGS/PGlmgh 1KQg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l17si4799177edc.430.2021.09.10.02.34.39; Fri, 10 Sep 2021 02:34:44 -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; 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 AC5AF680A42; Fri, 10 Sep 2021 12:34:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from srv-infra-1.infra.inf.glb.tvvideoms.com (www.inf.tvvideoms.com [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7A3E468A5F8 for ; Fri, 10 Sep 2021 12:34:14 +0300 (EEST) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-1.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id DB0B728357; Fri, 10 Sep 2021 09:34:12 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Sep 2021 11:34:09 +0200 Message-Id: <20210910093410.47858-3-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210910093410.47858-1-nicolas.gaullier@cji.paris> References: <20210910093410.47858-1-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avformat/utils: Use r_frame_rate in compute_frame_duration if codec_framerate is unknown 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 Cc: Nicolas Gaullier Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: QwEHov4tNhuG Signed-off-by: Nicolas Gaullier --- libavformat/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index b56190d2da..6d4a9bc3d6 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -884,7 +884,7 @@ static void compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, *pden = 0; switch (st->codecpar->codec_type) { case AVMEDIA_TYPE_VIDEO: - if (st->r_frame_rate.num && !pc) { + if (st->r_frame_rate.num && (!pc || !codec_framerate.num)) { *pnum = st->r_frame_rate.den; *pden = st->r_frame_rate.num; } else if (st->time_base.num * 1000LL > st->time_base.den) { From patchwork Fri Sep 10 09:34:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 30104 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp1344224iov; Fri, 10 Sep 2021 02:34:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqq513RS7P1nlqZ6J+4L8ZefUZyUbeZvpCwzmk4e5qGqLhIQQ7UbIFKVZtPQzJLkEnPzx2 X-Received: by 2002:a17:906:c252:: with SMTP id bl18mr8143226ejb.519.1631266490700; Fri, 10 Sep 2021 02:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631266490; cv=none; d=google.com; s=arc-20160816; b=dGk+mk2eF/seGUmH8kyTHzwhFpqUZXsVkMqP8lR4kNN5X0fyEkCZcwGswFq9fEDR0B Vt9JAqw14bTehIQitoCzz8386pDFxvcCl+9gogX24gUDiJoF03IIGOOx1OBP2E/T4Bv/ HD01J1Hk9zY+M5/1Ekmrbas9dr9WRLbv8jmgNDFpgimCsBdlkhwnN2nxRjHAHg4tfKsb pucKW0hBGItQ5K7aQSk098GSlr0/RaVCzqgpLp/Ia4Ojt4pZrZC3qQOgXh4cs6GM6kmd 8rkmESwLDoGK/vKgKHC8EWviLJUK0TCcjjToA06O1Qbg0UDNehZUKrL/4gaQ0j2OtPeH XHtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=l0FqLNDWFIZ+T1aiVbYyji7yh/GRpEzowr6B5hICFuU=; b=cfs4xOLY1LJHJ5TlToymXCCYfzUsfZ16uN+uGlAI6FFcVmJvIcZSMm+FKNBIPqV7N2 KhPdlt6Q2SL/TqUgCk3G6aVc9ilOdP4KERWavNriMOUas3NyPANZL+x/IcdO3umnOjS1 WAQ7B8C7kTFd19H03TG1uUXKAxQKncbz1WsPMa0j+SVKcXLRbweFKrqJikpga8yZuY61 xnL6MeSsIBjuLb/Om6duMa6R9IlAdoyiJIQxfQZXHnu1qCann2HOa2o6GgjNtStoY8c2 MUldvsOSishIAbIjQBkM/6Nz7VC/gWMqhEn+iY34WC+MSksEZ8nGSakPv18H+Iucy5mC 265w== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h25si4453373ejt.16.2021.09.10.02.34.50; Fri, 10 Sep 2021 02:34:50 -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; 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 C6D7C68A6A1; Fri, 10 Sep 2021 12:34:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from srv-infra-1.infra.inf.glb.tvvideoms.com (www.inf.tvvideoms.com [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7C88668A604 for ; Fri, 10 Sep 2021 12:34:14 +0300 (EEST) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-1.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id 288A4287A8; Fri, 10 Sep 2021 09:34:13 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Sep 2021 11:34:10 +0200 Message-Id: <20210910093410.47858-4-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210910093410.47858-1-nicolas.gaullier@cji.paris> References: <20210910093410.47858-1-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avformat/mov: Set AVSTREAM_PARSE_HEADERS flag for H264 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 Cc: Nicolas Gaullier Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6TN2WlG+Xwd2 This is required to get the field_order. Signed-off-by: Nicolas Gaullier --- libavformat/mov.c | 2 ++ tests/ref/fate/mov-zombie | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:creation_time=2008-05-12T20:59:27.000000Z|tag:language=eng|tag:handler_name=Apple Video Media Handler|tag:vendor_id=appl|tag:encoder=H.264 side_data|side_data_type=Display Matrix|displaymatrix=\n00000000: 131072 0 0\n00000001: 0 65536 0\n00000002: 0 0 1073741824\n|rotation=0 diff --git a/libavformat/mov.c b/libavformat/mov.c index c5583e07c7..907a0c4cee 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2439,6 +2439,8 @@ static int mov_finalize_stsd_codec(MOVContext *c, AVIOContext *pb, st->internal->need_parsing = AVSTREAM_PARSE_FULL; break; case AV_CODEC_ID_AV1: + /* field_order detection of H264 requires parsing */ + case AV_CODEC_ID_H264: st->internal->need_parsing = AVSTREAM_PARSE_HEADERS; break; default: diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie index 142820dd5b..cb34bd7f5c 100644 --- a/tests/ref/fate/mov-zombie +++ b/tests/ref/fate/mov-zombie @@ -194,5 +194,5 @@ frame|media_type=video|stream_index=0|key_frame=0|pts=188623|pts_time=2.095811|p packet|codec_type=video|stream_index=0|pts=197632|pts_time=2.195911|dts=191625|dts_time=2.129167|duration=3003|duration_time=0.033367|size=580|pos=101820|flags=__ frame|media_type=video|stream_index=0|key_frame=0|pts=191626|pts_time=2.129178|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=191626|best_effort_timestamp_time=2.129178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=99180|pkt_size=1666|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=63|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleftside_data|side_data_type=H.26[45] User Data Unregistered SEI message -stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=1|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|refs=2|is_avc=true|nal_length_size=4|id=0x1|r_frame_rate=30000/1001|avg_frame_rate=6372000/212521|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=2125200|duration=23.613333|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disp osition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:creation_time=2008-05-12T20:59:27.000000Z|tag:language=eng|tag:handler_name=Apple Video Media Handler|tag:vendor_id=appl|tag:encoder=H.264 +stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=1|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=progressive|refs=2|is_avc=true|nal_length_size=4|id=0x1|r_frame_rate=30000/1001|avg_frame_rate=6372000/212521|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=2125200|duration=23.613333|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|