1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00
FFmpeg/tests/ref/fate/copy-shortest1
Anton Khirnov 4740fea7dd fftools/ffmpeg: rework -shortest implementation
The -shortest option (which finishes the output file at the time the
shortest stream ends) is currently implemented by faking the -t option
when an output stream ends. This approach is fragile, since it depends
on the frames/packets being processed in a specific order. E.g. there
are currently some situations in which the output file length will
depend unpredictably on unrelated factors like encoder delay. More
importantly, the present work aiming at splitting various ffmpeg
components into different threads will make this approach completely
unworkable, since the frames/packets will arrive in effectively random
order.

This commit introduces a "sync queue", which is essentially a collection
of FIFOs, one per stream. Frames/packets are submitted to these FIFOs
and are then released for further processing (encoding or muxing) when
it is ensured that the frame in question will not cause its stream to
get ahead of the other streams (the logic is similar to libavformat's
interleaving queue).

These sync queues are then used for encoding and/or muxing when the
-shortest option is specified.

A new option – -shortest_buf_duration – controls the maximum number of
queued packets, to avoid runaway memory usage.

This commit changes the results of the following tests:
- copy-shortest[12]: the last audio frame is now gone. This is
  correct, since it actually outlasts the last video frame.
- shortest-sub: the video packets following the last subtitle packet are
  now gone. This is also correct.
2022-07-23 11:53:19 +02:00

123 lines
8.7 KiB
Plaintext

