This repository was archived by the owner on May 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -516,14 +516,8 @@ module.exports = function(proto) {
516516
517517 // 'progress' event
518518 if ( self . listeners ( 'progress' ) . length ) {
519- var duration = 0 ;
520-
521- if ( self . _ffprobeData && self . _ffprobeData . format && self . _ffprobeData . format . duration ) {
522- duration = Number ( self . _ffprobeData . format . duration ) ;
523- }
524-
525519 stderrRing . callback ( function ( line ) {
526- utils . extractProgress ( self , line , duration ) ;
520+ utils . extractProgress ( self , line ) ;
527521 } ) ;
528522 }
529523 }
Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ var utils = module.exports = {
324324 * @param {Number } [duration=0] expected output duration in seconds
325325 * @private
326326 */
327- extractProgress : function ( command , stderrLine , duration ) {
327+ extractProgress : function ( command , stderrLine ) {
328328 var progress = parseProgressLine ( stderrLine ) ;
329329
330330 if ( progress ) {
@@ -338,10 +338,11 @@ var utils = module.exports = {
338338 } ;
339339
340340 // calculate percent progress using duration
341- if ( duration && duration > 0 ) {
342- ret . percent = ( utils . timemarkToSeconds ( ret . timemark ) / duration ) * 100 ;
341+ if ( command . _ffprobeData && command . _ffprobeData . format && command . _ffprobeData . format . duration ) {
342+ var duration = Number ( command . _ffprobeData . format . duration ) ;
343+ if ( ! isNaN ( duration ) )
344+ ret . percent = ( utils . timemarkToSeconds ( ret . timemark ) / duration ) * 100 ;
343345 }
344-
345346 command . emit ( 'progress' , ret ) ;
346347 }
347348 } ,
You can’t perform that action at this time.
0 commit comments