X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fvideo-transcoding.ts;h=628f22f5ea9b8052c414e335900b87cdcf119e7d;hb=b405d663b4fcda051fe928f73b161b7040303b63;hp=444b0d954be1dc674d3d198798b98a09ec735249;hpb=8319d6ae72d4da6de51bd3d4b5c68040fc8dc3b4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index 444b0d954..628f22f5e 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts @@ -2,8 +2,8 @@ import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSER import { basename, extname as extnameUtil, join } from 'path' import { canDoQuickTranscode, - getMetadataFromFile, getDurationFromVideoFile, + getMetadataFromFile, getVideoFileFPS, transcode, TranscodeOptions, @@ -17,10 +17,9 @@ import { updateMasterHLSPlaylist, updateSha256Segments } from './hls' import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' import { VideoStreamingPlaylistType } from '../../shared/models/videos/video-streaming-playlist.type' import { CONFIG } from '../initializers/config' -import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoWithAllFiles, MVideoWithFile } from '@server/typings/models' +import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoWithAllFiles, MVideoWithFile } from '@server/types/models' import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' import { generateVideoStreamingPlaylistName, getVideoFilename, getVideoFilePath } from './video-paths' -import { extractVideo } from './videos' /** * Optimize the original video file and replace it. The resolution is not changed. @@ -208,7 +207,7 @@ async function generateHlsPlaylist (video: MVideoWithFile, resolution: VideoReso await createTorrentAndSetInfoHash(videoStreamingPlaylist, newVideoFile) - await newVideoFile.save() + await VideoFileModel.customUpsert(newVideoFile, 'streaming-playlist', undefined) videoStreamingPlaylist.VideoFiles = await videoStreamingPlaylist.$get('VideoFiles') video.setHLSPlaylist(videoStreamingPlaylist) @@ -237,12 +236,9 @@ async function onVideoFileTranscoding (video: MVideoWithFile, videoFile: MVideoF await move(transcodingPath, outputPath) - const extractedVideo = extractVideo(video) - videoFile.size = stats.size videoFile.fps = fps videoFile.metadata = metadata - videoFile.metadataUrl = extractedVideo.getVideoFileMetadataUrl(videoFile, extractedVideo.getBaseUrls().baseUrlHttp) await createTorrentAndSetInfoHash(video, videoFile)