Reputation: 111
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:
pubsub
to listen for job errors and run failed jobs again, but without the audio stream (got this working).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:
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);
Upvotes: 8
Views: 1245
Reputation: 1401
I will post this to recap what I have found of your case. And the suggest the actions based on the comment exchange.
Configuration tips:
In you configuration you are making reference of 'video-stream1'
muxStreams: [
{
key: 'hd',
container: 'mp4',
elementaryStreams: ['video-stream1', 'audio-stream0'],
},
],
which do not exist in your elementaryStreams
elementaryStreams: [
{
key: 'video-stream0',
videoStream: {...},
},
{
key: 'audio-stream0',
audioStream: {...},
},
],
Retry tips:
Node.js
I have not see this kind of implementation as described on transcoderserviceclient.google.api.retry
] on the client.Python Sample (from Google API Retry)
@retry.Retry(predicate=if_exception_type(exceptions.NotFound))
def check_if_exists():
return client.does_thing_exist()
is_available = check_if_exists()
** update 05/09: I have refreshed my answer with the latest updates.
retries helpful links:
Summarize:
Upvotes: 2