Server 'Trick Play' support for MPEG-2 Transport Stream Files
implementation in the
LIVE555 Streaming Media software
supports RTSP 'trick play' operations
(seeking, fast forward, reverse play)
when streaming some (although not all) types of media file.
For most file types that support trick play operations, no special preprocessing
of the media file is required.
Transport Stream 'index files'
For MPEG-2 Transport Stream files, however, server trick play support
requires that a special 'index file' be created - in advance - for each Transport Stream file.
(This index file is optional; if it's not present, then the Transport Stream file
can still be streamed, but only sequentially - without trick play.)
Each index file references the location of video I-frames (i.e., 'key frames') within its Transport Stream
file. When performing 'fast forward' or 'reverse play', the server uses this information to construct
and stream a new Transport Stream that is made up from I-frames taken from the original stream.
The index files use the file name suffix ".tsx"; for example, if your Transport Stream file is named "foo.ts", then the corresponding index file will be named "foo.tsx".
The LIVE555 Streaming Media software
includes an application - called "MPEG2TransportStreamIndexer", in the "testProgs" directory
- that you can use to generate index files for your Transport Stream files.
This application can be built - along with the rest of the
LIVE555 Streaming Media software - from source code,
(Alternatively, pre-built binary versions of this application are also available for some platforms; they can be downloaded
LIVE555 Media Server web page.)
To generate each index file, run
(Be warned that this program is currently rather slow, so I suggest running it on the fastest computer that you have.)
Once you've generated an index file (".tsx") for each Transport Stream file that you wish to stream, and have stored it
in the same directory as the Transport Stream file (".ts"), then our RTSP server implementation will now handle 'trick mode' operations on the file.
Testing 'trick play' support
We have also provided a demonstration application - called "testMPEG2TransportStreamTrickPlay"
(also distributed as part of the
LIVE555 Streaming Media software, in the "testProgs" directory)
to simulate the effect of fast-forward or reverse-play
'trick play' operations on Transport Stream files. To run it:
testMPEG2TransportStreamTrickPlay <input-transport-stream-file-name> <start-time> <scale> <output-transport-stream-file-name>
Some examples (assume that your original Transport Stream file is named "foo.ts", and that you have already generated an index file, named "foo.tsx"):
- <input-transport-stream-file-name> is the original Transport Stream file name (which must end with ".ts"). There must also be a corresponding index file for this file.
- <start-time> is the starting play time in seconds (use 0 to play from the start)
- <scale> is a non-zero integer, representing the playing speed (use a negative number for reverse play)
testMPEG2TransportStreamTrickPlay foo.ts 0 8 foo8.ts
The output file "foo8.ts" is the original stream, sped up 8x
testMPEG2TransportStreamTrickPlay foo.ts 30 -1 foo-1.ts
The output file "foo-1.ts" is the original stream, played backwards (at 1x speed), starting from the 30 second point.
testMPEG2TransportStreamTrickPlay foo.ts 30 -5 foo-5.ts
The output file "foo-5.ts" is the original stream, played backwards (at 5x speed), starting from the 30 second point.
Live Networks, Inc. (LIVE555.COM)