diff --git a/libavformat/utils.c b/libavformat/utils.c index a5310383c8..09c85a2e5f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2993,6 +2993,7 @@ void ff_rfps_calculate(AVFormatContext *ic) && tb_unreliable(st->codec)) { int num = 0; double best_error= 0.01; + AVRational ref_rate = st->r_frame_rate.num ? st->r_frame_rate : av_inv_q(st->time_base); for (j= 0; jr_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate))) + if (num && (!ref_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(ref_rate))) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX); } diff --git a/tests/ref/fate/vcr2 b/tests/ref/fate/vcr2 index ab70d29db9..521e55fd04 100644 --- a/tests/ref/fate/vcr2 +++ b/tests/ref/fate/vcr2 @@ -1,158 +1,158 @@ -#tb 0: 12/539 +#tb 0: 16701/250000 0, 0, 0, 1, 38016, 0x50e93e0d -0, 3, 3, 1, 38016, 0x6ac8627d -0, 6, 6, 1, 38016, 0x6f38661e -0, 9, 9, 1, 38016, 0x18bb3e23 -0, 12, 12, 1, 38016, 0x2029f4da -0, 15, 15, 1, 38016, 0xa981eeb9 -0, 18, 18, 1, 38016, 0x65c636ef -0, 21, 21, 1, 38016, 0x8218f178 -0, 24, 24, 1, 38016, 0xc3986e18 -0, 27, 27, 1, 38016, 0xac871f50 -0, 30, 30, 1, 38016, 0xe83ed617 -0, 33, 33, 1, 38016, 0xe87c4132 -0, 36, 36, 1, 38016, 0x9e03c321 -0, 39, 39, 1, 38016, 0x81f06a6e -0, 42, 42, 1, 38016, 0x4ce15039 -0, 45, 45, 1, 38016, 0x398dfbdd -0, 48, 48, 1, 38016, 0x3049218c -0, 51, 51, 1, 38016, 0x6d90bb3f -0, 54, 54, 1, 38016, 0x5b61ae57 -0, 57, 57, 1, 38016, 0xaf17011d -0, 60, 60, 1, 38016, 0xb6c13da6 -0, 63, 63, 1, 38016, 0xb58135cf -0, 66, 66, 1, 38016, 0x051c33ce -0, 69, 69, 1, 38016, 0xda950393 -0, 72, 72, 1, 38016, 0x76f7ea61 -0, 75, 75, 1, 38016, 0xcba6f5c8 -0, 78, 78, 1, 38016, 0x2ac20405 -0, 81, 81, 1, 38016, 0x6c790a1b -0, 84, 84, 1, 38016, 0x8525413b -0, 87, 87, 1, 38016, 0xef2e46a5 -0, 90, 90, 1, 38016, 0x32c16c28 -0, 93, 93, 1, 38016, 0x9fb0755f -0, 96, 96, 1, 38016, 0xdfd7a1e2 -0, 99, 99, 1, 38016, 0xa91eb2d0 -0, 102, 102, 1, 38016, 0xb7bed869 -0, 105, 105, 1, 38016, 0x0263da70 -0, 108, 108, 1, 38016, 0x1403cf83 -0, 111, 111, 1, 38016, 0xb766f81a -0, 114, 114, 1, 38016, 0x85abd4e0 -0, 117, 117, 1, 38016, 0xfc30c171 -0, 120, 120, 1, 38016, 0xb53bb9e5 -0, 123, 123, 1, 38016, 0xe93ca93c -0, 126, 126, 1, 38016, 0xfa9db507 -0, 129, 129, 1, 38016, 0xd4da8492 -0, 132, 132, 1, 38016, 0x951cb041 -0, 135, 135, 1, 38016, 0x64fb9a09 -0, 138, 138, 1, 38016, 0x8f89b841 -0, 141, 141, 1, 38016, 0x9ee4b6df -0, 144, 144, 1, 38016, 0xd733ae27 -0, 147, 147, 1, 38016, 0x2a1ab87d -0, 150, 150, 1, 38016, 0x4853bf88 -0, 153, 153, 1, 38016, 0x701da865 -0, 156, 156, 1, 38016, 0x074d8248 -0, 159, 159, 1, 38016, 0xa1b4b019 -0, 162, 162, 1, 38016, 0x33f798c7 -0, 165, 165, 1, 38016, 0x5091bd66 -0, 168, 168, 1, 38016, 0x9dc0bf08 -0, 171, 171, 1, 38016, 0x83cff4c3 -0, 174, 174, 1, 38016, 0xce551295 -0, 177, 177, 1, 38016, 0x3c334a45 -0, 180, 180, 1, 38016, 0xd6e669ae -0, 183, 183, 1, 38016, 0x08817cb0 -0, 186, 186, 1, 38016, 0x3d399508 -0, 189, 189, 1, 38016, 0xaf49a306 -0, 192, 192, 1, 38016, 0x6b77e02c -0, 195, 195, 1, 38016, 0x34a6cc72 -0, 198, 198, 1, 38016, 0x0303e6bb -0, 201, 201, 1, 38016, 0x3995eee2 -0, 204, 204, 1, 38016, 0x8eefd136 -0, 207, 207, 1, 38016, 0xd69ad171 -0, 210, 210, 1, 38016, 0xed98bff6 -0, 213, 213, 1, 38016, 0x606ba5ef -0, 216, 216, 1, 38016, 0xbce4afaa -0, 219, 219, 1, 38016, 0xa5baac40 -0, 222, 222, 1, 38016, 0x7a15929f -0, 225, 225, 1, 38016, 0x0374cdec -0, 228, 228, 1, 38016, 0xf482e941 -0, 231, 231, 1, 38016, 0xced1c9e3 -0, 234, 234, 1, 38016, 0x638fd91f -0, 237, 237, 1, 38016, 0xced5d802 -0, 240, 240, 1, 38016, 0x330adeeb -0, 243, 243, 1, 38016, 0x7a70f93e -0, 246, 246, 1, 38016, 0x25c0dac1 -0, 249, 249, 1, 38016, 0x6f9401cf -0, 252, 252, 1, 38016, 0x01632a5b -0, 255, 255, 1, 38016, 0x6eedd857 -0, 258, 258, 1, 38016, 0xcfad1017 -0, 261, 261, 1, 38016, 0x38071e53 -0, 264, 264, 1, 38016, 0xc7c3013f -0, 267, 267, 1, 38016, 0x1f41fe19 -0, 270, 270, 1, 38016, 0x9662e170 -0, 273, 273, 1, 38016, 0xec19ecfc -0, 276, 276, 1, 38016, 0xab419765 -0, 279, 279, 1, 38016, 0xe784d98b -0, 282, 282, 1, 38016, 0x93c1a4bf -0, 285, 285, 1, 38016, 0xf2e4c9b4 -0, 288, 288, 1, 38016, 0x7cb6c1ff -0, 291, 291, 1, 38016, 0x6fb36837 -0, 294, 294, 1, 38016, 0x6fb64665 -0, 297, 297, 1, 38016, 0xf24eaba9 -0, 300, 300, 1, 38016, 0x3866d28b -0, 303, 303, 1, 38016, 0x807e829c -0, 306, 306, 1, 38016, 0xf25fcbbb -0, 309, 309, 1, 38016, 0xc28ba68f -0, 312, 312, 1, 38016, 0x65ef8def -0, 315, 315, 1, 38016, 0xc4646ee4 -0, 318, 318, 1, 38016, 0x3cb76962 -0, 321, 321, 1, 38016, 0xe5500136 -0, 324, 324, 1, 38016, 0xb086aa05 -0, 327, 327, 1, 38016, 0xde9fd4c3 -0, 330, 330, 1, 38016, 0xcae0d11b -0, 333, 333, 1, 38016, 0x6cd3ee1a -0, 336, 336, 1, 38016, 0x38981b85 -0, 339, 339, 1, 38016, 0xbe742f68 -0, 342, 342, 1, 38016, 0x29c41fc7 -0, 345, 345, 1, 38016, 0x43612eaf -0, 348, 348, 1, 38016, 0x199dba2f -0, 351, 351, 1, 38016, 0xb434f64d -0, 354, 354, 1, 38016, 0x36f2fd8c -0, 357, 357, 1, 38016, 0xc1075321 -0, 360, 360, 1, 38016, 0x7eabeab8 -0, 363, 363, 1, 38016, 0x7fcd5127 -0, 366, 366, 1, 38016, 0x37ddb544 -0, 369, 369, 1, 38016, 0x5dee2700 -0, 372, 372, 1, 38016, 0x46deb355 -0, 375, 375, 1, 38016, 0xb2496a7c -0, 378, 378, 1, 38016, 0xfaf3b134 -0, 381, 381, 1, 38016, 0x42e9dbe1 -0, 384, 384, 1, 38016, 0x699fc6e0 -0, 387, 387, 1, 38016, 0x43ba68ae -0, 390, 390, 1, 38016, 0xffd21579 -0, 393, 393, 1, 38016, 0xdd979741 -0, 396, 396, 1, 38016, 0x789c89aa -0, 399, 399, 1, 38016, 0x40be024e -0, 402, 402, 1, 38016, 0xa60c291d -0, 405, 405, 1, 38016, 0xa8d253e9 -0, 408, 408, 1, 38016, 0x16d7f60e -0, 411, 411, 1, 38016, 0xf1d21a57 -0, 414, 414, 1, 38016, 0x5e80e3bd -0, 417, 417, 1, 38016, 0xceec0529 -0, 420, 420, 1, 38016, 0x1ff9c462 -0, 423, 423, 1, 38016, 0x51c168d2 -0, 426, 426, 1, 38016, 0xf61f2059 -0, 429, 429, 1, 38016, 0xb22fa794 -0, 432, 432, 1, 38016, 0xb81ec7d5 -0, 435, 435, 1, 38016, 0x7555d1df -0, 438, 438, 1, 38016, 0x860d9de3 -0, 441, 441, 1, 38016, 0x9b19a66f -0, 444, 444, 1, 38016, 0xec52d405 -0, 447, 447, 1, 38016, 0x2da4d05b -0, 450, 450, 1, 38016, 0xf15bf060 -0, 453, 453, 1, 38016, 0xfabcc24a -0, 456, 456, 1, 38016, 0xc159f63a -0, 459, 459, 1, 38016, 0x0b97fcc1 -0, 462, 462, 1, 38016, 0xe0c063a2 -0, 465, 465, 1, 38016, 0x7bda9bec -0, 468, 468, 1, 38016, 0xbe99a923 +0, 1, 1, 1, 38016, 0x6ac8627d +0, 2, 2, 1, 38016, 0x6f38661e +0, 3, 3, 1, 38016, 0x18bb3e23 +0, 4, 4, 1, 38016, 0x2029f4da +0, 5, 5, 1, 38016, 0xa981eeb9 +0, 6, 6, 1, 38016, 0x65c636ef +0, 7, 7, 1, 38016, 0x8218f178 +0, 8, 8, 1, 38016, 0xc3986e18 +0, 9, 9, 1, 38016, 0xac871f50 +0, 10, 10, 1, 38016, 0xe83ed617 +0, 11, 11, 1, 38016, 0xe87c4132 +0, 12, 12, 1, 38016, 0x9e03c321 +0, 13, 13, 1, 38016, 0x81f06a6e +0, 14, 14, 1, 38016, 0x4ce15039 +0, 15, 15, 1, 38016, 0x398dfbdd +0, 16, 16, 1, 38016, 0x3049218c +0, 17, 17, 1, 38016, 0x6d90bb3f +0, 18, 18, 1, 38016, 0x5b61ae57 +0, 19, 19, 1, 38016, 0xaf17011d +0, 20, 20, 1, 38016, 0xb6c13da6 +0, 21, 21, 1, 38016, 0xb58135cf +0, 22, 22, 1, 38016, 0x051c33ce +0, 23, 23, 1, 38016, 0xda950393 +0, 24, 24, 1, 38016, 0x76f7ea61 +0, 25, 25, 1, 38016, 0xcba6f5c8 +0, 26, 26, 1, 38016, 0x2ac20405 +0, 27, 27, 1, 38016, 0x6c790a1b +0, 28, 28, 1, 38016, 0x8525413b +0, 29, 29, 1, 38016, 0xef2e46a5 +0, 30, 30, 1, 38016, 0x32c16c28 +0, 31, 31, 1, 38016, 0x9fb0755f +0, 32, 32, 1, 38016, 0xdfd7a1e2 +0, 33, 33, 1, 38016, 0xa91eb2d0 +0, 34, 34, 1, 38016, 0xb7bed869 +0, 35, 35, 1, 38016, 0x0263da70 +0, 36, 36, 1, 38016, 0x1403cf83 +0, 37, 37, 1, 38016, 0xb766f81a +0, 38, 38, 1, 38016, 0x85abd4e0 +0, 39, 39, 1, 38016, 0xfc30c171 +0, 40, 40, 1, 38016, 0xb53bb9e5 +0, 41, 41, 1, 38016, 0xe93ca93c +0, 42, 42, 1, 38016, 0xfa9db507 +0, 43, 43, 1, 38016, 0xd4da8492 +0, 44, 44, 1, 38016, 0x951cb041 +0, 45, 45, 1, 38016, 0x64fb9a09 +0, 46, 46, 1, 38016, 0x8f89b841 +0, 47, 47, 1, 38016, 0x9ee4b6df +0, 48, 48, 1, 38016, 0xd733ae27 +0, 49, 49, 1, 38016, 0x2a1ab87d +0, 50, 50, 1, 38016, 0x4853bf88 +0, 51, 51, 1, 38016, 0x701da865 +0, 52, 52, 1, 38016, 0x074d8248 +0, 53, 53, 1, 38016, 0xa1b4b019 +0, 54, 54, 1, 38016, 0x33f798c7 +0, 55, 55, 1, 38016, 0x5091bd66 +0, 56, 56, 1, 38016, 0x9dc0bf08 +0, 57, 57, 1, 38016, 0x83cff4c3 +0, 58, 58, 1, 38016, 0xce551295 +0, 59, 59, 1, 38016, 0x3c334a45 +0, 60, 60, 1, 38016, 0xd6e669ae +0, 61, 61, 1, 38016, 0x08817cb0 +0, 62, 62, 1, 38016, 0x3d399508 +0, 63, 63, 1, 38016, 0xaf49a306 +0, 64, 64, 1, 38016, 0x6b77e02c +0, 65, 65, 1, 38016, 0x34a6cc72 +0, 66, 66, 1, 38016, 0x0303e6bb +0, 67, 67, 1, 38016, 0x3995eee2 +0, 68, 68, 1, 38016, 0x8eefd136 +0, 69, 69, 1, 38016, 0xd69ad171 +0, 70, 70, 1, 38016, 0xed98bff6 +0, 71, 71, 1, 38016, 0x606ba5ef +0, 72, 72, 1, 38016, 0xbce4afaa +0, 73, 73, 1, 38016, 0xa5baac40 +0, 74, 74, 1, 38016, 0x7a15929f +0, 75, 75, 1, 38016, 0x0374cdec +0, 76, 76, 1, 38016, 0xf482e941 +0, 77, 77, 1, 38016, 0xced1c9e3 +0, 78, 78, 1, 38016, 0x638fd91f +0, 79, 79, 1, 38016, 0xced5d802 +0, 80, 80, 1, 38016, 0x330adeeb +0, 81, 81, 1, 38016, 0x7a70f93e +0, 82, 82, 1, 38016, 0x25c0dac1 +0, 83, 83, 1, 38016, 0x6f9401cf +0, 84, 84, 1, 38016, 0x01632a5b +0, 85, 85, 1, 38016, 0x6eedd857 +0, 86, 86, 1, 38016, 0xcfad1017 +0, 87, 87, 1, 38016, 0x38071e53 +0, 88, 88, 1, 38016, 0xc7c3013f +0, 89, 89, 1, 38016, 0x1f41fe19 +0, 90, 90, 1, 38016, 0x9662e170 +0, 91, 91, 1, 38016, 0xec19ecfc +0, 92, 92, 1, 38016, 0xab419765 +0, 93, 93, 1, 38016, 0xe784d98b +0, 94, 94, 1, 38016, 0x93c1a4bf +0, 95, 95, 1, 38016, 0xf2e4c9b4 +0, 96, 96, 1, 38016, 0x7cb6c1ff +0, 97, 97, 1, 38016, 0x6fb36837 +0, 98, 98, 1, 38016, 0x6fb64665 +0, 99, 99, 1, 38016, 0xf24eaba9 +0, 100, 100, 1, 38016, 0x3866d28b +0, 101, 101, 1, 38016, 0x807e829c +0, 102, 102, 1, 38016, 0xf25fcbbb +0, 103, 103, 1, 38016, 0xc28ba68f +0, 104, 104, 1, 38016, 0x65ef8def +0, 105, 105, 1, 38016, 0xc4646ee4 +0, 106, 106, 1, 38016, 0x3cb76962 +0, 107, 107, 1, 38016, 0xe5500136 +0, 108, 108, 1, 38016, 0xb086aa05 +0, 109, 109, 1, 38016, 0xde9fd4c3 +0, 110, 110, 1, 38016, 0xcae0d11b +0, 111, 111, 1, 38016, 0x6cd3ee1a +0, 112, 112, 1, 38016, 0x38981b85 +0, 113, 113, 1, 38016, 0xbe742f68 +0, 114, 114, 1, 38016, 0x29c41fc7 +0, 115, 115, 1, 38016, 0x43612eaf +0, 116, 116, 1, 38016, 0x199dba2f +0, 117, 117, 1, 38016, 0xb434f64d +0, 118, 118, 1, 38016, 0x36f2fd8c +0, 119, 119, 1, 38016, 0xc1075321 +0, 120, 120, 1, 38016, 0x7eabeab8 +0, 121, 121, 1, 38016, 0x7fcd5127 +0, 122, 122, 1, 38016, 0x37ddb544 +0, 123, 123, 1, 38016, 0x5dee2700 +0, 124, 124, 1, 38016, 0x46deb355 +0, 125, 125, 1, 38016, 0xb2496a7c +0, 126, 126, 1, 38016, 0xfaf3b134 +0, 127, 127, 1, 38016, 0x42e9dbe1 +0, 128, 128, 1, 38016, 0x699fc6e0 +0, 129, 129, 1, 38016, 0x43ba68ae +0, 130, 130, 1, 38016, 0xffd21579 +0, 131, 131, 1, 38016, 0xdd979741 +0, 132, 132, 1, 38016, 0x789c89aa +0, 133, 133, 1, 38016, 0x40be024e +0, 134, 134, 1, 38016, 0xa60c291d +0, 135, 135, 1, 38016, 0xa8d253e9 +0, 136, 136, 1, 38016, 0x16d7f60e +0, 137, 137, 1, 38016, 0xf1d21a57 +0, 138, 138, 1, 38016, 0x5e80e3bd +0, 139, 139, 1, 38016, 0xceec0529 +0, 140, 140, 1, 38016, 0x1ff9c462 +0, 141, 141, 1, 38016, 0x51c168d2 +0, 142, 142, 1, 38016, 0xf61f2059 +0, 143, 143, 1, 38016, 0xb22fa794 +0, 144, 144, 1, 38016, 0xb81ec7d5 +0, 145, 145, 1, 38016, 0x7555d1df +0, 146, 146, 1, 38016, 0x860d9de3 +0, 147, 147, 1, 38016, 0x9b19a66f +0, 148, 148, 1, 38016, 0xec52d405 +0, 149, 149, 1, 38016, 0x2da4d05b +0, 150, 150, 1, 38016, 0xf15bf060 +0, 151, 151, 1, 38016, 0xfabcc24a +0, 152, 152, 1, 38016, 0xc159f63a +0, 153, 153, 1, 38016, 0x0b97fcc1 +0, 154, 154, 1, 38016, 0xe0c063a2 +0, 155, 155, 1, 38016, 0x7bda9bec +0, 156, 156, 1, 38016, 0xbe99a923