Closed yoGhurrt1 closed 7 months ago
Hi. I came across such a problem myself and fixed it this way. In file /var/www/nextcloud/apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php replace line $command = "ffmpeg -threads $threads {$additionalConversionFlags} -i {$this->tempSourcePath} {$this->tempOutputPath}" with $command = "ffmpeg -threads $threads -i {$this->tempSourcePath} {$additionalConversionFlags} {$this->tempOutputPath}"
Hi. I came across such a problem myself and fixed it this way. In file /var/www/nextcloud/apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php replace line $command = "ffmpeg -threads $threads {$additionalConversionFlags} -i {$this->tempSourcePath} {$this->tempOutputPath}" with $command = "ffmpeg -threads $threads -i {$this->tempSourcePath} {$additionalConversionFlags} {$this->tempOutputPath}"
Thanks ColdRosin, I tried your suggestion and there was difference as it didn't end with error message. However, now it's stuck on "converting" and throwing error "ParseError syntax error, unexpected variable "$process""
Raw log entry:
{ "reqId": "C77phrAG78kAUFEFX4LJ", "level": 3, "time": "2024-02-18T21:35:02+00:00", "remoteAddr": "", "user": "--", "app": "cron", "method": "", "url": "--", "message": "Exception thrown: ParseError", "userAgent": "--", "version": "28.0.2.5", "exception": { "Exception": "ParseError", "Message": "syntax error, unexpected variable \"$process\"", "Code": 0, "Trace": [ { "file": "/var/www/nextcloud/lib/composer/composer/ClassLoader.php", "line": 427, "function": "Composer\Autoload\{closure}", "args": [ " sensitive parameters replaced " ] }, { "function": "loadClass", "class": "Composer\Autoload\ClassLoader", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php", "line": 126, "function": "__construct", "class": "ReflectionClass", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php", "line": 146, "function": "resolve", "class": "OC\AppFramework\Utility\SimpleContainer", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php", "line": 468, "function": "query", "class": "OC\AppFramework\Utility\SimpleContainer", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/ServerContainer.php", "line": 155, "function": "queryNoFallback", "class": "OC\AppFramework\DependencyInjection\DIContainer", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php", "line": 64, "function": "query", "class": "OC\ServerContainer", "type": "->" }, { "file": "/var/www/nextcloud/lib/public/Server.php", "line": 55, "function": "get", "class": "OC\AppFramework\Utility\SimpleContainer", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/BackgroundJob/JobList.php", "line": 326, "function": "get", "class": "OCP\Server", "type": "::" }, { "file": "/var/www/nextcloud/lib/private/BackgroundJob/JobList.php", "line": 235, "function": "buildJob", "class": "OC\BackgroundJob\JobList", "type": "->" }, { "file": "/var/www/nextcloud/cron.php", "line": 145, "function": "getNext", "class": "OC\BackgroundJob\JobList", "type": "->" } ], "File": "/var/www/nextcloud/apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php", "Line": 162, "CustomMessage": "Exception thrown: ParseError" }, "id": "65d278081e1f1" }
Maybe I missed something, but just replaced what you suggested in specific file.
Most likely, you made a mistake with the syntax. Please check the function in the file
/var/www/nextcloud/apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php
public function convertMedia() {
$threads = $this->configService->getAppConfigValue('threadLimit', 0);
$additionalConversionFlags = empty($this->additionalConversionFlags) ? '' : " {$this->additionalConversionFlags}";
$command = "ffmpeg -threads $threads -i {$this->tempSourcePath} {$additionalConversionFlags} {$this->tempOutputPath}";
$process = $this->processFactory->create($command);
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
return $this;
}
There was a ; missing after line (as always). After that instead of stuck, it just stops with "Has-Failures" and throws error.
[workflow_media_converter] Error: [Error] :: (0) :: Call to a member function getUID() on null :: #0 /var/www/nextcloud/lib/private/FilesMetadata/Listener/MetadataUpdate.php(59): OC\FilesMetadata\FilesMetadataManager->refreshMetadata()
#1 /var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php(86): OC\FilesMetadata\Listener\MetadataUpdate->handle()
#2 /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(230): OC\EventDispatcher\ServiceEventListener->__invoke()
#3 /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(59): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#4 /var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php(94): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#5 /var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php(106): OC\EventDispatcher\EventDispatcher->dispatch()
#6 /var/www/nextcloud/lib/private/Files/Node/HookConnector.php(109): OC\EventDispatcher\EventDispatcher->dispatchTyped()
#7 /var/www/nextcloud/lib/private/legacy/OC_Hook.php(105): OC\Files\Node\HookConnector->postWrite()
#8 /var/www/nextcloud/lib/private/Files/View.php(613): OC_Hook::emit()
#9 /var/www/nextcloud/lib/private/Files/View.php(667): OC\Files\View->emit_file_hooks_post()
#10 /var/www/nextcloud/lib/private/Files/View.php(1043): OC\Files\View->file_put_contents()
#11 /var/www/nextcloud/apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php(260): OC\Files\View->fromTmpFile()
#12 /var/www/nextcloud/apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php(194): OCA\WorkflowMediaConverter\BackgroundJobs\ConvertMediaJob->writeFileSafe()
#13 /var/www/nextcloud/apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php(174): OCA\WorkflowMediaConverter\BackgroundJobs\ConvertMediaJob->writePostConversionOutputFile()
#14 /var/www/nextcloud/apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php(66): OCA\WorkflowMediaConverter\BackgroundJobs\ConvertMediaJob->handlePostConversion()
#15 /var/www/nextcloud/lib/public/BackgroundJob/Job.php(81): OCA\WorkflowMediaConverter\BackgroundJobs\ConvertMediaJob->run()
#16 /var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php(57): OCP\BackgroundJob\Job->start()
#17 /var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php(47): OCP\BackgroundJob\QueuedJob->start()
#18 /var/www/nextcloud/cron.php(152): OCP\BackgroundJob\QueuedJob->execute()
#19 {main}
from ? by -- at 25 Feb 2024, 17:35:58
This is how it looks like directly on server. I tested even replacing whole function but this didn't change plugin behaviour.
Edit:
Now I see it throws error and converts files - just coincidence I found that there was output.
I also had this issue. We should really have separate fields for input options and output options, and make sure the complete command line field is not editable, as it's misleading.
In the next release (1.10.0), there are separate fields for input options and output options, and the command line field is not editable.
In addition (for backwards compatibility) - if the command fails with the flags placed before the -i
flag, the plugin will retry another command with the flags placed after the -i
flag.
Closing, if there are other issues please create new ones 👍.
Thanks for all the discussion!
Oh great, I was about to try doing that.
Steps to reproduce
I tried to modify command structure in last text-box where command fulfill when adding extra commands, but it didn't change anything
Expected behaviour
Media converter should execute command in this pattern: ffmpeg -i {input} -threads 0 -c:v libx264 -movflags faststart -preset veryslow -crf 18 -pix_fmt yuv420p -c:a aac {output}
Actual behaviour
Instead, Media Converter just bundles everything before -i {input} so whole command looks like this: ffmpeg -threads 0 -c:v libx264 -movflags faststart -preset veryslow -crf 18 -pix_fmt yuv420p -c:a aac -i {input} {output}
I'm sure that this is problem with command structure because manually this command (of course with file instead of /tmp) exits with same error. It isn't problem with ffmpeg as it executes command from "Expected behavior" run directly on Nextcloud VM.
Workflow Media Converter app
Workflow Media Converter app version: 1.9.3
Server configuration
Operating system: Ubuntu 22.04
Web server: Apache 2.4.52
Database: Maria 10.6.16
PHP version: 8.1.2
Nextcloud Version: 28.0.1
Where did you install Nextcloud from: manually trough repositories instead of snap
Signing status:
List of activated apps:
Nextcloud configuration:
Are you using external storage, if yes which one: SMB
Are you using encryption: no
Server log (data/nextcloud.log)