Skip to content

Commit

Permalink
Release v0.5.2 (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
mszulik authored Jul 24, 2024
2 parents 0b018d0 + 98f0cbd commit 3abec9d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
21 changes: 15 additions & 6 deletions app/Jobs/TranscodeVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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.
*
Expand All @@ -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'
)
);
}
Expand Down Expand Up @@ -381,5 +391,4 @@ protected function getTempVideoDerivativesDirectoryPath(): string
{
return sprintf('%s-%s-temp', $this->version->Media->baseDirectory(), $this->version->getKey());
}

}
4 changes: 2 additions & 2 deletions docker-compose.pullpreview.yml → compose.pullpreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)'
Expand Down
File renamed without changes.

0 comments on commit 3abec9d

Please sign in to comment.