diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 97af562bf..318f41dc1 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -15,6 +15,9 @@ import { arrayify, buildDownloadFilesUrl, exists } from '@peertube/peertube-core import { BooleanBothQuery, FeedFormat, + FeedFormatType, + FeedType, + FeedType_Type, NSFWPolicyType, ResultList, ServerErrorCode, @@ -200,18 +203,21 @@ export class VideoService { } buildBaseFeedUrls (params: HttpParams, base = VideoService.BASE_FEEDS_URL) { - const feeds = [ + const feeds: { type: FeedType_Type, format: FeedFormatType, label: string, url: string }[] = [ { + type: FeedType.VIDEOS, format: FeedFormat.RSS, label: 'media rss 2.0', url: base + FeedFormat.RSS.toLowerCase() }, { + type: FeedType.VIDEOS, format: FeedFormat.ATOM, label: 'atom 1.0', url: base + FeedFormat.ATOM.toLowerCase() }, { + type: FeedType.VIDEOS, format: FeedFormat.JSON, label: 'json 1.0', url: base + FeedFormat.JSON.toLowerCase() @@ -255,6 +261,7 @@ export class VideoService { const feedUrls = this.buildBaseFeedUrls(params) feedUrls.push({ + type: FeedType.PODCAST, format: FeedFormat.PODCAST, label: 'podcast rss 2.0', url: VideoService.PODCAST_FEEDS_URL + `?videoChannelId=${videoChannelId}` diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts index 6010b3325..75a90d1d3 100644 --- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts +++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts @@ -2,7 +2,7 @@ import { NgClass, NgIf, NgTemplateOutlet } from '@angular/common' import { Component, OnChanges, inject, input, viewChild } from '@angular/core' import { AuthService, Notifier, RedirectService } from '@app/core' import { NgbDropdown, NgbDropdownMenu, NgbDropdownToggle } from '@ng-bootstrap/ng-bootstrap' -import { FeedFormat } from '@peertube/peertube-models' +import { FeedFormat, FeedType } from '@peertube/peertube-models' import { concat, forkJoin, merge } from 'rxjs' import { Account } from '../shared-main/account/account.model' import { VideoChannel } from '../shared-main/channel/video-channel.model' @@ -84,7 +84,7 @@ export class SubscribeButtonComponent implements OnChanges { ? undefined : this.videoService .getVideoChannelFeedUrls(this.videoChannels()[0].id) - .find(i => i.format === FeedFormat.PODCAST) + .find(i => i.type === FeedType.PODCAST) .url } diff --git a/packages/ffmpeg/src/ffmpeg-container.ts b/packages/ffmpeg/src/ffmpeg-container.ts index a3399f186..d14d98ee0 100644 --- a/packages/ffmpeg/src/ffmpeg-container.ts +++ b/packages/ffmpeg/src/ffmpeg-container.ts @@ -17,17 +17,23 @@ export class FFmpegContainer { }) { const { inputs, output, logError, coverPath } = options - this.commandWrapper.buildCommand(inputs) - .outputOption('-c copy') - .outputOption('-movflags frag_keyframe+empty_moov') - .format('mp4') - .output(output) + const command = this.commandWrapper.buildCommand(inputs) + + for (let i = 0; i < inputs.length; i++) { + command.outputOption('-map ' + i) + } if (coverPath) { - this.commandWrapper.getCommand() - .addInput(coverPath) + command.addInput(coverPath) + command.outputOption('-map ' + inputs.length) } + command.outputOption('-c copy') + .outputOption('-movflags frag_every_frame+empty_moov') + .outputOption('-min_frag_duration 5M') // 5 seconds + .format('mp4') + .output(output) + return this.commandWrapper.runCommand({ silent: !logError }) } diff --git a/packages/models/src/feeds/feed-format.enum.ts b/packages/models/src/feeds/feed-format.enum.ts index 46042359e..604fb6746 100644 --- a/packages/models/src/feeds/feed-format.enum.ts +++ b/packages/models/src/feeds/feed-format.enum.ts @@ -6,3 +6,10 @@ export const FeedFormat = { } as const export type FeedFormatType = typeof FeedFormat[keyof typeof FeedFormat] + +export const FeedType = { + VIDEOS: 'videos', + PODCAST: 'podcast' +} as const + +export type FeedType_Type = typeof FeedType[keyof typeof FeedType] diff --git a/server/core/controllers/feeds/video-podcast-feeds.ts b/server/core/controllers/feeds/video-podcast-feeds.ts index 6babddd57..c972e1037 100644 --- a/server/core/controllers/feeds/video-podcast-feeds.ts +++ b/server/core/controllers/feeds/video-podcast-feeds.ts @@ -301,7 +301,7 @@ function buildVODStreamingPlaylists (video: MVideoFullLight) { baseUrl: WEBSERVER.URL, videoFiles: files.map(f => f.id), videoUUID: video.uuid, - extension: videoFile.hasVideo() && videoFile.hasAudio() + extension: videoFile.hasVideo() ? '.mp4' : '.m4a' }) diff --git a/support/nginx/peertube b/support/nginx/peertube index bcca944e7..01bbbf35a 100644 --- a/support/nginx/peertube +++ b/support/nginx/peertube @@ -111,8 +111,8 @@ server { } location ~ ^/api/v1/(videos|video-playlists|video-channels|users/me) { - client_max_body_size 6M; # default is 1M - add_header X-File-Maximum-Size 4M always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size) + client_max_body_size 12M; # default is 1M + add_header X-File-Maximum-Size 8M always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size) try_files /dev/null @api; }