#format: frame checksums
#version: 2
#hash: MD5
#extradata 0, 30, 0e11a510b0c7831954402f81dd258188
#tb 0: 1/51200
#media_type 0: video
#codec_id 0: mpeg4
#dimensions 0: 352x288
#sar 0: 1/1
#tb 1: 1/44100
#media_type 1: audio
#codec_id 1: ac3
#sample_rate 1: 44100
#channel_layout_name 1: mono
#stream#, dts, pts, duration, size, hash
1, -256, -256, 1536, 416, e3bd415f62aa927e9273151fdf21ebce
0, 0, 0, 2048, 8719, bbea2a7487d61d39a0b2f2fe62a4df4a
1, 1280, 1280, 1536, 418, 6e79527e2af3448d7a0e4a8e29cd9722
0, 2048, 2048, 2048, 975, 94f30e410595452ee981d96224516504
1, 2816, 2816, 1536, 418, cf49595ac385e497672e5a814f7bcd79
0, 4096, 4096, 2048, 1167, d3b895191e8a06d19bbc8ac90e564b3b
1, 4352, 4352, 1536, 418, 846982243d330ab782f0120988d52ade
0, 6144, 6144, 2048, 1274, 272f548f13dd6a45a5cd187f0e43e635
1, 5888, 5888, 1536, 418, 77b2d15948434a4831e30c47b8214591
0, 8192, 8192, 2048, 1361, a0c67fc195fe867ae240dc8c48f85b2e
1, 7424, 7424, 1536, 418, 4fce87d5cce10f6d0268fb398c385af5
0, 10240, 10240, 2048, 1415, f7a3746adb348eb00042b3eccff54a87
1, 8960, 8960, 1536, 418, 963f2dac9af4672809521f2174b78f10
1, 10496, 10496, 1536, 418, eb7a20193c157b02f7b5d5abf802af24
0, 12288, 12288, 2048, 1421, 8396b1c23f7d39f6f73c3469826317d6
1, 12032, 12032, 1536, 418, 219b234a1e01d3538bfe09fda58b3289
0, 14336, 14336, 2048, 1474, a9c493c020d710af7f2c98b9aae846ff
1, 13568, 13568, 1536, 418, ef7bd3e9c13f03aa6676629101a9a8a0
0, 16384, 16384, 2048, 1467, b801d1a76c84923ab813e9a5d9ebdb78
1, 15104, 15104, 1536, 418, c5dda974df7e418d9036dff134aad2ae
0, 18432, 18432, 2048, 1469, 22f7fcd055bf124436de9a9432f7c9d2
1, 16640, 16640, 1536, 418, 48e7a9f574654dd95a325cfec5072254
0, 20480, 20480, 2048, 1506, da18f30d7008f2307ec51863a9873afd
1, 18176, 18176, 1536, 418, 737d867e328377a3e6623f77f646ea61
0, 22528, 22528, 2048, 1520, 2c7d44ca3485373af6cfb3e44e495bf7
1, 19712, 19712, 1536, 418, 5e2a004ad90ba069cecd9fdc1652388c
0, 24576, 24576, 2048, 8524, 0634c69955cbffe94f4e15b288557cac
1, 21248, 21248, 1536, 418, c694e51e609bdd00749a04294cbd60fb
1, 22784, 22784, 1536, 418, 6b787ffae0063d9910deebc8b3e98fd4
0, 26624, 26624, 2048, 1079, f081cbd559dab2b579f40d2fa988a959
1, 24320, 24320, 1536, 418, eb6d62198a5472a1c179d42cde60b869
0, 28672, 28672, 2048, 1343, fdf8069cd511f4fa185748118acfb72e
1, 25856, 25856, 1536, 418, 70a6c8e61e8d75f7a310bc7294ad38f6
0, 30720, 30720, 2048, 1486, e72dfcd069f5be3a30310002b1b5e252
1, 27392, 27392, 1536, 418, 6847924a11575b3628ccdfd81a2fb1dc
0, 32768, 32768, 2048, 1491, 710c5421d44a8c9356c1477cbcd27c0e
1, 28928, 28928, 1536, 418, 6f76bbe03d8b4e0080226247e0e54f96
0, 34816, 34816, 2048, 1504, 16a6d624b8175f1191ede25e2d588b92
1, 30464, 30464, 1536, 418, c946a8d690aa31fde929678b594cc432
0, 36864, 36864, 2048, 1481, 8696aa412629328687bda5e88dd40b81
1, 32000, 32000, 1536, 418, 3add3833b86a38c229faf8e602f83dcb
0, 38912, 38912, 2048, 1521, 3c974bf799b8e35d295c6567ffeb7276
1, 33536, 33536, 1536, 418, cb51e6a41f5c4a5f01dd94f58210112b
1, 35072, 35072, 1536, 418, 66c3570cb8c11386b0601fe4a6eb7ee0
0, 40960, 40960, 2048, 1514, 1a54ec5296f1551a7f67c515e40ca646
1, 36608, 36608, 1536, 418, 8b986c15b9ab86432c43cedd1a182e8d
0, 43008, 43008, 2048, 1562, d285916a1c7a2fb9f37d18bfa977e075
1, 38144, 38144, 1536, 418, 0dd29cc7f63f2afac3eec5e5944165e7
0, 45056, 45056, 2048, 1562, 320c26adae1dad1741e02febdbd5b916
1, 39680, 39680, 1536, 418, c4c14deb03d5048f8c6101260c617fae
0, 47104, 47104, 2048, 1629, 60c6ebd71f641ebcff9997ee338d82bf
1, 41216, 41216, 1536, 418, 4a3480d888fa0dd49a7bbf2669b5d3ed
0, 49152, 49152, 2048, 9634, b72deda826b002179c46789e92c07978
1, 42752, 42752, 1536, 418, aaeabe149b9185a6f09c271eb2c656dd
0, 51200, 51200, 2048, 1239, 407105508656c920761e60c90540ee18
1, 44288, 44288, 1536, 418, 0995488ad1bb84ec4a3e738b568484a4
1, 45824, 45824, 1536, 418, baa39bdfd9f47f7d312312985f59fb72
0, 53248, 53248, 2048, 1568, 1e5b232eaf9f35846ae25b881f658e5c
1, 47360, 47360, 1536, 418, c25bac736a8c356d0a0f9c9299f88880
0, 55296, 55296, 2048, 1641, f79725e348ed7796f2be7c153ce32580
1, 48896, 48896, 1536, 418, 85378fd6c8b49a1f4c5490ab1e4013ca
0, 57344, 57344, 2048, 1735, ae14fbdbf8777d88077818db0ae346b3
1, 50432, 50432, 1536, 418, 528e28031145f07336cd2a1b9b324ca6
0, 59392, 59392, 2048, 1760, e943dc0f9ed56fbca1af43c3c3c6dea1
1, 51968, 51968, 1536, 418, cc9b907fc92fffc61f7e41cdb863d586
0, 61440, 61440, 2048, 1798, efb1c91f9aee5c84c92e8cd5a5b58783
1, 53504, 53504, 1536, 418, fe2f2ca279b14d7053349111578b48c0
0, 63488, 63488, 2048, 1830, 7aa74080b344e63280854570f701e2b8
1, 55040, 55040, 1536, 418, 5f2c6037aa4b89572a4ed712082ae2ab
0, 65536, 65536, 2048, 1835, 566fa13f73b9aa63eed50511b112b191
1, 56576, 56576, 1536, 418, 17a096694df972c2ef3a9abbe0a9cd6a
1, 58112, 58112, 1536, 418, c96a64bbfd1aae269e44bfdaea7c8a9c
0, 67584, 67584, 2048, 1902, 95933f1710291419d0febd37d5878362
1, 59648, 59648, 1536, 418, 5f9297244e107134c49fc4982f5a7c1f
0, 69632, 69632, 2048, 1886, 5a8e4c7557ec0d09d40fbfabc5b92e63
1, 61184, 61184, 1536, 418, da740d2d75b51d6e28bcb068f6a90d41
0, 71680, 71680, 2048, 1949, 3f81e2b8821c22f89501feafebb9d618
1, 62720, 62720, 1536, 418, 76e6bbbbfa0692659d0d84a30dcfff34
0, 73728, 73728, 2048, 10776, 29e4a6fdc625965feae7faa8ab239db1
1, 64256, 64256, 1536, 418, 0bd304182f1693b18c46b0faa682b159
0, 75776, 75776, 2048, 1413, 4b5bde19c84eca2c776f6ac45163a0a5
1, 65792, 65792, 1536, 418, ecf7bd4ba9161338ce2cefc1fdd06098
0, 77824, 77824, 2048, 1731, 7f46b3e146e52fd500dbf53a3c744662
1, 67328, 67328, 1536, 418, 4953c0e441ca0ca2e1970b8b31d6c70e
0, 79872, 79872, 2048, 1888, 2bd4182a0fe98db2990c8e39c0500872
1, 68864, 68864, 1536, 418, 4eb7f24aa46b8f0e6b47d0ca6ec0d56d
1, 70400, 70400, 1536, 418, df4d73a6acccd3be6663188f4baab996
0, 81920, 81920, 2048, 1989, f3bf07391ef46cba98eb78fdc3707fa3
1, 71936, 71936, 1536, 418, 5e60f266106b86f19749b64d86b11f43
0, 83968, 83968, 2048, 1949, 0650751332acc5d5f96f292ffc4add21
1, 73472, 73472, 1536, 418, cedea148c5f7ddba6f0fbcbe17e6bfbb
0, 86016, 86016, 2048, 1956, d52d57b697f4ec90bb1f69fd7ece1952
1, 75008, 75008, 1536, 416, 97655498b413a59b3f0f6bdc25f69084
0, 88064, 88064, 2048, 2012, e25c0bb0ec726fe5c9ade88cf7ae9a19
1, 76544, 76544, 1536, 418, 0bea3f23db7aafefe50710310af25a9b
0, 90112, 90112, 2048, 1995, eb0377542bc15580ef8f772ce6f506bd
1, 78080, 78080, 1536, 418, e763b383810d9a4645901c0d93f98a32
0, 92160, 92160, 2048, 2078, 7aa93cd366118984932da377f4743de6
1, 79616, 79616, 1536, 418, f090bb15688066a9c5129348f86245e7
0, 94208, 94208, 2048, 2116, 9d8c672e97c27ed4e3281bb10481914a
1, 81152, 81152, 1536, 418, beb8658ede31b44326de936b28a2d740
1, 82688, 82688, 1536, 418, 53987c0214550f387ce03093b83f4225
0, 96256, 96256, 2048, 2024, 18d42dbec2fa24fd30374d79a054cd4f
1, 84224, 84224, 1536, 418, d3c37c202144070892528cc0a0ff3112
0, 98304, 98304, 2048, 11182, e35a2ab846029effdbca0e43639717f2
1, 85760, 85760, 1536, 418, cf52ea7fc69e4c5bc8f75b354dfe60af
0, 100352, 100352, 2048, 1423, f480272c7d0b97834bc8ea36cceca61d