+ it('Should provide valid ffprobe data', async function () {
+ this.timeout(160_000)
+
+ const videoUUID = (await servers[1].videos.quickUpload({ name: 'ffprobe data' })).uuid
+ await waitJobs(servers)
+
+ {
+ const path = servers[1].servers.buildDirectory(join('videos', videoUUID + '-240.mp4'))
+ const metadata = await getMetadataFromFile(path)
+
+ // expected format properties
+ for (const p of [
+ 'tags.encoder',
+ 'format_long_name',
+ 'size',
+ 'bit_rate'
+ ]) {
+ expect(metadata.format).to.have.nested.property(p)
+ }
+
+ // expected stream properties
+ for (const p of [
+ 'codec_long_name',
+ 'profile',
+ 'width',
+ 'height',
+ 'display_aspect_ratio',
+ 'avg_frame_rate',
+ 'pix_fmt'
+ ]) {
+ expect(metadata.streams[0]).to.have.nested.property(p)
+ }
+
+ expect(metadata).to.not.have.nested.property('format.filename')
+ }
+
+ for (const server of servers) {
+ const videoDetails = await server.videos.get({ id: videoUUID })
+
+ const videoFiles = videoDetails.files
+ .concat(videoDetails.streamingPlaylists[0].files)
+ expect(videoFiles).to.have.lengthOf(8)
+
+ for (const file of videoFiles) {
+ expect(file.metadata).to.be.undefined
+ expect(file.metadataUrl).to.exist
+ expect(file.metadataUrl).to.contain(servers[1].url)
+ expect(file.metadataUrl).to.contain(videoUUID)
+
+ const metadata = await server.videos.getFileMetadata({ url: file.metadataUrl })
+ expect(metadata).to.have.nested.property('format.size')
+ }
+ }
+ })
+
+ it('Should correctly detect if quick transcode is possible', async function () {
+ this.timeout(10_000)
+
+ expect(await canDoQuickTranscode(buildAbsoluteFixturePath('video_short.mp4'))).to.be.true
+ expect(await canDoQuickTranscode(buildAbsoluteFixturePath('video_short.webm'))).to.be.false
+ })
+ })
+
+ describe('Transcoding job queue', function () {
+
+ it('Should have the appropriate priorities for transcoding jobs', async function () {
+ const body = await servers[1].jobs.getJobsList({
+ start: 0,
+ count: 100,
+ sort: '-createdAt',
+ jobType: 'video-transcoding'
+ })
+
+ const jobs = body.data
+ const transcodingJobs = jobs.filter(j => j.data.videoUUID === video4k)
+
+ expect(transcodingJobs).to.have.lengthOf(14)
+
+ const hlsJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-hls')
+ const webtorrentJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-webtorrent')
+ const optimizeJobs = transcodingJobs.filter(j => j.data.type === 'optimize-to-webtorrent')
+
+ expect(hlsJobs).to.have.lengthOf(7)
+ expect(webtorrentJobs).to.have.lengthOf(6)
+ expect(optimizeJobs).to.have.lengthOf(1)
+
+ for (const j of optimizeJobs.concat(hlsJobs.concat(webtorrentJobs))) {
+ expect(j.priority).to.be.greaterThan(100)
+ expect(j.priority).to.be.lessThan(150)
+ }
+ })