Skip to content

Commit

Permalink
Process more (format, duration, extended {audio,video})
Browse files Browse the repository at this point in the history
this patch tries to extract more data out of the ffmpeg output
we get duration, format data, all of the audio and video line.
for compatibility audio and video are exactly as they used to be.

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
  • Loading branch information
xaiki committed Nov 19, 2012
1 parent 7b24f69 commit e848639
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions lib/processor.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -396,15 +396,29 @@ exports = module.exports = function Processor(command) {
}; };


this._checkStdErrForCodec = function(stderrString) { this._checkStdErrForCodec = function(stderrString) {
var audio = /Audio\: ([^,]+)/.exec(stderrString); var format= /Input #[0-9]+, ([^ ]+),/.exec(stderrString);
var video = /Video\: ([^,]+)/.exec(stderrString); var dur = /Duration\: ([^,]+)/.exec(stderrString);
var codecObject = { audio: '', video: '' }; var audio = /Audio\: (.*)/.exec(stderrString);
var video = /Video\: (.*)/.exec(stderrString);
var codecObject = { format: '', audio: '', video: '', duration: '' };

if (format && format.length > 1) {
codecObject.format = format[1];
}

if (dur && dur.length > 1) {
codecObject.duration = dur[1];
}


if (audio && audio.length > 1) { if (audio && audio.length > 1) {
codecObject.audio = audio[1]; audio = audio[1].split(', ');
codecObject.audio = audio[0];
codecObject.audio_details = audio;
} }
if (video && video.length > 1) { if (video && video.length > 1) {
codecObject.video = video[1]; video = video[1].split(', ');
codecObject.video = video[0];
codecObject.video_details = video;
} }


var codecInfoPassed = /Press (\[q\]|ctrl-c) to stop/.test(stderrString); var codecInfoPassed = /Press (\[q\]|ctrl-c) to stop/.test(stderrString);
Expand Down

0 comments on commit e848639

Please sign in to comment.