Əziz İstifadəçi yeni mövzu açarkən və ya şərh yazarkən yalnız və yalnız Azərbaycan Əlifbasından (Latın Əlifbasından) istifadə edin!
Mütləq yeni mövzu açarkən vəya şərh yazarkən yalnız AZƏRBAYCAN ŞRİFTLƏRİYLƏ YAZIN!
Proof:
http://next72.blogspot.com/2013/08/extract-images-from-video-using-php.html
http://pastebin.com/raw.php?i=mMnUPxPs
PT-na tələblər:
1) Shared hosting yox Linux VPS al.
2) Serverdə ffmpeg toolu install elə.
3) php.ini -də shell_exec() funksiyasını disable etmə
4) Əgər klient tərəfli inputları handle edəcəksənsə (videoname/saniyə/path və s) MÜTLƏQ VƏ MÜTLƏQ inputları sanitizə elə preg_replace('/[^A-Za-z0-9\.]/'.''.$inputlar);
Kiçik bir səhv serverin hacklanmasına gətirib çıxara bilər
Kod:
[root@fedora html]# which ffmpeg
/usr/bin/ffmpeg
[root@fedora html]# rpm -qi ffmpeg
Name : ffmpeg
Version : 2.6.3
Release : 1.fc22
Architecture: x86_64
Install Date: Wed 10 Jun 2015 09:13:00 AM AZST
Group : Unspecified
Size : 7304932
License : GPLv2+
Signature : RSA/SHA1, Wed 03 Jun 2015 03:33:26 PM AZST, Key ID 81c9b42397f4d1c1
Source RPM : ffmpeg-2.6.3-1.fc22.src.rpm
Build Date : Wed 03 Jun 2015 03:06:06 PM AZST
Build Host : builder02
Relocations : (not relocatable)
Packager : http://free.rpmfusion.org/
Vendor : RPM Fusion
URL : http://ffmpeg.org/
Summary : Digital VCR and streaming server
Description :
FFmpeg is a complete and free Internet live audio and video
broadcasting solution for Linux/Unix. It also includes a digital
VCR. It can encode in real time in many formats including MPEG1 audio
and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash.
[root@fedora html]# cat vid.php
<?php
error_reporting(0);
$path=dirname(__FILE__);
$filename='testvid.mp4';
$sheklinadi='framesekil' . md5(mt_rand() . 'daxdaxdadaraxxxx') . '.jpg';
$saniye='00:00:25';//25-ci saniyenin frame shekli ucun//
shell_exec('echo Y|ffmpeg -ss ' . $saniye .' -i ' . $path .'/'. $filename . ' -vf scale=800:-1 -vframes 1 ' . $sheklinadi . '>/dev/null');
echo '<p align="center"><img src="' . $sheklinadi . '"/></p>'. PHP_EOL;
exit(0);
?>
[root@fedora html]# cat vid.php
<?php
error_reporting(0);
$path=dirname(__FILE__);
$filename='testvid.mp4';
$sheklinadi='framesekil' . md5(mt_rand() . 'daxdaxdadaraxxxx') . '.jpg';
$saniye='00:00:25';//25-ci saniyenin frame shekli ucun//
shell_exec('echo Y|ffmpeg -ss ' . $saniye .' -i ' . $path .'/'. $filename . ' -vf scale=800:-1 -vframes 1 ' . $sheklinadi . '>/dev/null');
echo '<p align="center"><img src="' . $sheklinadi . '"/></p>'. PHP_EOL;
exit(0);
?>