diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-06-10 14:21:42 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-07-23 11:53:19 +0200 |
commit | 4740fea7ddf5f81577c9f5a0c096a8a16a54716e (patch) | |
tree | a1a5d74dc843e94bf0193116a4db8f24431b5a2c /tests/ref | |
parent | 9ac78fb347e26270ebaf5ed41e55d34065853583 (diff) | |
download | ffmpeg-4740fea7ddf5f81577c9f5a0c096a8a16a54716e.tar.gz |
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.
Diffstat (limited to 'tests/ref')
-rw-r--r-- | tests/ref/fate/copy-shortest1 | 1 | ||||
-rw-r--r-- | tests/ref/fate/copy-shortest2 | 1 | ||||
-rw-r--r-- | tests/ref/fate/shortest-sub | 4 |
3 files changed, 2 insertions, 4 deletions
diff --git a/tests/ref/fate/copy-shortest1 b/tests/ref/fate/copy-shortest1 index 5038973e4e..87bee4c41f 100644 --- a/tests/ref/fate/copy-shortest1 +++ b/tests/ref/fate/copy-shortest1 @@ -120,4 +120,3 @@ 0, 98304, 98304, 2048, 11182, e35a2ab846029effdbca0e43639717f2 1, 85760, 85760, 1536, 418, cf52ea7fc69e4c5bc8f75b354dfe60af 0, 100352, 100352, 2048, 1423, f480272c7d0b97834bc8ea36cceca61d -1, 87296, 87296, 1536, 418, 78ab22657a1b6c8a0e5b8612ceb8081d diff --git a/tests/ref/fate/copy-shortest2 b/tests/ref/fate/copy-shortest2 index 5038973e4e..87bee4c41f 100644 --- a/tests/ref/fate/copy-shortest2 +++ b/tests/ref/fate/copy-shortest2 @@ -120,4 +120,3 @@ 0, 98304, 98304, 2048, 11182, e35a2ab846029effdbca0e43639717f2 1, 85760, 85760, 1536, 418, cf52ea7fc69e4c5bc8f75b354dfe60af 0, 100352, 100352, 2048, 1423, f480272c7d0b97834bc8ea36cceca61d -1, 87296, 87296, 1536, 418, 78ab22657a1b6c8a0e5b8612ceb8081d diff --git a/tests/ref/fate/shortest-sub b/tests/ref/fate/shortest-sub index be0922fd56..0da4ba2e95 100644 --- a/tests/ref/fate/shortest-sub +++ b/tests/ref/fate/shortest-sub @@ -1,4 +1,4 @@ 145b9b48d56f9c966bf41657f7569954 *tests/data/fate/shortest-sub.matroska 139232 tests/data/fate/shortest-sub.matroska -d71f5d359ef788ea689415bc1e4a90df *tests/data/fate/shortest-sub.out.framecrc -stddev:11541.12 PSNR: 15.08 MAXDIFF:22854 bytes: 2591/ 26055 +876ac3fa52e467050ab843969d4cf343 *tests/data/fate/shortest-sub.out.framecrc +stddev:11541.12 PSNR: 15.08 MAXDIFF:22854 bytes: 2591/ 23735 |