diff --git a/app/Jobs/TranscodeVideo.php b/app/Jobs/TranscodeVideo.php index 8a2180a..4bb0b30 100644 --- a/app/Jobs/TranscodeVideo.php +++ b/app/Jobs/TranscodeVideo.php @@ -175,10 +175,7 @@ protected function loadVideo(FFMpeg $ffmpeg): StreamingMedia { return $this->isLocalFilesystem($this->originalsDisk) ? $ffmpeg->open($this->originalsDisk->path($this->originalFilePath)) - : $ffmpeg->openFromCloud( - CloudStorage::getOpenConfiguration($this->originalsDisk->path($this->originalFilePath)), - $this->localDisk->path($this->tempOriginalFilename) - ); + : $this->openFromCloud($ffmpeg); } /** @@ -193,6 +190,19 @@ protected function isLocalFilesystem(Filesystem $disk): bool return $disk->getAdapter() instanceof LocalFilesystemAdapter; } + /** + * The original needs to be available locally, since transcoding to MP4 uses the basic PHP-FFmpeg package, which cannot access cloud storages. + * + * @param FFMpeg $ffmpeg + * @return StreamingMedia + */ + protected function openFromCloud(FFMpeg $ffmpeg): StreamingMedia + { + $this->localDisk->writeStream($this->tempOriginalFilename, $this->originalsDisk->readStream($this->originalFilePath)); + + return $ffmpeg->open($this->localDisk->path($this->tempOriginalFilename)); + } + /** * Sets the file name and file paths which are needed for the transcoding process. * @@ -219,7 +229,7 @@ protected function saveVideo(Streaming $video, string $format): void $video->save($this->derivativesDisk->path($this->getTempVideoDerivativeFilePath($format))) : $video->save(null, CloudStorage::getSaveConfiguration( - sprintf('%s/%s', $this->derivativesDisk->path($this->tempDerivativesDirectoryPath), $format), $this->version->Media->identifier + sprintf('%s/%s', $this->derivativesDisk->path($this->tempDerivativesDirectoryPath), $format), 'video' ) ); } @@ -381,5 +391,4 @@ protected function getTempVideoDerivativesDirectoryPath(): string { return sprintf('%s-%s-temp', $this->version->Media->baseDirectory(), $this->version->getKey()); } - } diff --git a/docker-compose.pullpreview.yml b/compose.pullpreview.yml similarity index 98% rename from docker-compose.pullpreview.yml rename to compose.pullpreview.yml index 42dec8e..be0ca25 100644 --- a/docker-compose.pullpreview.yml +++ b/compose.pullpreview.yml @@ -66,8 +66,8 @@ services: TRANSMORPHER_WEB_API_BASE_URL: https://${PULLPREVIEW_PUBLIC_DNS}/transmorpherServer/api APP_URL: ${PULLPREVIEW_URL} volumes: - - 'amigor-storage:/var/www/html/storage' - - '.env.amigor:/var/www/html/.env' + - 'amigor-storage:/var/www/html/amigor/storage' + - '.env.amigor:/var/www/html/amigor/.env' labels: - 'traefik.enable=true' - 'traefik.http.routers.${AMIGOR_CONTAINER_NAME:-amigor}.rule=Host(`${PULLPREVIEW_PUBLIC_DNS}`)' diff --git a/docker-compose.yml b/compose.yml similarity index 100% rename from docker-compose.yml rename to compose.yml