Search code examples
google-cloud-platformgoogle-cloud-transcoder

Remove the suffix of spriteSheets image name


I have the following job request for Transcoder API

  const request = {
    parent,
    job: {
      inputUri: `gs://${bucket}/${name}`,
      outputUri: `gs://${settings.bucket.cdn}/${fileName}/`,
      config: {
        pubsubDestination: {
          topic: `projects/${settings.project.id}/topics/${settings.pubsub.transcoder}`,
        },
        elementaryStreams: [
          {
            key: 'video-stream',
            videoStream: {
              h265: {
                heightPixels: 1080,
                widthPixels: 1920,
                bitrateBps: 12288000,
                frameRate: 60,
              },
            },
          },
        ],
        muxStreams: [
          {
            key: 'video',
            container: 'mp4',
            elementaryStreams: ['video-stream'],
          },
        ],
        spriteSheets: [
          {
            filePrefix: 'spritesheet',
            quality: 90,
            spriteWidthPixels: 360,
            interval: {
              seconds: 3,
            },
          },
        ],
      },
    },
  } satisfies protos.google.cloud.video.transcoder.v1.ICreateJobRequest

It works.

However, it generates unpredictable filenames, for example prefix spritesheet I get spritesheet0000000000.jpeg

Is it possible to fix the name without those numbers?


Solution

  • For the spritesheet parameter, you can only specify the file_prefix.

    From the documentation:

    Each sprite sheet has an incremental 10-digit zero-padded suffix starting from 0 before the extension, such as sprite_sheet0000000123.jpeg.

    This is done to prevent file name collisions when there are multiple output files.

    You can access files in Google Cloud Storage by using a prefix as shown in the Listing objects documentation.