customData schema

Create Encoding says customData is of type string, but it seems that customData accepts arbitary JSON object.
Getting customData by JS SDK interpret such data as JSON object as we expect.

Is this usage expected or am I relying undocumented behavior?

Add Stream conditions property type does not seems to be of string, but be of { type: string, attribute: string, operator: string, value: any }.
So I would like to make sure that whether there exists such mix-up also for customData.

Hi Kinjo-san,

Thank you for your active participation in the community!

Regarding your question:

  • Yes, the customData field in the Create Encoding API can hold the data as a JSON object. You can use this field to signal your specific data for each encoding.

  • On the other hand, the conditions field in the Add Stream API is for a different purpose. This field allows you to add conditional logic to your encoding configuration, enabling your workflow to automatically adapt to different types of input files and streams.

For example, if your input file contains only video, adding the following condition to the audio stream will skip audio processing when there are no audio streams (“AUDIOSTREAMCOUNT > 0”). This approach is efficient for managing both standard input files (with video and audio) and video-only input files using the same script. You can use the Condition and ConditionOperator classes to set up the logic. The more example can be found in here Stream Conditions

function createAudioStream(
  : 
  const condition = new Condition({
    attribute: "AUDIOSTREAMCOUNT",
    operator: ConditionOperator.GREATER_THAN,
    value: "0"
  });

  const stream = new Stream({
    inputStreams: [streamInput],
    codecConfigId: codecConfiguration.id,
    conditions: condition
  });

  return bitmovinApi.encoding.encodings.streams.create(encoding.id!, stream);
}

Please let us know if you have any question. Thank you.

Best Regards,
Kazuhide

Thank you for your reply.

I understand customData and conditions have different purpose.

The doc says both properties are of string type.
What I would like to make clear is that whether doc is correct about type.

From what you explained, I understand the doc is wrong.

Hi Kinjo-san,

Thank you for your feedback.

I agree that the document can be misleading. I’ll provide your feedback internally to consider it for future improvements.

The discrepancy might also be due to differences between the REST API and OpenAPI-based SDK clients. The documentation covers the REST API specifications, while each SDK is an autogenerated client based on the REST API definition. When using an SDK, we need to write the application code by adhering to each language’s API.

For example, the JavaScript SDK can be referenced as open-source at bitmovin-api-sdk-javascript. If you have any questions about the types of each SDK API parameter, referring to the SDK’s repository can be also benefitial to understand each API parameter, which I hope will be useful to you.

Best Regards,
Kazuhide

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.