Skip to content

Commit

Permalink
Merge pull request #456 from OshinKaramian/master
Browse files Browse the repository at this point in the history
Fix ffprobe example
  • Loading branch information
Nicolas Joyard committed Nov 29, 2015
2 parents dc494ce + 5b4825e commit c6af8f2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/metadata.js
@@ -1,6 +1,6 @@
var ffmpeg = require('../index');

// make sure you set the correct path to your video file
ffmpeg.ffprobe('/path/to/your_movie.avi',function(metadata, err) {
ffmpeg.ffprobe('/path/to/your_movie.avi',function(err, metadata) {
console.log(require('util').inspect(metadata, false, null));
});
32 changes: 17 additions & 15 deletions lib/ffprobe.js
Expand Up @@ -163,26 +163,28 @@ module.exports = function(proto) {

// Handle legacy output with "TAG:x" and "DISPOSITION:x" keys
[data.format].concat(data.streams).forEach(function(target) {
var legacyTagKeys = Object.keys(target).filter(legacyTag);
if (target) {
var legacyTagKeys = Object.keys(target).filter(legacyTag);

if (legacyTagKeys.length) {
target.tags = target.tags || {};
if (legacyTagKeys.length) {
target.tags = target.tags || {};

legacyTagKeys.forEach(function(tagKey) {
target.tags[tagKey.substr(4)] = target[tagKey];
delete target[tagKey];
});
}
legacyTagKeys.forEach(function(tagKey) {
target.tags[tagKey.substr(4)] = target[tagKey];
delete target[tagKey];
});
}

var legacyDispositionKeys = Object.keys(target).filter(legacyDisposition);
var legacyDispositionKeys = Object.keys(target).filter(legacyDisposition);

if (legacyDispositionKeys.length) {
target.disposition = target.disposition || {};
if (legacyDispositionKeys.length) {
target.disposition = target.disposition || {};

legacyDispositionKeys.forEach(function(dispositionKey) {
target.disposition[dispositionKey.substr(12)] = target[dispositionKey];
delete target[dispositionKey];
});
legacyDispositionKeys.forEach(function(dispositionKey) {
target.disposition[dispositionKey.substr(12)] = target[dispositionKey];
delete target[dispositionKey];
});
}
}
});

Expand Down

0 comments on commit c6af8f2

Please sign in to comment.