feat(all): transcoding improvements (#2171)

* test: rename some fixtures and add text for vertical video conversion

* feat: transcode video asset when audio or container don't match target

* chore: add niceness to the ffmpeg command to allow other processes to be prioritised

* chore: change video conversion queue to one concurrency

* feat: add transcode disabled preset to completely turn off transcoding

* linter

* Change log level and remove unused await

* opps forgot to save

* better logging

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Zack Pollard
2023-04-06 04:32:59 +01:00
committed by GitHub
parent 6f1d0a3caa
commit a5a6bebf0b
11 changed files with 190 additions and 50 deletions

View File

@@ -13,12 +13,15 @@ import {
import {
AlbumResponseDto,
AssetResponseDto,
AudioStreamInfo,
AuthUserDto,
ExifResponseDto,
mapUser,
SearchResult,
SharedLinkResponseDto,
VideoFormat,
VideoInfo,
VideoStreamInfo,
} from '../src';
const today = new Date();
@@ -706,10 +709,29 @@ export const searchStub = {
}),
};
const probeStubDefaultFormat: VideoFormat = {
formatName: 'mov,mp4,m4a,3gp,3g2,mj2',
formatLongName: 'QuickTime / MOV',
duration: 0,
};
const probeStubDefaultVideoStream: VideoStreamInfo[] = [
{ height: 1080, width: 1920, codecName: 'h265', codecType: 'video', frameCount: 100, rotation: 0 },
];
const probeStubDefaultAudioStream: AudioStreamInfo[] = [{ codecName: 'aac', codecType: 'audio' }];
const probeStubDefault: VideoInfo = {
format: probeStubDefaultFormat,
videoStreams: probeStubDefaultVideoStream,
audioStreams: probeStubDefaultAudioStream,
};
export const probeStub = {
empty: { streams: [] },
multiple: Object.freeze<VideoInfo>({
streams: [
noVideoStreams: Object.freeze<VideoInfo>({ ...probeStubDefault, videoStreams: [] }),
multipleVideoStreams: Object.freeze<VideoInfo>({
...probeStubDefault,
videoStreams: [
{
height: 1080,
width: 400,
@@ -729,7 +751,8 @@ export const probeStub = {
],
}),
noHeight: Object.freeze<VideoInfo>({
streams: [
...probeStubDefault,
videoStreams: [
{
height: 0,
width: 400,
@@ -740,11 +763,12 @@ export const probeStub = {
},
],
}),
tooBig: Object.freeze<VideoInfo>({
streams: [
videoStream2160p: Object.freeze<VideoInfo>({
...probeStubDefault,
videoStreams: [
{
height: 10000,
width: 10000,
height: 2160,
width: 3840,
codecName: 'h264',
codecType: 'video',
frameCount: 100,
@@ -752,4 +776,29 @@ export const probeStub = {
},
],
}),
videoStreamVertical2160p: Object.freeze<VideoInfo>({
...probeStubDefault,
videoStreams: [
{
height: 2160,
width: 3840,
codecName: 'h264',
codecType: 'video',
frameCount: 100,
rotation: 90,
},
],
}),
audioStreamMp3: Object.freeze<VideoInfo>({
...probeStubDefault,
audioStreams: [{ codecType: 'audio', codecName: 'aac' }],
}),
matroskaContainer: Object.freeze<VideoInfo>({
...probeStubDefault,
format: {
formatName: 'matroska,webm',
formatLongName: 'Matroska / WebM',
duration: 0,
},
}),
};