Video processing

更新时间:
复制 MD 格式

In on-demand video/audio streaming scenarios, the video processing feature of ESA provides a seamless playback experience by identifying the nearest previous keyframe to the requested playback position and loading the corresponding video segment.

Prerequisites

  • The origin server supports HTTP Range requests.

  • The query string is set to Retain All.

Add a video processing rule

  1. In the ESA console, choose Websites and click the target site in the Website column.

  2. In the navigation pane on the left, choose Rules > Content Optimization.

  3. Select the Video Processing tab, click Create Rule, and then enter a Rule Name.

  4. In the If requests match... area, set the conditions for matching user requests. For more information about how to configure rules, see Composition of rule expressions.

  5. In the Video Seeking area, click Configure, turn on the Status switch, and then configure the parameters.

    image

    For example, if a URL request for an FLV file is www.aliyun.com/test.flv?start=10, the server returns data starting from the keyframe that precedes the 10th byte. The following table describes the file and URL formats that the video seeking feature supports.

    File format

    Meta information

    Parameters

    Example

    MP4

    The meta information of the source video must be in the file header. Videos with meta information at the end of the file are not supported.

    The start parameter specifies the time in seconds. It supports up to three decimal places. For example, start=1.01 indicates that playback starts at 1.01 seconds.

    • If the time specified by start is not a keyframe, ESA automatically locates the previous keyframe.

    • If the time specified by start is a keyframe, ESA automatically locates the current keyframe.

    Custom MP4 Parameters notes:

    1. The start parameter is start by default, and the end parameter is end by default.

    2. Custom parameters can contain only uppercase letters, lowercase letters, digits, and underscores (_). For example: 123, aabbAABB, and aa_BB123.

    A URL request is domain/video.mp4?start=10, which indicates that the video playback starts from the 10th second.

    FLV

    The source video must contain meta information.

    The start parameter specifies the byte. Decimals are not supported. Although you can specify a decimal in the parameter, the video seeking module rounds it down to a positive integer.

    FLV Seeking By Time: The unit for the start and end parameters is seconds.

    Seeking By Byte: Seeking by byte is suitable for precise data processing or processing raw video data. Seeking by second provides a user-friendly experience by directly jumping to the requested second.

    • If the time specified by start is not a keyframe, ESA automatically locates the previous keyframe.

    • If the time specified by start is a keyframe, ESA automatically locates the current keyframe.

    Notes On Custom Parameters For Video Seeking:

    1. The start parameter is start by default, and the end parameter is end by default.

    2. Custom parameters can contain only uppercase letters, lowercase letters, digits, and underscores (_). For example: 123, aabbAABB, and aa_BB123.

    A URL request is domain/video.flv?start=10, which indicates that the video playback starts from the keyframe before the 10th byte.

Handling drag-and-drop parameters

For example, when seeking by time, the default video seeking parameters are start and end. The following tables describe the processing logic for parameter values in different scenarios:

MP4 file requests

start/end value

Example

Handling Drag-and-Drop

Invalid start and invalid end

start=foo&end=bar

Ignores the video seeking parameters and responds with the complete video.

Valid start and invalid end

start=10

Drag-and-drop processing time for 10 files.

Invalid start and valid end

end=10

Processes video seeking from 0-10.

Valid start and valid end

start=0&end=10

Processes video seeking from 0-10.

start and end are both 0

start=0&end=0

Ignores the video seeking parameters and responds with the complete video.

start is greater than end

start=10&end=0

Drag-and-drop processing time for 10 files.

start is equal to end

start=10&end=10

Drag-and-drop processing: 10-file processing time.

start is greater than the video duration

start is greater than the video duration

Returns 400.

FLV file requests

start/end value

Example

Drag-and-drop handling logic

Invalid start and invalid end

start=foo&end=bar

Ignores the video seeking parameters and responds with the complete video.

Valid start and invalid end

start=10

Drag-and-drop processing: Duration for 10 files.

Invalid start and valid end

end=10

Processes video seeking from 0-10.

Valid start and valid end

start=0&end=10

You can process the range 0-10 by dragging and dropping.

start and end are both 0

start=0&end=0

Ignores the video seeking parameters and responds with the complete video.

start is greater than end

start=10&end=0

You can drag and drop a file with a length of 10 to process it.

start is equal to end

start=10&end=10

Handles drag-and-drop operations for 10 files.

start is greater than the video duration

start is greater than the video duration

Returns the complete video.

References

Rule-related features vary in execution priorityrule behavior, and configuration scope. For more information, see How ESA rules take effect.