我在向 Google Speech To Text 发出请求时遇到错误。
我不知道原因,你能帮我解决吗?
错误内容
3 INVALID_ARGUMENT: Invalid recognition 'config': bad encoding.. - {"trace":"Error: 3 INVALID_ARGUMENT: Invalid recognition 'config': bad encoding..\n at Object.callErrorFromStatus (/home/e-rex-api/node_modules/@grpc/grpc-js/build/src/call.js:31:26)\n at Object.onReceiveStatus (/home/e-rex-api/node_modules/@grpc/grpc-js/build/src/client.js:176:52)\n at Object.onReceiveStatus (/home/e-rex-api/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:342:141)\n at Object.onReceiveStatus (/home/e-rex-api/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:305:181)\n at Http2CallStream.outputStatus (/home/e-rex-api/node_modules/@grpc/grpc-js/build/src/call-stream.js:117:74)\n at Http2CallStream.maybeOutputStatus (/home/e-rex-api/node_modules/@grpc/grpc-js/build/src/call-stream.js:156:22)\n at Http2CallStream.endCall (/home/e-rex-api/node_modules/@grpc/grpc-js/build/src/call-stream.js:142:18)\n at Http2CallStream.handleTrailers (/home/e-rex-api/node_modules/@grpc/grpc-js/build/src/call-stream.js:274:14)\n at ClientHttp2Stream.emit (events.js:315:20)\n at ClientHttp2Stream.EventEmitter.emit (domain.js:483:12)"}
使用的音频元数据
我正在使用 ffmpeg。
{
index: 0,
codec_name: 'mp3',
codec_long_name: 'MP3 (MPEG audio layer 3)',
profile: 'unknown',
codec_type: 'audio',
codec_time_base: '1/44100',
codec_tag_string: '[0][0][0][0]',
codec_tag: '0x0000',
sample_fmt: 's16p',
sample_rate: 44100,
channels: 2,
channel_layout: 'stereo',
bits_per_sample: 0,
id: 'N/A',
r_frame_rate: '0/0',
avg_frame_rate: '0/0',
time_base: '1/14112000',
start_pts: 0,
start_time: 0,
duration_ts: 81289912788,
duration: 5760.339625,
bit_rate: 192000,
max_bit_rate: 'N/A',
bits_per_raw_sample: 'N/A',
nb_frames: 'N/A',
nb_read_frames: 'N/A',
nb_read_packets: 'N/A',
disposition: {
default: 0,
dub: 0,
original: 0,
comment: 0,
lyrics: 0,
karaoke: 0,
forced: 0,
hearing_impaired: 0,
visual_impaired: 0,
clean_effects: 0,
attached_pic: 0,
timed_thumbnails: 0
}
}
请求中发送的设置
{
languageCode: 'ja-JP',
enableWordTimeOffsets: true,
audioChannelCount: 2,
sampleRateHertz: 44100,
enableSeparateRecognitionPerChannel: true,
enableAutomaticPunctuation: true,
profanityFilter: true
}
在另一个 mp3 文件中,具有相同设置的请求正在成功处理。
在这种情况下音频有问题吗?
正常文件有编码器标签,错误文件没有编码器标签。
tags: { encoder: 'Lavc58.54' }
需要什么样的解决办法,是设置不够还是音频需要处理?