Просмотр исходного кода

#106 - video transcoding: executable permissions for ffmpeg, correct command line arguments escaping, typos

Alex Trofimov 12 лет назад
Родитель
Сommit
cb2d4ea619

+ 1 - 0
inc/classes/BxDolTranscoderImage.php

@@ -62,6 +62,7 @@ bx_import('BxDolTranscoderImageQuery');
  *     - w - width of resulted image.
  *     - h - height of resulted image.
  *     - square_resize - make resulted image square, even of original image is not square, 'w' and 'h' parameters must be the same.
+ *     - crop_resize - crop image to destination size with filling whole area of destination size.
  *     - force_type - always change type of the image to the specified type: jpg, png, gif.
  * - Grayscale - make image grayscale, there is no parameters for this filter
  *

+ 5 - 4
inc/classes/BxDolTranscoderVideo.php

@@ -21,7 +21,7 @@ bx_import('BxDolTranscoderVideoQuery');
  *
  * To generate video which plays in all moders browsers along with video poster, 
  * you need to create 3 different video transcoding objects which will generate .mp4, .webm videos and video poster.
- * Video is convering upon first access, so it is probably better to force video conversion by calling @see BxDolTranscoderVideo::getFileUrl just after video uploading.
+ * Video is converting upon first access, so it is probably better to force video conversion by calling @see BxDolTranscoderVideo::getFileUrl just after video uploading.
  * Video for conversion is queued and when cron is run video conversion is performed.
  * While video is pending for conversion or in the process then 
  * @see BxDolTranscoderVideo::getFileUrl methods returns empty string for video and predefined image for video poster.
@@ -46,12 +46,12 @@ bx_import('BxDolTranscoderVideoQuery');
  *
  * Available filters:
  * - Mp4 - this filter convert video into .mp4 format along with resizing, the parameters are the following:
- *     - h - height of resulted video (360 by default), for video it is highly recommended to specify only height parameter (no width parameter, )
+ *     - h - height of resulted video (360px by default), for video it is highly recommended to specify only height parameter (without width parameter)
  *     - video_bitrate - video bitrate (512k by default)
  *     - audio_bitrate - video bitrate (128k by default)
  *     - ffmpeg_options - additional command line options for ffmepeg, as key => value array (empty by default)
  * - Webm - this filter convert video into .webm format along with resizing, the parameters are the same as for Mp4 filter
- * - Poster - this filter generates video thumbnail, it tries to get poster at 0, 3 and 5 seconds from the beginning, it gets first not fully blacke/white thumb
+ * - Poster - this filter generates video thumbnail, it tries to get poster at 0, 3 and 5 seconds from the beginning, it gets first not fully black/white thumb
  *
  *
  * Example of usage:
@@ -80,6 +80,7 @@ bx_import('BxDolTranscoderVideoQuery');
  *     </video>'; 
  * @endcode
  *
+ * Also @see transcoder_videos sample for complete example.
  */
 class BxDolTranscoderVideo extends BxDolTranscoder implements iBxDolFactoryObject
 {
@@ -200,7 +201,7 @@ class BxDolTranscoderVideo extends BxDolTranscoder implements iBxDolFactoryObjec
             @unlink($sFileOut);
         }
 
-        $sCommand = BX_SYSTEM_FFMPEG . ' -y -i "' . escapeshellcmd($sFile) . '" ' . $sOptions . ' ' . $sFileOut . ' 2>&1';
+        $sCommand = escapeshellcmd(BX_SYSTEM_FFMPEG) . ' -y -i ' . escapeshellarg($sFile) . ' ' . $sOptions . ' ' . escapeshellarg($sFileOut) . ' 2>&1';
         $sOutput = `$sCommand`;
         $this->addToLog("\n---\n{$sCommand}\n{$sOutput}\n");
 

+ 1 - 0
studio/classes/BxDolStudioTools.php

@@ -35,6 +35,7 @@ class BxDolStudioTools extends BxDolIO
             'logs',
             'tmp',
             'storage',
+            'plugins/ffmpeg/ffmpeg.exe',
         );
 
         $this->aPostInstallPermissions = array(