1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Separate HLS audio and video streams

Allows:
  * The HLS player to propose an "Audio only" resolution
  * The live to output an "Audio only" resolution
  * The live to ingest and output an "Audio only" stream

 This feature is under a config for VOD videos and is enabled by default for lives

 In the future we can imagine:
  * To propose multiple audio streams for a specific video
  * To ingest an audio only VOD and just output an audio only "video"
    (the player would play the audio file and PeerTube would not
    generate additional resolutions)

This commit introduce a new way to download videos:
 * Add "/download/videos/generate/:videoId" endpoint where PeerTube can
   mux an audio only and a video only file to a mp4 container
 * The download client modal introduces a new default panel where the
   user can choose resolutions it wants to download
This commit is contained in:
Chocobozzz 2024-07-23 16:38:51 +02:00 committed by Chocobozzz
parent e77ba2dfbc
commit 816f346a60
186 changed files with 5748 additions and 2807 deletions

View file

@ -0,0 +1,53 @@
import * as Sequelize from 'sequelize'
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<void> {
const { transaction } = utils
{
await utils.queryInterface.addColumn('videoFile', 'formatFlags', {
type: Sequelize.INTEGER,
defaultValue: 2, // fragmented
allowNull: false
}, { transaction })
// Web videos
const query = 'UPDATE "videoFile" SET "formatFlags" = 1 WHERE "videoId" IS NOT NULL'
await utils.sequelize.query(query, { transaction })
await utils.queryInterface.changeColumn('videoFile', 'formatFlags', {
type: Sequelize.INTEGER,
defaultValue: null,
allowNull: false
}, { transaction })
}
{
await utils.queryInterface.addColumn('videoFile', 'streams', {
type: Sequelize.INTEGER,
defaultValue: 3, // audio + video
allowNull: false
}, { transaction })
// Case where there is only an audio stream
const query = 'UPDATE "videoFile" SET "streams" = 2 WHERE "resolution" = 0'
await utils.sequelize.query(query, { transaction })
await utils.queryInterface.changeColumn('videoFile', 'streams', {
type: Sequelize.INTEGER,
defaultValue: null,
allowNull: false
}, { transaction })
}
}
function down (options) {
throw new Error('Not implemented.')
}
export {
down, up
}