Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix studio on only intro/outro/cut task

Chocobozzz8a8b57bebb53
diff --git a/packages/ffmpeg/src/shared/presets.ts b/packages/ffmpeg/src/shared/presets.ts
index 261362e4a7..9735b749b6 100644
--- a/packages/ffmpeg/src/shared/presets.ts
+++ b/packages/ffmpeg/src/shared/presets.ts
@@ -165,21 +165,20 @@ function applyVideoFilters (options: {
const command = commandWrapper.getCommand()
- if (videoFilters.length === 0) return
-
// We can't use `-vf` option if we have complex filters
if (chainComplexFilters) {
+ const { lastVideoInput, videoOutput } = chainComplexFilters
const complexFilters = [ ...chainComplexFilters.complexFilters ]
for (let i = 0; i < videoFilters.length; i++) {
const videoFilter = videoFilters[i]
const outputName = i === videoFilters.length - 1
- ? chainComplexFilters.videoOutput
+ ? videoOutput
: `vf_${i}`
const inputName = i === 0
- ? chainComplexFilters.lastVideoInput
+ ? lastVideoInput
: `vf_${i - 1}`
complexFilters.push({
@@ -194,8 +193,20 @@ function applyVideoFilters (options: {
})
}
+ // No video filter was chained onto the last complex filter output (can happen with concat or overlay)
+ // Alias it through a no-op filter so a `videoOutput` label can still be mapped
+ if (videoFilters.length === 0) {
+ complexFilters.push({
+ filter: 'null',
+ inputs: [ lastVideoInput ],
+ outputs: videoOutput
+ ? [ videoOutput ]
+ : undefined
+ })
+ }
+
command.complexFilter(complexFilters)
- } else {
+ } else if (videoFilters.length !== 0) {
const filterString = videoFilters
.map(f => {
if (f.rawOptions) return `${f.name}=${f.rawOptions}`
diff --git a/packages/tests/src/api/transcoding/video-studio.ts b/packages/tests/src/api/transcoding/video-studio.ts
index e83fa3e100..4bb0115b09 100644
--- a/packages/tests/src/api/transcoding/video-studio.ts
+++ b/packages/tests/src/api/transcoding/video-studio.ts
@@ -7,6 +7,7 @@ import {
doubleFollow,
ObjectStorageCommand,
PeerTubeServer,
+ PluginsCommand,
setAccessTokensToServers,
setDefaultVideoChannel,
VideoStudioCommand,
@@ -350,6 +351,90 @@ describe('Test video studio', function () {
})
})
+ describe('Editing with a profile that adds no video filter', function () {
+ before(async function () {
+ this.timeout(60_000)
+
+ await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath('-transcoding-one') })
+
+ await servers[0].config.save()
+ await servers[0].config.updateExistingConfig({
+ newConfig: {
+ transcoding: {
+ profile: 'low-vod'
+ }
+ }
+ })
+ })
+
+ it('Should add an intro', async function () {
+ this.timeout(120_000)
+ await renewVideo()
+
+ await createTasks([
+ {
+ name: 'add-intro',
+ options: {
+ file: 'video_short.webm'
+ }
+ }
+ ])
+
+ for (const server of servers) {
+ await checkVideoDuration(server, videoUUID, 10)
+ }
+ })
+
+ it('Should remove a segment', async function () {
+ this.timeout(120_000)
+ await renewVideo('video_short1.webm') // 10 seconds
+
+ await createTasks([
+ {
+ name: 'remove-segments',
+ options: {
+ segments: [ { start: 2, end: 6 } ]
+ }
+ }
+ ])
+
+ for (const server of servers) {
+ await checkVideoDuration(server, videoUUID, 6)
+ }
+ })
+
+ it('Should add a watermark', async function () {
+ this.timeout(120_000)
+ await renewVideo()
+
+ const video = await servers[0].videos.get({ id: videoUUID })
+ const oldFileUrls = getAllFiles(video).map(f => f.fileUrl)
+
+ await createTasks([
+ {
+ name: 'add-watermark',
+ options: {
+ file: 'custom-thumbnail.png'
+ }
+ }
+ ])
+
+ for (const server of servers) {
+ const video = await server.videos.get({ id: videoUUID })
+ const fileUrls = getAllFiles(video).map(f => f.fileUrl)
+
+ for (const oldUrl of oldFileUrls) {
+ expect(fileUrls).to.not.include(oldUrl)
+ }
+ }
+ })
+
+ after(async function () {
+ await servers[0].config.rollback()
+ await servers[0].plugins.uninstall({ npmName: 'peertube-plugin-test-transcoding-one' })
+ })
+ })
+
describe('HLS only studio edition', function () {
before(async function () {
await servers[0].config.enableMinimumTranscoding({ webVideo: false, hls: true })
diff --git a/support/docker/production/docker-compose.yml b/support/docker/production/docker-compose.yml
index 7bfece32dd..2ab7f0006f 100644
--- a/support/docker/production/docker-compose.yml
+++ b/support/docker/production/docker-compose.yml
@@ -84,10 +84,15 @@ services:
restart: "always"
postgres:
+ # Bumping the major version on an existing data directory requires a proper PostgreSQL upgrade
+ # See https://docs.joinpeertube.org/install/docker#upgrade-postgresql-container
image: postgres:17-alpine
env_file:
- .env
volumes:
+ # With PostgreSQL >= 18, witch the mount target to /var/lib/postgresql instead
+ # (data dir is nested under a subfolder, for example /var/lib/postgresql/18/docker)
+ # See https://hub.docker.com/_/postgres for more information
- ./docker-volume/db:/var/lib/postgresql/data
restart: "always"