diff --git a/lib/classes/video.js b/lib/classes/video.js index 5ec4fb0..521d93d 100644 --- a/lib/classes/video.js +++ b/lib/classes/video.js @@ -338,7 +338,11 @@ class Video { if (_self.streams.videoStreams.length > 1) { // TODO implement feature - _self.encoder.logger.alert('More than one video stream detected. Using the video stream with the greatest duration.'); + _self.encoder.logger.alert('More than one video stream detected. Using the video stream with the greatest duration. Assuming the second one is Cover Art masquerading as video.'); + // copy the second stream assuming it is mjpeg Cover Art - if not mkv + if (args.outputFormat !== 'mkv') { + command.outputOptions('-c:v:1', 'copy'); + } videoIndex = 0; } let videoStream = _self.videoStream = _self.streams.videoStreams[videoIndex]; @@ -377,7 +381,13 @@ class Video { break; } } - + + // add hvc1 tag to codec so it is playable by Quicktime - if not mkv + + if (args.outputFormat !== 'mkv') { + command.outputOptions('-tag:v:'+ videoIndex, 'hvc1'); + } + // Make sure we are only attempting to use 8 bit with fallback // binary // TODO @@ -697,14 +707,29 @@ class Video { mapStreams() { let _self = this; return new Promise(function(resolve, reject) { - - _self.ffmpegCommand.outputOptions('-map', _self.videoStream.input + ':' + _self.videoStream.index); - _self.encoder.logger.debug('Video stream', _self.videoStream.input + ':' + _self.videoStream.index, 'mapped.', { - size: _self.videoStream.width + 'x' + _self.videoStream.height, - codec: _self.videoStream.codec_long_name, - profile: _self.videoStream.profile, - 'bit depth': _self.videoBitDepth - }); + + // Video streams + + if (args.outputFormat !== 'mkv') { + _.each(_self.streams.videoStreams, function(stream, i) { + _self.ffmpegCommand.outputOptions('-map', stream.input + ':' + stream.index); + _self.encoder.logger.debug('Video stream', stream.input + ':' + stream.index, 'mapped.', { + size: stream.width + 'x' + stream.height, + codec: stream.codec_long_name, + profile: stream.profile, + 'bit depth': _self.videoBitDepth + }); + }); + } + else { + _self.ffmpegCommand.outputOptions('-map', _self.videoStream.input + ':' + _self.videoStream.index); + _self.encoder.logger.debug('Video stream', _self.videoStream.input + ':' + _self.videoStream.index, 'mapped.', { + size: _self.videoStream.width + 'x' + _self.videoStream.height, + codec: _self.videoStream.codec_long_name, + profile: _self.videoStream.profile, + 'bit depth': _self.videoBitDepth + }); + } // Handle native language detection and default audio track selection _.each(_self.streams.audioStreams, function(stream, i) {