+ await transcode(transcodeOptions)
+
+ const playlistUrl = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid)
+
+ const [ videoStreamingPlaylist ] = await VideoStreamingPlaylistModel.upsert({
+ videoId: video.id,
+ playlistUrl,
+ segmentsSha256Url: WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid, video.isLive),
+ p2pMediaLoaderInfohashes: [],
+ p2pMediaLoaderPeerVersion: P2P_MEDIA_LOADER_PEER_VERSION,
+
+ type: VideoStreamingPlaylistType.HLS
+ }, { returning: true }) as [ MStreamingPlaylistFilesVideo, boolean ]
+ videoStreamingPlaylist.Video = video
+
+ const newVideoFile = new VideoFileModel({
+ resolution,
+ extname: extnameUtil(videoFilename),
+ size: 0,
+ fps: -1,
+ videoStreamingPlaylistId: videoStreamingPlaylist.id
+ })
+
+ const videoFilePath = getVideoFilePath(videoStreamingPlaylist, newVideoFile)
+ const stats = await stat(videoFilePath)
+
+ newVideoFile.size = stats.size
+ newVideoFile.fps = await getVideoFileFPS(videoFilePath)
+ newVideoFile.metadata = await getMetadataFromFile(videoFilePath)