PHPackages                             dawood/phpscreenrecorder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. dawood/phpscreenrecorder

ActiveLibrary[CLI &amp; Console](/categories/cli)

dawood/phpscreenrecorder
========================

A slim PHP wrapper around ffmpeg to record screen,best for recording your acceptance test using selenium, easy to use and clean OOP interface

v1.4(8y ago)491.5k13[2 issues](https://github.com/daudmalik06/PhpScreenRecorder/issues)MITPHP

Since Jul 18Pushed 7y ago7 watchersCompare

[ Source](https://github.com/daudmalik06/PhpScreenRecorder)[ Packagist](https://packagist.org/packages/dawood/phpscreenrecorder)[ RSS](/packages/dawood-phpscreenrecorder/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

PHP Screen Recorder
===================

[](#php-screen-recorder)

A lightweight php wrapper around [ffmpeg](https://ffmpeg.org/) to record the screen, best for recording your acceptance tests using selenium, it's easy to use and clean OOP interface.

History
-------

[](#history)

I was given a task to make an **acceptance test suite** which included recording videos of the tests. I was using **selenium** for the task and for the video recording, however, I was unable to find an elegant solution which is why i created this library.

Usage
-----

[](#usage)

One of the best features of this library is its ease of use.

The `startRecording` method is called when the user wants to start the recording after which this library will start the video recording in the background. When the user has completed their task they can call `stopRecording` to stop the recording .

Installation
------------

[](#installation)

The library is easily installed as a package through [composer](http://getcomposer.org):

```
composer require dawood/phpscreenrecorder

```

*that's it, nothing else is required for the installation*

Examples
--------

[](#examples)

There are examples provided in examples folder as well.

Make sure, that you include the composer [autoloader](https://getcomposer.org/doc/01-basic-usage.md#autoloading)somewhere in your codebase.

### Capture the screen

[](#capture-the-screen)

```
include "../vendor/autoload.php";

use dawood\PhpScreenRecorder\ScreenRecorder;

$screenRecorder=new ScreenRecorder();
$screenRecorder->setScreenSizeToCapture(1920,1080);

$screenRecorder->startRecording(__DIR__.DIRECTORY_SEPARATOR.'myVideo');
sleep(5+2);//doing random stuff
//when done stop recording
$screenRecorder->stopRecording();

print "video is saved at :\"".$screenRecorder->getVideo().'"'.PHP_EOL;
```

### Selenium test example

[](#selenium-test-example)

```
public function testLoginUserCorrectly()
{
    $this->screenRecorder->setScreenSizeToCapture(1920,1080);
    $this->screenRecorder->startRecording(__DIR__."/videos/loginCorrectly.flv",2);
    $loginInput = [
        'username' => 'test',
        'password' => 'password'
    ];
    $this->visit('/')
        ->submitForm("#loginform > form",$loginInput)
        ->wait(3)
        ->see("Logout")
        ->wait(2);
    $this->screenRecorder->stopRecording(0);

}
```

Setting options
---------------

[](#setting-options)

The `ffmpeg` shell command can accept different options: for a complete list of options you can visit:

### Wrapper Methods

[](#wrapper-methods)

- `setOptions` accepts the options in the array. You can provide any option in following way:

```
      $options['-show_region'=>'1']
      $screenRecorder->setOptions($options);
```

> Note: you have to write complete option including "-" ,
> i had to do this way because there are some options which need "-" this and some which not so it's difficult to know for which option i have to set that that's why you have to provide complete option.

- `setScreenSizeToCapture` screen size to capture, it accepts two arguments the first being the width and other being the height.
- `startRecording` call this method after you have set all the desired options,
    this will start the screen recording. The method accepts two optional arguments, firstly the desired location to save the video file and secondly the number of seconds to sleep after starting the process. This is useful because ffmpeg takes 1-2 seconds to start the recording, the default value for this is 2 seconds. You can may change this according to your requirements.
- `stopRecording` this will stop the screen recording. The method can also take one optional argument, the number of seconds to sleep after starting the process. This is useful because ffmpeg takes 1-2 seconds to start the recording.
- `getVideo` returns the saved video file.
- `setBinary` for this library you do not require any binary as everything is already included, however, if you need to use any other binary you can provide it using this method.
- `getCommandToRun` returns the generated command that will be executed by library.
    This is useful to check how you have set the options or to debug.
- `getOptions` returns an array of all the set options.
- `getBinary` returns the currently set binary file i.e ffmpeg.

License
-------

[](#license)

The **PHP Screen Recorder** is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

Contribution
------------

[](#contribution)

Thanks to all of the contributors , fork this repository and send me a pull request

Author
------

[](#author)

Dawood Ikhlaq and Open source community

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 72.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

3267d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6933433cb8dc85ee0936f982f9f5c60a57563e4a61ff01fbe84e8334fdf57ab7?d=identicon)[daudmalik06](/maintainers/daudmalik06)

---

Top Contributors

[![daudmalik06](https://avatars.githubusercontent.com/u/3526480?v=4)](https://github.com/daudmalik06 "daudmalik06 (8 commits)")[![xavikhattak](https://avatars.githubusercontent.com/u/30019392?v=4)](https://github.com/xavikhattak "xavikhattak (2 commits)")[![petrisorureche](https://avatars.githubusercontent.com/u/29726226?v=4)](https://github.com/petrisorureche "petrisorureche (1 commits)")

---

Tags

ffmpegffmpeg-wrapperphpphp-libraryrecord-videoseleniumselenium-webdrivertest-recordingtest-topicphpshellvideoseleniumchromerecording

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dawood-phpscreenrecorder/health.svg)

```
[![Health](https://phpackages.com/badges/dawood-phpscreenrecorder/health.svg)](https://phpackages.com/packages/dawood-phpscreenrecorder)
```

###  Alternatives

[nunomaduro/phpinsights

Instant PHP quality checks from your console.

5.6k11.4M471](/packages/nunomaduro-phpinsights)[seregazhuk/php-watcher

Automatically restart PHP application once the source code changes

394138.4k6](/packages/seregazhuk-php-watcher)[dawood/phpchromepdf

A slim PHP wrapper around google-chrome to convert url to pdf or to take screenshots , easy to use and clean OOP interface

14983.3k](/packages/dawood-phpchromepdf)[alecrabbit/php-console-spinner

Extremely flexible spinner for \[async\] php cli applications

24035.5k2](/packages/alecrabbit-php-console-spinner)[mwguerra/web-terminal

A web-based terminal component for Filament/Laravel with command whitelisting and multiple connection types

294.5k](/packages/mwguerra-web-terminal)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
