Skip to content

Commit

Permalink
add audio support
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Apr 11, 2018
1 parent 3d41251 commit fa9004d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = async (opts) => {
cleanupFrames = true,
transition = undefined,
transitions = undefined,
audio = undefined,
videos,
output
} = opts
Expand Down Expand Up @@ -58,6 +59,7 @@ module.exports = async (opts) => {
log,
framePattern,
frameFormat,
audio,
output,
theme,
onProgress: (p) => {
Expand Down
8 changes: 4 additions & 4 deletions lib/transcode-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const onTranscodeProgress = require('ffmpeg-on-progress')
module.exports = async (opts) => {
const {
log,
audioPath,
audio,
frameFormat,
framePattern,
onProgress,
Expand All @@ -30,8 +30,8 @@ module.exports = async (opts) => {
const cmd = ffmpeg(framePattern)
.inputOptions(inputOptions)

if (audioPath) {
cmd.addInput(audioPath)
if (audio) {
cmd.addInput(audio)
}

const outputOptions = []
Expand All @@ -54,7 +54,7 @@ module.exports = async (opts) => {
])

// audio
.concat(!audioPath ? [ ] : [
.concat(!audio ? [ ] : [
'-c:a', 'copy',
'-shortest'
])
Expand Down
7 changes: 7 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ const transitions = [
]
```

##### audio

Type: `String`
**Required**

Path or URL to an audio file to use as the audio track for the output video.

##### frameFormat

Type: `string`
Expand Down

0 comments on commit fa9004d

Please sign in to comment.