aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-20 17:16:55 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-25 10:07:51 +0100
commitdaf6e4801052d3ca6be2fafd20bae2323b1ce175 (patch)
treea136af611c2543c461ce3fd126ddb7cb1e37a0c2 /server/lib
parent123f61933611f326ea5a5e8c2ea253ee8720e4f0 (diff)
downloadPeerTube-daf6e4801052d3ca6be2fafd20bae2323b1ce175.tar.gz
PeerTube-daf6e4801052d3ca6be2fafd20bae2323b1ce175.tar.zst
PeerTube-daf6e4801052d3ca6be2fafd20bae2323b1ce175.zip
Split ffmpeg utils with ffprobe utils
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/hls.ts14
-rw-r--r--server/lib/job-queue/handlers/video-file-import.ts12
-rw-r--r--server/lib/job-queue/handlers/video-import.ts2
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts5
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts2
-rw-r--r--server/lib/live-manager.ts9
-rw-r--r--server/lib/video-transcoding.ts11
7 files changed, 22 insertions, 33 deletions
diff --git a/server/lib/hls.ts b/server/lib/hls.ts
index 7aa152638..9ea83f337 100644
--- a/server/lib/hls.ts
+++ b/server/lib/hls.ts
@@ -1,17 +1,17 @@
1import { basename, dirname, join } from 'path'
2import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers/constants'
3import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra' 1import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra'
4import { getVideoStreamSize, getAudioStreamCodec, getVideoStreamCodec } from '../helpers/ffmpeg-utils' 2import { flatten, uniq } from 'lodash'
3import { basename, dirname, join } from 'path'
4import { MVideoWithFile } from '@server/types/models'
5import { sha256 } from '../helpers/core-utils' 5import { sha256 } from '../helpers/core-utils'
6import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' 6import { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamSize } from '../helpers/ffprobe-utils'
7import { logger } from '../helpers/logger' 7import { logger } from '../helpers/logger'
8import { doRequest, doRequestAndSaveToFile } from '../helpers/requests' 8import { doRequest, doRequestAndSaveToFile } from '../helpers/requests'
9import { generateRandomString } from '../helpers/utils' 9import { generateRandomString } from '../helpers/utils'
10import { flatten, uniq } from 'lodash'
11import { VideoFileModel } from '../models/video/video-file'
12import { CONFIG } from '../initializers/config' 10import { CONFIG } from '../initializers/config'
11import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers/constants'
13import { sequelizeTypescript } from '../initializers/database' 12import { sequelizeTypescript } from '../initializers/database'
14import { MVideoWithFile } from '@server/types/models' 13import { VideoFileModel } from '../models/video/video-file'
14import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'
15import { getVideoFilename, getVideoFilePath } from './video-paths' 15import { getVideoFilename, getVideoFilePath } from './video-paths'
16 16
17async function updateStreamingPlaylistsInfohashesIfNeeded () { 17async function updateStreamingPlaylistsInfohashesIfNeeded () {
diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts
index f9bc3137c..18823ee9c 100644
--- a/server/lib/job-queue/handlers/video-file-import.ts
+++ b/server/lib/job-queue/handlers/video-file-import.ts
@@ -1,15 +1,15 @@
1import * as Bull from 'bull' 1import * as Bull from 'bull'
2import { logger } from '../../../helpers/logger'
3import { VideoModel } from '../../../models/video/video'
4import { publishNewResolutionIfNeeded } from './video-transcoding'
5import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils'
6import { copy, stat } from 'fs-extra' 2import { copy, stat } from 'fs-extra'
7import { VideoFileModel } from '../../../models/video/video-file'
8import { extname } from 'path' 3import { extname } from 'path'
9import { MVideoFile, MVideoWithFile } from '@server/types/models'
10import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' 4import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
11import { getVideoFilePath } from '@server/lib/video-paths' 5import { getVideoFilePath } from '@server/lib/video-paths'
6import { MVideoFile, MVideoWithFile } from '@server/types/models'
12import { VideoFileImportPayload } from '@shared/models' 7import { VideoFileImportPayload } from '@shared/models'
8import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'
9import { logger } from '../../../helpers/logger'
10import { VideoModel } from '../../../models/video/video'
11import { VideoFileModel } from '../../../models/video/video-file'
12import { publishNewResolutionIfNeeded } from './video-transcoding'
13 13
14async function processVideoFileImport (job: Bull.Job) { 14async function processVideoFileImport (job: Bull.Job) {
15 const payload = job.data as VideoFileImportPayload 15 const payload = job.data as VideoFileImportPayload
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index 9210aec54..5a82a8d2b 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -17,7 +17,7 @@ import {
17} from '../../../../shared' 17} from '../../../../shared'
18import { VideoImportState } from '../../../../shared/models/videos' 18import { VideoImportState } from '../../../../shared/models/videos'
19import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' 19import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
20import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' 20import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'
21import { logger } from '../../../helpers/logger' 21import { logger } from '../../../helpers/logger'
22import { getSecureTorrentName } from '../../../helpers/utils' 22import { getSecureTorrentName } from '../../../helpers/utils'
23import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' 23import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent'
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts
index 599aabf80..447744224 100644
--- a/server/lib/job-queue/handlers/video-live-ending.ts
+++ b/server/lib/job-queue/handlers/video-live-ending.ts
@@ -1,7 +1,9 @@
1import * as Bull from 'bull' 1import * as Bull from 'bull'
2import { readdir, remove } from 'fs-extra' 2import { readdir, remove } from 'fs-extra'
3import { join } from 'path' 3import { join } from 'path'
4import { getDurationFromVideoFile, getVideoFileResolution, hlsPlaylistToFragmentedMP4 } from '@server/helpers/ffmpeg-utils' 4import { hlsPlaylistToFragmentedMP4 } from '@server/helpers/ffmpeg-utils'
5import { getDurationFromVideoFile, getVideoFileResolution } from '@server/helpers/ffprobe-utils'
6import { generateVideoMiniature } from '@server/lib/thumbnail'
5import { publishAndFederateIfNeeded } from '@server/lib/video' 7import { publishAndFederateIfNeeded } from '@server/lib/video'
6import { getHLSDirectory } from '@server/lib/video-paths' 8import { getHLSDirectory } from '@server/lib/video-paths'
7import { generateHlsPlaylist } from '@server/lib/video-transcoding' 9import { generateHlsPlaylist } from '@server/lib/video-transcoding'
@@ -12,7 +14,6 @@ import { VideoStreamingPlaylistModel } from '@server/models/video/video-streamin
12import { MStreamingPlaylist, MVideo, MVideoLive } from '@server/types/models' 14import { MStreamingPlaylist, MVideo, MVideoLive } from '@server/types/models'
13import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models' 15import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models'
14import { logger } from '../../../helpers/logger' 16import { logger } from '../../../helpers/logger'
15import { generateVideoMiniature } from '@server/lib/thumbnail'
16 17
17async function processVideoLiveEnding (job: Bull.Job) { 18async function processVideoLiveEnding (job: Bull.Job) {
18 const payload = job.data as VideoLiveEndingPayload 19 const payload = job.data as VideoLiveEndingPayload
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index 843a9f1b5..b6b8d9071 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -9,7 +9,7 @@ import {
9 VideoTranscodingPayload 9 VideoTranscodingPayload
10} from '../../../../shared' 10} from '../../../../shared'
11import { retryTransactionWrapper } from '../../../helpers/database-utils' 11import { retryTransactionWrapper } from '../../../helpers/database-utils'
12import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils' 12import { computeResolutionsToTranscode } from '../../../helpers/ffprobe-utils'
13import { logger } from '../../../helpers/logger' 13import { logger } from '../../../helpers/logger'
14import { CONFIG } from '../../../initializers/config' 14import { CONFIG } from '../../../initializers/config'
15import { sequelizeTypescript } from '../../../initializers/database' 15import { sequelizeTypescript } from '../../../initializers/database'
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts
index feb6c5275..4d2e9b1b3 100644
--- a/server/lib/live-manager.ts
+++ b/server/lib/live-manager.ts
@@ -4,13 +4,8 @@ import { FfmpegCommand } from 'fluent-ffmpeg'
4import { ensureDir, stat } from 'fs-extra' 4import { ensureDir, stat } from 'fs-extra'
5import { basename } from 'path' 5import { basename } from 'path'
6import { isTestInstance } from '@server/helpers/core-utils' 6import { isTestInstance } from '@server/helpers/core-utils'
7import { 7import { runLiveMuxing, runLiveTranscoding } from '@server/helpers/ffmpeg-utils'
8 computeResolutionsToTranscode, 8import { computeResolutionsToTranscode, getVideoFileFPS, getVideoFileResolution } from '@server/helpers/ffprobe-utils'
9 getVideoFileFPS,
10 getVideoFileResolution,
11 runLiveMuxing,
12 runLiveTranscoding
13} from '@server/helpers/ffmpeg-utils'
14import { logger } from '@server/helpers/logger' 9import { logger } from '@server/helpers/logger'
15import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config' 10import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config'
16import { MEMOIZE_TTL, P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE, VIEW_LIFETIME, WEBSERVER } from '@server/initializers/constants' 11import { MEMOIZE_TTL, P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE, VIEW_LIFETIME, WEBSERVER } from '@server/initializers/constants'
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts
index 9882a14db..ca969b235 100644
--- a/server/lib/video-transcoding.ts
+++ b/server/lib/video-transcoding.ts
@@ -4,15 +4,8 @@ import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
4import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoWithAllFiles, MVideoWithFile } from '@server/types/models' 4import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoWithAllFiles, MVideoWithFile } from '@server/types/models'
5import { VideoResolution } from '../../shared/models/videos' 5import { VideoResolution } from '../../shared/models/videos'
6import { VideoStreamingPlaylistType } from '../../shared/models/videos/video-streaming-playlist.type' 6import { VideoStreamingPlaylistType } from '../../shared/models/videos/video-streaming-playlist.type'
7import { 7import { transcode, TranscodeOptions, TranscodeOptionsType } from '../helpers/ffmpeg-utils'
8 canDoQuickTranscode, 8import { canDoQuickTranscode, getDurationFromVideoFile, getMetadataFromFile, getVideoFileFPS } from '../helpers/ffprobe-utils'
9 getDurationFromVideoFile,
10 getMetadataFromFile,
11 getVideoFileFPS,
12 transcode,
13 TranscodeOptions,
14 TranscodeOptionsType
15} from '../helpers/ffmpeg-utils'
16import { logger } from '../helpers/logger' 9import { logger } from '../helpers/logger'
17import { CONFIG } from '../initializers/config' 10import { CONFIG } from '../initializers/config'
18import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSERVER } from '../initializers/constants' 11import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSERVER } from '../initializers/constants'