- it('Should import a video on server 2 with some fields', async function () {
- this.timeout(60000)
-
- const attributes = {
- targetUrl: getYoutubeVideoUrl(),
- channelId: channelIdServer2,
- privacy: VideoPrivacy.PUBLIC,
- category: 10,
- licence: 7,
- language: 'en',
- name: 'my super name',
- description: 'my super description',
- tags: [ 'supertag1', 'supertag2' ]
- }
- const res = await importVideo(servers[1].url, servers[1].accessToken, attributes)
- expect(res.body.video.name).to.equal('my super name')
- })
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const video = await server.videos.get({ id: videoUUID })
+
+ expect(video.name).to.equal('transcoded video')
+ expect(video.files).to.have.lengthOf(4)
+ }
+ })
+
+ it('Should import no HDR version on a HDR video', async function () {
+ this.timeout(300_000)
+
+ const config: DeepPartial<CustomConfig> = {
+ transcoding: {
+ enabled: true,
+ resolutions: {
+ '0p': false,
+ '144p': true,
+ '240p': true,
+ '360p': false,
+ '480p': false,
+ '720p': false,
+ '1080p': false, // the resulting resolution shouldn't be higher than this, and not vp9.2/av01
+ '1440p': false,
+ '2160p': false
+ },
+ webtorrent: { enabled: true },
+ hls: { enabled: false }
+ }
+ }
+ await servers[0].config.updateExistingSubConfig({ newConfig: config })
+
+ const attributes = {
+ name: 'hdr video',
+ targetUrl: FIXTURE_URLS.youtubeHDR,
+ channelId: servers[0].store.channel.id,
+ privacy: VideoPrivacy.PUBLIC
+ }
+ const { video: videoImported } = await servers[0].imports.importVideo({ attributes })
+ const videoUUID = videoImported.uuid
+
+ await waitJobs(servers)
+
+ // test resolution
+ const video = await servers[0].videos.get({ id: videoUUID })
+ expect(video.name).to.equal('hdr video')
+ const maxResolution = Math.max.apply(Math, video.files.map(function (o) { return o.resolution.id }))
+ expect(maxResolution, 'expected max resolution not met').to.equals(VideoResolution.H_240P)
+ })
+
+ it('Should not import resolution higher than enabled transcoding resolution', async function () {
+ this.timeout(300_000)
+
+ const config: DeepPartial<CustomConfig> = {
+ transcoding: {
+ enabled: true,
+ resolutions: {
+ '0p': false,
+ '144p': true,
+ '240p': false,
+ '360p': false,
+ '480p': false,
+ '720p': false,
+ '1080p': false,
+ '1440p': false,
+ '2160p': false
+ },
+ alwaysTranscodeOriginalResolution: false
+ }
+ }
+ await servers[0].config.updateExistingSubConfig({ newConfig: config })
+
+ const attributes = {
+ name: 'small resolution video',
+ targetUrl: FIXTURE_URLS.youtube,
+ channelId: servers[0].store.channel.id,
+ privacy: VideoPrivacy.PUBLIC
+ }
+ const { video: videoImported } = await servers[0].imports.importVideo({ attributes })
+ const videoUUID = videoImported.uuid
+
+ await waitJobs(servers)
+
+ // test resolution
+ const video = await servers[0].videos.get({ id: videoUUID })
+ expect(video.name).to.equal('small resolution video')
+ expect(video.files).to.have.lengthOf(1)
+ expect(video.files[0].resolution.id).to.equal(144)
+ })
+
+ it('Should import resolution higher than enabled transcoding resolution', async function () {
+ this.timeout(300_000)
+
+ const config: DeepPartial<CustomConfig> = {
+ transcoding: {
+ alwaysTranscodeOriginalResolution: true
+ }
+ }
+ await servers[0].config.updateExistingSubConfig({ newConfig: config })
+
+ const attributes = {
+ name: 'bigger resolution video',
+ targetUrl: FIXTURE_URLS.youtube,
+ channelId: servers[0].store.channel.id,
+ privacy: VideoPrivacy.PUBLIC
+ }
+ const { video: videoImported } = await servers[0].imports.importVideo({ attributes })
+ const videoUUID = videoImported.uuid
+
+ await waitJobs(servers)
+
+ // test resolution
+ const video = await servers[0].videos.get({ id: videoUUID })
+ expect(video.name).to.equal('bigger resolution video')
+
+ expect(video.files).to.have.lengthOf(2)
+ expect(video.files.find(f => f.resolution.id === 240)).to.exist
+ expect(video.files.find(f => f.resolution.id === 144)).to.exist
+ })