diff --git a/README.md b/README.md index 5cb7d9b..ca96fd4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ You can easily **create videos** with optional **audio**, **subtitles** and **fa To getting started you can take a look to the [examples](https://github.com/h2non/videoshow/tree/master/examples), [programmatic API](#api) and [command-line](#command-line-interface) interface -[Here](https://www.youtube.com/watch?v=ZU84JxWGRhk) you can see a real video created using videoshow +videoshow was used in production rendering thousands of videos. +[Here](https://www.youtube.com/watch?v=ZU84JxWGRhk) you can see a real video created using videoshow. ## Requirements @@ -109,7 +110,24 @@ Example `config.json` file: "size": "640x?", "audioBitrate": "128k", "audioChannels": 2, - "format": "mp4" + "format": "mp4", + "subtitleStyles": { + "Fontname": "Verdana", + "Fontsize": "26", + "PrimaryColour": "11861244", + "SecondaryColour": "11861244", + "TertiaryColour": "11861244", + "BackColour": "-2147483640", + "Bold": "2", + "Italic": "0", + "BorderStyle": "2", + "Outline": "2", + "Shadow": "3", + "Alignment": "1", + "MarginL": "40", + "MarginR": "60", + "MarginV": "40" + } }, "images": [ "./test/fixtures/step_1.png", @@ -189,7 +207,7 @@ Options details: - **transition** `boolean` - Enable fade in/out transition for the current image - **transitionDuration** `number` - Fade in/out transition duration in **seconds**. Default to `1` - **transitionColor** `string` - Fade in/out transition background color. Default to `black`. See [supported colors][ffmpeg-colors] -- **filters** `array` - Add custom ffmpeg video filters to the image slide. +- **filters** `array` - Add custom ffmpeg video filters to the image slide. - **disableFadeOut** `boolean` - If transition is enable, disable the fade out. Default `false` - **disableFadeIn** `boolean` - If transition is enable, disable the fade in. Default `false` - **caption** `string` - Caption text as subtitle. It allows a limited set of HTML tags. See [Subrip][subrip] diff --git a/bin/videoshow b/bin/videoshow index 586b2b5..a694d3f 100755 --- a/bin/videoshow +++ b/bin/videoshow @@ -63,7 +63,7 @@ function render(opts) { var logo = argv.logo || opts.logo var loop = argv.loop || opts.loop - var video = videoshow(opts.images, opts.params) + var video = videoshow(opts.images, opts.options) if (audio) video.audio(audio) if (subtitles) video.subtitles(subtitles) @@ -71,7 +71,7 @@ function render(opts) { if (logo) video.logo(logo) if (loop) video.loop(loop) - video + video .save(output) .on('error', error) .on('start', function (command) { @@ -95,7 +95,7 @@ function getOutput() { function options() { var opts = {} var config = JSON.parse(fs.readFileSync(argv.config)) - if (config && config.options) { + if (config && (config.options || config.images)) { opts = config } return opts diff --git a/examples/captions.js b/examples/captions.js index 0243e6f..db9ce0b 100644 --- a/examples/captions.js +++ b/examples/captions.js @@ -3,12 +3,26 @@ var videoshow = require('../') var audio = __dirname + '/../test/fixtures/song.mp3' var options = { + loop: 5, + captionDelay: 350, transition: true, - useSubRipSubtitles: false, + useSubRipSubtitles: true, subtitleStyle: { Fontname: 'Verdana', - Fontsize: '24', - PrimaryColour: '11861244' + Fontsize: '26', + PrimaryColour: '11861244', + SecondaryColour: '11861244', + TertiaryColour: '11861244', + BackColour: '-2147483640', + Bold: '2', + Italic: '0', + BorderStyle: '2', + Outline: '2', + Shadow: '3', + Alignment: '1', // left, middle, right + MarginL: '40', + MarginR: '60', + MarginV: '40' } } diff --git a/lib/render.js b/lib/render.js index 7b72084..bdc07c3 100644 --- a/lib/render.js +++ b/lib/render.js @@ -58,7 +58,7 @@ function mergeParts(videoshow, bus) { if (err) return bus.emit('error', err) var cleanup = mergeHandler(images, output, forwardEvent) - var end = cleanup('end') + var ender = cleanup('end') var error = cleanup('error') var options = videoshow.videoParams @@ -68,7 +68,7 @@ function mergeParts(videoshow, bus) { .on('progress', forwardEvent('progress')) .on('error', error) .on('end', end) - + function end() { var options = null if (videoshow.audioFile) { @@ -79,7 +79,7 @@ function mergeParts(videoshow, bus) { function handler(err) { if (err) return error(err) - end() + ender() } } }