Skip to content

Commit

Permalink
fix(#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
h2non committed Apr 20, 2015
1 parent 1c914fb commit dce1efb
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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<string|object>` - Add custom ffmpeg video filters to the image slide.
- **filters** `array<string|object>` - 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]
Expand Down
6 changes: 3 additions & 3 deletions bin/videoshow
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ 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)
if (size) video.size(size)
if (logo) video.logo(logo)
if (loop) video.loop(loop)

video
video
.save(output)
.on('error', error)
.on('start', function (command) {
Expand All @@ -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
Expand Down
20 changes: 17 additions & 3 deletions examples/captions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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) {
Expand All @@ -79,7 +79,7 @@ function mergeParts(videoshow, bus) {

function handler(err) {
if (err) return error(err)
end()
ender()
}
}
}
Expand Down

0 comments on commit dce1efb

Please sign in to comment.