This topic provides answers to frequently asked questions about taking snapshots in ApsaraVideo Media Processing (MPS).

  • The number of output snapshots is different from the specified number of snapshots that are to be taken for I frames in the input video.
    Possible causes:
    • The number of I frames in the input video is smaller than the number of snapshots to be taken. In this case, the number of output snapshots is smaller than specified.
    • The Group of Pictures (GOP) size of the input video is not fixed, and I frames are unevenly distributed in the input video. If you do not specify an interval for taking snapshots of a video, the interval is by default calculated by dividing the total length of the video by the number of snapshots to be taken. If I frames are unevenly distributed in a video, an interval may have two I frames or no I frame. In this case, the number of output snapshots may be different from that specified.
  • How do I set the mode of a snapshot job to synchronous or asynchronous?

    If you set the Interval or Num parameter for a snapshot job, the job is in asynchronous mode. Whether the piplineId parameter is set does not determine the mode of a snapshot job.

  • How does MPS work if the frame at a specified point in time for snapshot taking is not a keyframe?

    A snapshot is taken for the keyframe that is nearest to the specified point in time. If multiple snapshots need to be taken and no keyframe exists near a specified point in time for snapshot taking, no snapshot is taken for the point in time. In this case, the number of output snapshots may be different from that specified.

  • The point in time specified for snapshot taking is beyond the input video duration.
    • Take a single snapshot
      • The snapshot job fails if the snapshot is to be taken for a normal frame.
      • The image of the keyframe that is nearest to the specified point in time for snapshot taking is returned.
    • Take multiple snapshots

      If the result of the following formula is greater than the length of the input video, no more snapshots are taken, and the snapshots that have been taken are returned: Point in time for taking a snapshot + Interval for taking snapshots × Number of snapshots to be taken.

  • Snapshots for an M3U8 index file

    For a snapshot job in synchronous mode, the TS files in an M3U8 index file must be stored in the same directory as the M3U8 index file. A snapshot job in asynchronous mode does not need to meet this requirement.

  • The number of snapshots taken at intervals is smaller than specified.

    A possible cause is that no keyframe exists near a specified point in time for snapshot taking or that a specified point in time for snapshot taking is beyond the input video duration.

  • Settings of the snapshot size
    1. You can configure the width and height for output snapshots.
    2. If you do not configure the width or height for output snapshots, the resolution of the input video is used.
    3. If you configure only the width or height for output snapshots, the snapshots are scaled based on the aspect ratio of the input video.
  • Troubleshoot errors reported in snapshot jobs
    Error codes that may be returned in snapshot jobs include SnapshotTimeOut, InvalidParameter.ResourceNotFound, and InvalidParameter.ResourceContentBad.
    1. Obtain error codes

      If a snapshot job fails, you can call the QuerySnapshotJobList operation to obtain the cause of failure.

    2. Common error codes and causes
      1. InvalidParameter.ResourceNotFound: the error code returned because the input file cannot be found. Make sure that the input file is stored in an Object Storage Service (OSS) bucket of the specified region. Data in a region is independent of that in another region.
      2. SnapshotTimeOut: the error code returned because a snapshot job in synchronous mode times out. The timeout period for a snapshot job in synchronous mode is 6 seconds. If a snapshot job in synchronous mode frequently times out, we recommend that you set the relevant parameters to submit the snapshot job in asynchronous mode instead of retrying.
      3. InvalidParameter.ResourceContentBad: the error code returned because the input file content has been damaged or the snapshot configurations do not meet specifications. Make sure that the input file content is normal and that the snapshot configurations meet specifications. You can refer to this topic to check the configurations, especially the points in time for snapshot taking and keyframes.