Skip to content
This repository
Browse code

fixed examples (closes #42

  • Loading branch information...
commit 94ff37b5dc7239b43e059d5ad66b73f0a2a25a47 1 parent a0ef5a5
Stefan Schärmeli authored April 23, 2012
2  examples/express-stream.js
@@ -13,7 +13,7 @@ app.get('/video/:filename', function(req, res) {
13 13
   res.contentType('flv');
14 14
   // make sure you set the correct path to your video file storage
15 15
   var pathToMovie = '/path/to/storage/' + req.params.filename; 
16  
-  var proc = new ffmpeg(pathToMovie)
  16
+  var proc = new ffmpeg({ source: pathToMovie, nolog: true })
17 17
     // use the 'flashvideo' preset (located in /lib/presets/flashvideo.js)
18 18
     .usingPreset('flashvideo')
19 19
     // save to stream
2  examples/full.js
... ...
@@ -1,7 +1,7 @@
1 1
 var ffmpeg = require('../lib/fluent-ffmpeg');
2 2
 
3 3
 // make sure you set the correct path to your video file
4  
-var proc = new ffmpeg('/path/to/your_movie.avi')
  4
+var proc = new ffmpeg({ source: '/path/to/your_movie.avi', nolog: true })
5 5
   // set video bitrate
6 6
   .withVideoBitrate(1024)
7 7
   // set target codec
4  examples/input-stream.js
@@ -2,7 +2,7 @@ var fs = require('fs'),
2 2
   ffmpeg = require('./lib/fluent-ffmpeg');
3 3
 
4 4
 // open input stream
5  
-var infs = fs.createReadStream(__dirname + '/test/assets/testvideo.avi');
  5
+var infs = fs.createReadStream(__dirname + '/test/assets/testvideo-43.avi');
6 6
 
7 7
 infs.on('error', function(err) {
8 8
   console.log(err);
@@ -10,7 +10,7 @@ infs.on('error', function(err) {
10 10
 
11 11
 // create new ffmpeg processor instance using input stream
12 12
 // instead of file path (can be any ReadableStream)
13  
-var proc = new ffmpeg(infs)
  13
+var proc = new ffmpeg({ source: infs, nolog: true })
14 14
   .usingPreset('flashvideo')
15 15
   .saveToFile('/path/to/your_target.flv', function(stdout, stderr, err) {
16 16
     console.log('done processing input stream');
2  examples/metadata.js
... ...
@@ -1,6 +1,6 @@
1 1
 var ffmpegmeta = require('../lib/fluent-ffmpeg').Metadata;
2 2
 
3 3
 // make sure you set the correct path to your video file
4  
-ffmpegmeta.get('/path/to/your_movie.avi', function(metadata) {
  4
+ffmpegmeta.get('/path/to/your_movie.avi', function(metadata, err) {
5 5
   console.log(require('util').inspect(metadata, false, null));
6 6
 });
2  examples/preset.js
... ...
@@ -1,7 +1,7 @@
1 1
 var ffmpeg = require('../lib/fluent-ffmpeg');
2 2
 
3 3
 // make sure you set the correct path to your video file
4  
-var proc = new ffmpeg('/path/to/your_movie.avi')
  4
+var proc = new ffmpeg({ source: '/path/to/your_movie.avi', nolog: true })
5 5
   // use the 'podcast' preset (located in /lib/presets/podcast.js)
6 6
   .usingPreset('podcast')
7 7
   // in case you want to override the preset's setting, just keep chaining
19  examples/progress.js
... ...
@@ -0,0 +1,19 @@
  1
+var fs = require('fs'),
  2
+  ffmpeg = require('./lib/fluent-ffmpeg');
  3
+
  4
+// open input stream
  5
+var infs = fs.createReadStream(__dirname + '/test/assets/testvideo-43.avi');
  6
+
  7
+infs.on('error', function(err) {
  8
+  console.log(err);
  9
+});
  10
+
  11
+var proc = new ffmpeg({ source: infs, nolog: true })
  12
+  .usingPreset('flashvideo')
  13
+  // set the callback for our progress notification
  14
+  .onProgress(function(info) {
  15
+    console.log('progress ' + info.percent + '%');
  16
+  })
  17
+  .saveToFile('/path/to/your_target.flv', function(stdout, stderr, err) {
  18
+    console.log('done processing input stream');
  19
+  });
2  examples/stream.js
@@ -5,7 +5,7 @@ var ffmpeg = require('../lib/fluent-ffmpeg'),
5 5
 var stream = fs.createWriteStream('/path/to/yout_target.flv')
6 6
 
7 7
 // make sure you set the correct path to your video file
8  
-var proc = new ffmpeg('/path/to/your_movie.avi')
  8
+var proc = new ffmpeg({ source: '/path/to/your_movie.avi', nolog: true })
9 9
   // use the 'flashvideo' preset (located in /lib/presets/flashvideo.js)
10 10
   .usingPreset('flashvideo')
11 11
   // save to stream
2  examples/thumbnails.js
... ...
@@ -1,6 +1,6 @@
1 1
 var ffmpeg = require('../lib/fluent-ffmpeg');
2 2
 
3  
-var proc = new ffmpeg('/path/to/your_movie.avi')
  3
+var proc = new ffmpeg({ source: '/path/to/your_movie.avi', nolog: true })
4 4
   // set the size of your thumbnails
5 5
   .withSize('150x100')
6 6
   // take 2 screenshots at predefined timemarks
2  package.json
... ...
@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "fluent-ffmpeg",
3  
-  "version": "0.3.0",
  3
+  "version": "1.0.0",
4 4
   "description": "A fluent API to FFMPEG (http://www.ffmpeg.org)",
5 5
   "keywords": [ "ffmpeg" ],
6 6
   "author": "Stefan Schaermeli <schaermu@gmail.com>",

0 notes on commit 94ff37b

Please sign in to comment.
Something went wrong with that request. Please try again.