Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #83 from inaes-tic/master

Fix onCodecData for newer ffmpeg
  • Loading branch information...
commit 6b2e4fd25e709f8c548c0149b6b99f33ea6d8558 2 parents eef4eba + e848639
Stefan Schärmeli schaermu authored
Showing with 20 additions and 6 deletions.
  1. +20 −6 lib/processor.js
26 lib/processor.js
View
@@ -396,18 +396,32 @@ 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\] to stop/.test(stderrString);
+ var codecInfoPassed = /Press (\[q\]|ctrl-c) to stop/.test(stderrString);
if (codecInfoPassed) {
this.options.onCodecData(codecObject);
this.options.onCodecData = null;
Please sign in to comment.
Something went wrong with that request. Please try again.