Permalink
Browse files

Process more (format, duration, extended {audio,video})

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...
1 parent 7b24f69 commit e848639fd164892bb7baeba4126abdaf17b1ddc4 @xaiki xaiki committed Nov 19, 2012
Showing with 19 additions and 5 deletions.
  1. +19 −5 lib/processor.js
View
24 lib/processor.js
@@ -396,15 +396,29 @@ exports = module.exports = function Processor(command) {
};
this._checkStdErrForCodec = function(stderrString) {
- var audio = /Audio\: ([^,]+)/.exec(stderrString);
- var video = /Video\: ([^,]+)/.exec(stderrString);
- var codecObject = { audio: '', video: '' };
+ var format= /Input #[0-9]+, ([^ ]+),/.exec(stderrString);
+ var dur = /Duration\: ([^,]+)/.exec(stderrString);
+ 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) {
- codecObject.audio = audio[1];
+ audio = audio[1].split(', ');
+ codecObject.audio = audio[0];
+ codecObject.audio_details = audio;
}
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);

0 comments on commit e848639

Please sign in to comment.