+ it('Should transcode high bit rate mp3 to proper bit rate', async function () {
+ this.timeout(60000)
+
+ const videoAttributes = {
+ name: 'mp3_256k',
+ fixture: 'video_short_mp3_256k.mp4'
+ }
+ await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const res = await getVideosList(server.url)
+
+ const video = res.body.data.find(v => v.name === videoAttributes.name)
+ const res2 = await getVideo(server.url, video.id)
+ const videoDetails: VideoDetails = res2.body
+
+ expect(videoDetails.files).to.have.lengthOf(4)
+
+ const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-240.mp4')
+ const probe = await audio.get(path)
+
+ if (probe.audioStream) {
+ expect(probe.audioStream[ 'codec_name' ]).to.be.equal('aac')
+ expect(probe.audioStream[ 'bit_rate' ]).to.be.at.most(384 * 8000)
+ } else {
+ this.fail('Could not retrieve the audio stream on ' + probe.absolutePath)
+ }
+ }
+ })
+
+ it('Should transcode video with no audio and have no audio itself', async function () {
+ this.timeout(60000)
+
+ const videoAttributes = {
+ name: 'no_audio',
+ fixture: 'video_short_no_audio.mp4'
+ }
+ await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const res = await getVideosList(server.url)
+
+ const video = res.body.data.find(v => v.name === videoAttributes.name)
+ const res2 = await getVideo(server.url, video.id)
+ const videoDetails: VideoDetails = res2.body
+
+ expect(videoDetails.files).to.have.lengthOf(4)
+ const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-240.mp4')
+ const probe = await audio.get(path)
+ expect(probe).to.not.have.property('audioStream')
+ }
+ })
+
+ it('Should leave the audio untouched, but properly transcode the video', async function () {
+ this.timeout(60000)
+
+ const videoAttributes = {
+ name: 'untouched_audio',
+ fixture: 'video_short.mp4'
+ }
+ await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const res = await getVideosList(server.url)
+
+ const video = res.body.data.find(v => v.name === videoAttributes.name)
+ const res2 = await getVideo(server.url, video.id)
+ const videoDetails: VideoDetails = res2.body
+
+ expect(videoDetails.files).to.have.lengthOf(4)
+ const fixturePath = buildAbsoluteFixturePath(videoAttributes.fixture)
+ const fixtureVideoProbe = await audio.get(fixturePath)
+ const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-240.mp4')
+ const videoProbe = await audio.get(path)
+ if (videoProbe.audioStream && fixtureVideoProbe.audioStream) {
+ const toOmit = [ 'max_bit_rate', 'duration', 'duration_ts', 'nb_frames', 'start_time', 'start_pts' ]
+ expect(omit(videoProbe.audioStream, toOmit)).to.be.deep.equal(omit(fixtureVideoProbe.audioStream, toOmit))
+ } else {
+ this.fail('Could not retrieve the audio stream on ' + videoProbe.absolutePath)
+ }
+ }
+ })
+
+ it('Should transcode a 60 FPS video', async function () {