Problem/Motivation

Trying to install this module on php 8.1 there's the following error:

  Problem 1
    - Root composer.json requires drupal/media_thumbnails_video ^1.0@beta -> satisfiable by drupal/media_thumbnails_video[1.0.0-beta1].
    - drupal/media_thumbnails_video 1.0.0-beta1 requires php-ffmpeg/php-ffmpeg ^0.14.0 -> found php-ffmpeg/php-ffmpeg[v0.14] but it conflicts with your root composer.json require (^1.0).
  Problem 2
    - php-ffmpeg/php-ffmpeg v1.x-dev requires php ^7.1 -> your php version (8.1.3) does not satisfy that requirement.
    - php-ffmpeg/php-ffmpeg[v1.0.0, ..., v1.0.1] require symfony/process ^5.4 || ^6.0 -> found symfony/process[v5.4.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.1.x-dev] but the package is fixed to v4.4.35 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires php-ffmpeg/php-ffmpeg ^1.0 -> satisfiable by php-ffmpeg/php-ffmpeg[v1.0.0, v1.0.1, v1.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require drupal/media_thumbnails_video:*" to figure out if any version is installable, or "composer require drupal/media_thumbnails_video:^2.1" if you know which you need.

The version 1.0.0 onwards of phpffmpeg support php 8.0.

Unfortunately,

composer require php-ffmpeg/php-ffmpeg:1.0.0

gives this other error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires php-ffmpeg/php-ffmpeg 1.0.0 -> satisfiable by php-ffmpeg/php-ffmpeg[v1.0.0].
    - php-ffmpeg/php-ffmpeg v1.0.0 requires symfony/process ^5.4 || ^6.0 -> found symfony/process[v5.4.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.1.x-dev] but the package is fixed to v4.4.35 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Drupal 9.x is fixed with symfony/process 4.x, so I don't know if it is possible to install the module at all with php8.x

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Giuseppe87 created an issue. See original summary.

lamp5’s picture

We do not lock any fixed version of php-ffmpeg library so lets try to
composer update drupal/media_thumbnails_video --with-all-dependencies
or try to remove vendor directory and composer.lock file. Then try to reinstall all project using
composer install

Note.
Only https://packagist.org/packages/php-ffmpeg/php-ffmpeg#v1.0.1 requires and locks php version to 8.0+

Giuseppe87’s picture

-

Giuseppe87’s picture

Sorry but they don't seems to work:

1. composer require drupal/media_thumbnails_video --with-all-dependencies doesn't work:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - php-ffmpeg/php-ffmpeg v0.14 requires php ^5.3.9 || ^7.0 -> your php version (8.1.3) does not satisfy that requirement.
    - drupal/media_thumbnails_video 1.0.0-beta1 requires php-ffmpeg/php-ffmpeg ^0.14.0 -> satisfiable by php-ffmpeg/php-ffmpeg[v0.14].
    - Root composer.json requires drupal/media_thumbnails_video ^1.0@beta -> satisfiable by drupal/media_thumbnails_video[1.0.0-beta1].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require drupal/media_thumbnails_video:*" to figure out if any version is installable, or "composer require drupal/media_thumbnails_video:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

2. Removing composer.lock and vendor even in the case would work would also potentially update any other packages in the composer.json. In my opnion, this is too risky to do with a site already in production.

I've seen that PHP-FFMpeg/PHP-FFMpeg v. 0.19.0 added the support to php 8.1 without locking yet symfony/process to ^5|^6, so I tried:

composer require php-ffmpeg/php-ffmpeg:0.19.0

which works.

However, after that:

composer require  drupal/media_thumbnails_video --with-all-dependencies

still gives errors:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires drupal/media_thumbnails_video ^1.0@beta -> satisfiable by drupal/media_thumbnails_video[1.0.0-beta1].
    - drupal/media_thumbnails_video 1.0.0-beta1 requires php-ffmpeg/php-ffmpeg ^0.14.0 -> found php-ffmpeg/php-ffmpeg[v0.14] but it conflicts with your root composer.json require (0.19.0).

You can also try re-running composer require with an explicit version constraint, e.g. "composer require drupal/media_thumbnails_video:*" to figure out if any version is installable, or "composer require drupal/media_thumbnails_video:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

And this is weird, I don't understand why the conflict at this point, as 0.19.0 should satisfy the "^0.14.0" requirement of the module

lamp5’s picture

Lets try to remove media_thumbnails_video and php-ffmpeg from your composer then try to re-add media_thumbnails_video. It is fresh project launched on php 8 or migrated from other php version / from other repository ?

Giuseppe87’s picture

The site is an installation which started directly with 9.3.x and php 8.0. It switched after some time to php 8.1.
It has already a good deal of other modules\requirements - e.g. commerce.

However I can reproduce the exact behaviors with a 9.3.x fresh installation - using drupal/recommended-project - with php 8.1 and literally nothing else.

lamp5’s picture

lamp5’s picture

Status: Active » Needs review

It looks like build works so it should fixes this issue.

quimic’s picture

@lamp5
In order to apply a patch via composer using cweagans/composer-patches, the module needs to be considered installable by composer first.
Composer first checks which packages to install, then applies patches.
Since it cannot find a suitable list of packages to install, it fails, and the patch is never applied.

See this excerpt from cweagans/composer-patches README:

Patching composer.json in dependencies

This doesn't work like you'd want. By the time you're running composer install, the metadata from your dependencies' composer.json has already been aggregated by packagist (or whatever metadata repo you're using). Unfortunately, this means that you cannot e.g. patch a dependency to be compatible with an earlier version of PHP or change the framework version that a plugin depends on.

lamp5’s picture

Yes. I know. It is the reason why I launched test build with php8.

  • lamp5 committed 81de2b0 on 8.x-1.x
    Issue #3274875 by lamp5: Compatibility error with php 8.x
    
lamp5’s picture

Status: Needs review » Active

Please test this module on php8, I set status to active to a future fixes if needed.

quimic’s picture

I confirm that the dev version of the module can be installed fine now (using php-ffmpeg v0.19 in my case). Haven't tested functionality yet.

lamp5’s picture

Please test, I am waiting for feedback.

quimic’s picture

@lamp5
It is difficult because I have never used the module before.
Wether or not I install the module, I see a thumbnail image for my remote video media. I cannot see any difference with/without the module.
The thumnail image is 480px wide, not the specified width in Media Thumbnails configuration, even if I use the Refresh button.

lamp5’s picture

This module generates thumbnails for local mp4 videos, not remote videos.

quimic’s picture

Sorry I misunderstood the purpose of the module. I am unable to test functionality then.
All I can say is that it installs fine using PHP 8.0 now.

Giuseppe87’s picture

Thanks for the quick update.

From my test, the module now installs and works on php 8.1.

dtarc’s picture

I've tested with php-ffmpeg 0.19.0 and I'm getting the following error:

Your FFProbe version is too old and does not support `-help` option, please upgrade.

Same error as https://www.drupal.org/project/media_thumbnails_video/issues/3182350

lamp5’s picture

So lets update your php-ffmpeg library.

dtarc’s picture

Ok. It's on 0.19.0. What should it be on?

alfattal’s picture

I tried this and the installation was successful:

composer require "php-ffmpeg/php-ffmpeg:^0.19.0" -W

This updated the PHP-FFMpeg/PHP-FFMpeg dependencies

./composer.json has been updated
Running composer update php-ffmpeg/php-ffmpeg --with-all-dependencies
Gathering patches for root package.
Loading composer repositories with package information
Updating dependencies                                 
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading symfony/filesystem (v5.4.9 => v5.4.12)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Downloading symfony/filesystem (v5.4.12)
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Upgrading symfony/filesystem (v5.4.9 => v5.4.12): Extracting archive

Then, I installed the dev version and it worked just fine

composer require 'drupal/media_thumbnails_video:1.x-dev@dev'

I'm on Drupal 9.4.5 and PHP 8.0

Anybody’s picture

So this seems fixes then based on the feedback from #22?

himanshu_sindhwani’s picture

Can we please update the installation instructions @lamp5 for drupal 9 and php 8. It will save time. I got the same issue and after an hour of work around found this thread.

Installation using composer:
composer require drupal/media_thumbnails_video

lamp5’s picture

Status: Active » Fixed

I was testing latest dev version with php 8.1 and works perfect. @himanshu_sindhwani there is no any special steps to upgrade this module.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.