Issue
What I'm trying to do is simply convert and compress a video file from the storage bucket in node.js using @google-cloud/video-transcoder
(TranscoderServiceClient v1
). Single input file and a single output. The input file may or may not have an audio track. Everything works as expected when the file includes an audio track, but when it doesn't, I'll get an error with code 3:
\atom atom0 does not have any inputs (input0) with an audio track
Only options I can think of currently, are:
- Use
pubsub
to listen for job errors and run failed jobs again, but without the audio stream (got this working). - Use something like
ffprobe
before starting the job to determine if there is an audio track in the file.
However, I would prefer not reading the file twice: once for determining available tracks and then for transcoding. And I wouldn't like to run the job twice. I found nothing in docs about how to only include the audio track if it exists (or replace it with an empty audio track if it does not exist).
Current config:
config: {
elementaryStreams: [
{
key: 'video-stream0',
videoStream: {...},
},
{
key: 'audio-stream0',
audioStream: {...},
},
],
muxStreams: [
{
key: 'hd',
container: 'mp4',
elementaryStreams: ['video-stream0', 'audio-stream0'],
},
],
}
Documentation used:
- Setup - Transcoder API Node.js Client reference (my implementation is near identical with the ad-hoc example in googleapis git)
- Config - JobConfig
- Call options - CallOptions
Update
@Betjens suggested to use CallOptions
to retry the job without pubsub
, but I can't get it to work in node.js. The job does not retry, with or without backOffSettings. The official example for pubsub retry is an example for another API that uses CallOptions, but it does not seem to work in my case.
const callOptions = {
retry: {
retryCodes: [3], // 'INVALID_ARGUMENT', error code if audio missing
backoffSettings: {...}
},
retryRequestOptions: {
request: requestWithoutAudio // request without audio streams to retry
}
}
// Run request
const [response] = await transcoderServiceClient.createJob(request, callOptions);