Skip to content
Products

Get Preview MP4 from Archive with API

When Save Preview is enabled in the Storage settings, Alta saves short preview clips in MP4 format for the recorded archive. This article describes how to list the preview files of a channel and download them with curl.

  • The channel has a Storage assigned and the storage has Save Preview enabled.
  • The channel uses H.264 or H.265 video.
  • Requests go to the API Server (default port 8100), not to the OTT Server. Read more HTTP Server.
  • The API requires HTTP Basic authentication with a user of the Alta web interface. Read more Users.

Both requests use the id parameter with the channel path in the format <channel_name>/<variant>, for example discovery/hd.

URL:

Terminal window
GET /api/ott/channel/storage/preview?id=<channel_name>/<variant>

or with the optional parameter:

Terminal window
GET /api/ott/channel/storage/preview?id=<channel_name>/<variant>&start=<time>
  • id: Channel path.
  • start (optional): Unix timestamp. Returns files from this time onward.

Alta does not support the end parameter. To limit the result by the end time, filter the list on the client side.

Example:

Terminal window
curl -sS -u 'USER:PASSWORD' \
'http://alta.example.com:8100/api/ott/channel/storage/preview?id=discovery/hd&start=1747485787'

Response:

["1747485787.mp4", "1747485797.mp4", "1747485807.mp4"]

The response is a JSON array of file names. The name of each file is the Unix timestamp of the segment start.

URL:

Terminal window
GET /api/ott/channel/storage/preview?id=<channel_name>/<variant>&name=<file>
  • id: Channel path.
  • name: File name from the list, for example 1747485787.mp4.

Example:

Terminal window
curl -sS -f -u 'USER:PASSWORD' \
-o preview.mp4 \
'http://alta.example.com:8100/api/ott/channel/storage/preview?id=discovery/hd&name=1747485787.mp4'

The response body is the MP4 file. Option -f makes curl fail on HTTP errors instead of saving the error page into the file.

CodeDescription
200Success
404No preview files found for the channel or time range, or the file does not exist
  • Check that Save Preview is enabled in the storage and the channel is recording.
  • Check the channel path. It must include the variant, for example discovery/hd.
  • Remove the start parameter or decrease its value. Preview files are available only for the archive duration of the storage.

Check that you use the port of the API Server, not the OTT Server. Test the connection:

Terminal window
curl -v http://alta.example.com:8100/