Skip to content

Commit

Permalink
Merge pull request #363 from linqian02/bugfix
Browse files Browse the repository at this point in the history
fix:修复视频元素不存在音频流时FFmpeg出错的问题
  • Loading branch information
drawcall authored Jun 7, 2023
2 parents 81ede1d + 3655ec5 commit af56dcd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/node/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,15 @@ class FFVideo extends FFImage {
} catch (e) {}

this.resetDurationTime();
if (this.audio) await this.extractAudio();
if (this.audio){
const { streams=[] } = this.materials.info;
const hasAudioStream = streams.some(function(stream) {
return stream.codec_type === 'audio';
});
if(hasAudioStream){
await this.extractAudio();
}
}
await this.extractVideo();
this.addAudioToScene();
}
Expand Down

0 comments on commit af56dcd

Please sign in to comment.