php-ffmpeg | 纯php5基于命名空间写的调用ffmpeg处理视频,可以方便地实现对php处理视频操作
kandi X-RAY | php-ffmpeg Summary
kandi X-RAY | php-ffmpeg Summary
用法 ####第一种方式: 模块已经实现了命名空间与require的映射结合,利用php5的命名空间和自动加载可以很方便地使用。 在项目中要建立一个名为Phpffmpeg(名称不能改,因为要与文件定义的根命名空间对应相同)的空的文件夹,把文件下载后,将里面的文件复制至新建的Phpffmpeg文件夹下。. 首先要导入 FFmpegAutoloader.class.php ,在执行静态的register()注册方法 require_once "path/FFmpegAutoloader.class.php"; \Phpffmpeg\FFmpegAutoloader::register();. (1)$movie = new ffmpeg_movie(String path_to_media, boolean persistent);. 获取对应的帧,返回的对象将作为new ffmpeg_frame(Resource gd_image)的实例化对象。 Returns a frame from the movie as an ffmpeg_frame object. Returns false if the frame was not found. 获取下一帧 Returns the next key frame from the movie as an ffmpeg_frame object. Returns false if the frame was not found. (15)$movie->getImage($savePath,$second,$width,$height); 获取视频的某个时间的帧图片(关键帧) $savePath 图片保存的路径,包含图片的名称。例如path/my.jpg; $second 视频对应的秒数,int。 $width 图片的宽度,int。 $height 图片的高度,int。. (16)$movie->getGif($savePath,$startsecond,$lastsecond,$width,$height); 截取视频的某个时间开始至某个时间的gif动态图。 $savePath 图片保存的路径,包含图片的名称。例如path/my.gif; $startsecond 视频开始秒数,int。 $lastsecond 持续的秒数,即gif的时长。 $width gif的宽度,int。 $height gif的高度,int。. (1)$frame = new ffmpeg_frame(Resource gd_image);. 参数是一个图片资源对象(需要自己创建),如果执行$movie->getFrame([Integer framenumber]);择返回的就是一个相当于new ffmpeg_frame(Resource gd_image);的实例化对象;. (5)$frame->resize(Integer width, Integer height [, Integer crop_top [, Integer crop_bottom [, Integer crop_left [, Integer crop_right ]]]]);. (6)$frame->crop(Integer crop_top [, Integer crop_bottom [, Integer crop_left [, Integer crop_right ]]]);.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Get frame at time
- Finds the file with the specified extension .
- Add frame data
- Get the Composer autoloader .
- Get movie output
- Get gif image
- Resize the image .
- Autoload a class
- Set the output
- Get the initializer .
php-ffmpeg Key Features
php-ffmpeg Examples and Code Snippets
Community Discussions
Trending Discussions on php-ffmpeg
QUESTION
I'm trying to integrate FFMpeg into a Laravel project but am getting the error when I call the end point:
FFMpeg\Exception\ExecutableNotFoundException: Unable to load FFMpeg in file /Users/me/Desktop/video/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFMpegDriver.php on line 55
What I've done:
brew install ffmpeg
- installed FFMEG locally, can confirm that this works when using terminal
Fresh Laravel install composer create-project laravel/laravel example-app
Install php ffmpeg composer require php-ffmpeg/php-ffmpeg
install Laravel ffmpeg composer require pbmedia/laravel-ffmpeg
added FFMPEG to providers and aliases in app.php
:
ANSWER
Answered 2021-Jan-31 at 15:51It's not able to find your FFMpeg executable. Try adding the path to FFMPEG_BINARIES
and FFPROBE_BINARIES
in your .env
file.
QUESTION
I want to merge multiple videos side by side in one video with PHP-FFmpeg, is there anyone help me about that?
...ANSWER
Answered 2020-Dec-08 at 18:13Use hstack filter instead of overlay filter if you want side-by-side.
Change:
QUESTION
I use PHP-FFMpeg library (https://github.com/PHP-FFMpeg/PHP-FFMpeg) and try to do this:
...ANSWER
Answered 2020-Sep-15 at 12:55This works:
QUESTION
I use this code to convert GIFs to MP4:
...ANSWER
Answered 2020-Aug-17 at 03:39The solution:
QUESTION
When I try to get the duration of a video using the php-ffmpeg wrapper and ffprobe, I get a huge object instead of just the duration.
...ANSWER
Answered 2017-May-11 at 18:45$ffprobe
->streams($this->videoFile)
->videos()
->first()
->get('duration');
QUESTION
Trying to run PHP-FFMPEG and after install via composer I'm currently getting this.
PHP Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutableNotFoundException: Executable not found, proposed : avprobe, ffprobe in /var/www/html/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:159\nStack trace:\n#0 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php(48): Alchemy\BinaryDriver\AbstractBinary::load(Array, NULL, Object(Alchemy\BinaryDriver\Configuration))\n#1 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFProbe.php(226): FFMpeg\Driver\FFProbeDriver::create(Object(Alchemy\BinaryDriver\Configuration), NULL)\n#2 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php(117): FFMpeg\FFProbe::create(Array, NULL, Object(Doctrine\Common\Cache\ArrayCache))\n#3 /var/www/html/starapp/test.php(4): FFMpeg\FFMpeg::create()\n#4 {main}\n\nNext FFMpeg\Exception\ExecutableNotFoundException: Unable to load FFProbe in /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php:50\nStack trace:\n#0 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMp in /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php on line 50
Some people have suggested running the following:
...ANSWER
Answered 2020-Feb-17 at 14:14Issue was the paths
QUESTION
I'm using FFMpeg's library for PHP (see https://github.com/PHP-FFMpeg/PHP-FFMpeg). After starting the convert process, the converted video's file size gradually increases (I constantly refresh the folder) and after converting finishes, the file size becomes 0 again and converting starts again. So converting is done twice, I could not understand if it is normal or there is something wrong.
My converting code is:
...ANSWER
Answered 2020-Feb-12 at 10:34This is because ffmpeg uses 2 pass encoding. https://superuser.com/questions/1362800/ffmpeg-2-pass-encoding
first it writes everything to a log and then from that log it makes the video
QUESTION
I've a RabbitMQ's queue that contains AMQPMessage, those messages are referencing a video that needs to be treated (cut essentially and encoded in x264 also)
Here's the code that cause the issue (pretty straightforward)
...ANSWER
Answered 2019-Dec-04 at 18:22Change to:
QUESTION
I am using php-ffmpeg (a PHP api to ffmpeg) to probe video files before they are converted. I am getting all the information I need just fine, but I want to use it to calculate the estimated file size of the video once it has been converted so that I can convert videos more efficiently for quality vs space etc.
The post-conversion file size only has to be an estimate. So far I have tried multiplying the duration by the anticipated video bitrate plus the anticipated audio bitrate. However, that gives me a size way larger than the original video file that has a higher video and audio bitrate. I'm assuming there is a compression factor that may have to be taken into account for each different video codec, but am just trying to get somewhere with .mp4/m4v for now.
This is what I have tried;
...ANSWER
Answered 2019-Apr-17 at 19:0729302kbps
is kilobits per second
87.86 MB
is megabytes.
There are 8 bits in a byte. 121.11Mb
equals 15.13MB
(121.11/8)
QUESTION
I am using php-ffmpeg for converting uploaded videos. With all videos it was working great before. But from last few days through now only small videos are getting convert and giving me proper response on success. But large videos which size are more than 25MB they are uploading well on server converting also well but on success response it giving me error. image is bellow.
so here when I refresh my page manually or check on server then I can see that video uploaded on server and converted also well already just issue facing in sending me success response when video get converted.
And code is same for small and large video convert so small is working well and with large facing issues from last few days through.
Any possible suggestion guys ?
...ANSWER
Answered 2017-Nov-09 at 08:17Maybe it's a problem of time limit or memory limit, so you can add these lines:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install php-ffmpeg
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page