From ffa9aaa2e458dcac3658a16c4d1fb14755de0ebd Mon Sep 17 00:00:00 2001 From: Mohammad AlSaleh Date: Mon, 17 Aug 2020 00:46:13 +0300 Subject: stream: Implement slice:// for reading slices of streams Add support for reading a byte range from a stream via the `slice://` protocol. Syntax is `slice://start[-end]@URL` where end is a maximum (read until end or eof). Size suffixes support in `m_option` is reused so they can be used with start/end. This can be very useful with e.g. large MPEGTS streams with corruption or time-stamp jumps or other issues in them. Signed-off-by: Mohammad AlSaleh --- DOCS/man/mpv.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'DOCS') diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst index b5739d7707..dc61394ff7 100644 --- a/DOCS/man/mpv.rst +++ b/DOCS/man/mpv.rst @@ -1194,6 +1194,27 @@ PROTOCOLS Stitch together parts of multiple files and play them. +``slice://start[-end]@URL`` + + Read a slice of a stream. + + ``start`` and ``end`` represent a byte range and accept + suffixes such as ``KiB`` and ``MiB``. ``end`` is optional. + + Only works with seekable streams. + + Examples:: + + mpv slice://1g-2g@cap.ts + + This starts reading from cap.ts after seeking 1 GiB, then + reads until reaching 2 GiB or end of file. + + mpv slice://100m@appending://cap.ts + + This starts reading from cap.ts after seeking 100MiB, then + reads until end of file. + ``null://`` Simulate an empty file. If opened for writing, it will discard all data. -- cgit v1.2.3