r94357 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94356‎ | r94357 | r94358 >
Date:15:56, 12 August 2011
Author:j
Status:deferred
Tags:
Comment:
move -ss argument before input, that way ffmpeg seeks before decoding. makes frame extraction usable with longer videos.
Modified paths:
  • /trunk/extensions/TimedMediaHandler/TimedMediaThumbnail.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/TimedMediaThumbnail.php
@@ -18,17 +18,18 @@
1919 static function tryFfmpegThumb( $options ){
2020 global $wgFFmpegLocation;
2121
22 - $cmd = wfEscapeShellArg( $wgFFmpegLocation ) .
23 - ' -i ' . wfEscapeShellArg( $options['file']->getPath() );
 22+ $cmd = wfEscapeShellArg( $wgFFmpegLocation );
 23+
 24+ $cmd .= ' -ss ' . intval( self::getThumbTime( $options ) );
 25+ $cmd .= ' -i ' . wfEscapeShellArg( $options['file']->getPath() );
2426 // Set the output size if set in options:
2527 if( isset( $options['width'] ) && isset( $options['height'] ) ){
2628 $cmd.= ' -s '. intval( $options['width'] ) . 'x' . intval( $options['height'] );
2729 }
2830
29 - $cmd.=' -ss ' . intval( self::getThumbTime( $options ) ) .
3031 # MJPEG, that's the same as JPEG except it's supported by the windows build of ffmpeg
3132 # No audio, one frame
32 - ' -f mjpeg -an -vframes 1 ' .
 33+ $cmd .= ' -f mjpeg -an -vframes 1 ' .
3334 wfEscapeShellArg( $options['dstPath'] ) . ' 2>&1';
3435
3536 $retval = 0;

Status & tagging log