Update VaapiHwDecodeConfig
- Drop out_range and format. ffmpeg will figure it out automatically. This should fix slightly wrong color without tonemapping - Always set tonemapping for preview/thumbnail jobs - Fix VaapiSwDecodeConfig without scalingpull/23680/head
parent
6913697ad1
commit
e9ac0c91b3
|
|
@ -18,6 +18,7 @@ import {
|
||||||
QueueName,
|
QueueName,
|
||||||
RawExtractedFormat,
|
RawExtractedFormat,
|
||||||
StorageFolder,
|
StorageFolder,
|
||||||
|
ToneMapping,
|
||||||
TranscodeHardwareAcceleration,
|
TranscodeHardwareAcceleration,
|
||||||
TranscodePolicy,
|
TranscodePolicy,
|
||||||
TranscodeTarget,
|
TranscodeTarget,
|
||||||
|
|
@ -424,8 +425,16 @@ export class MediaService extends BaseService {
|
||||||
}
|
}
|
||||||
const mainAudioStream = this.getMainStream(audioStreams);
|
const mainAudioStream = this.getMainStream(audioStreams);
|
||||||
|
|
||||||
const previewConfig = ThumbnailConfig.create({ ...ffmpeg, targetResolution: image.preview.size.toString() });
|
const previewConfig = ThumbnailConfig.create({
|
||||||
const thumbnailConfig = ThumbnailConfig.create({ ...ffmpeg, targetResolution: image.thumbnail.size.toString() });
|
...ffmpeg,
|
||||||
|
targetResolution: image.preview.size.toString(),
|
||||||
|
tonemap: ToneMapping.Hable,
|
||||||
|
});
|
||||||
|
const thumbnailConfig = ThumbnailConfig.create({
|
||||||
|
...ffmpeg,
|
||||||
|
targetResolution: image.thumbnail.size.toString(),
|
||||||
|
tonemap: ToneMapping.Hable,
|
||||||
|
});
|
||||||
const previewOptions = previewConfig.getCommand(TranscodeTarget.Video, mainVideoStream, mainAudioStream, format);
|
const previewOptions = previewConfig.getCommand(TranscodeTarget.Video, mainVideoStream, mainAudioStream, format);
|
||||||
const thumbnailOptions = thumbnailConfig.getCommand(
|
const thumbnailOptions = thumbnailConfig.getCommand(
|
||||||
TranscodeTarget.Video,
|
TranscodeTarget.Video,
|
||||||
|
|
|
||||||
|
|
@ -801,10 +801,13 @@ export class VaapiSwDecodeConfig extends BaseHWConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilterOptions(videoStream: VideoStreamInfo) {
|
getFilterOptions(videoStream: VideoStreamInfo) {
|
||||||
const options = this.getToneMapping(videoStream);
|
const tonemapOptions = this.getToneMapping(videoStream);
|
||||||
options.push('hwupload=extra_hw_frames=64');
|
const options = [...tonemapOptions, 'hwupload=extra_hw_frames=64'];
|
||||||
|
const format = videoStream.isHDR && tonemapOptions.length === 0 ? 'p010' : 'nv12';
|
||||||
if (this.shouldScale(videoStream)) {
|
if (this.shouldScale(videoStream)) {
|
||||||
options.push(`scale_vaapi=${this.getScaling(videoStream)}:mode=hq:out_range=pc:format=nv12`);
|
options.push(`scale_vaapi=${this.getScaling(videoStream)}:mode=hq:format=${format}`);
|
||||||
|
} else {
|
||||||
|
options.push(`scale_vaapi=format=${format}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
|
|
@ -867,10 +870,8 @@ export class VaapiHwDecodeConfig extends VaapiSwDecodeConfig {
|
||||||
getFilterOptions(videoStream: VideoStreamInfo) {
|
getFilterOptions(videoStream: VideoStreamInfo) {
|
||||||
const options = [];
|
const options = [];
|
||||||
const tonemapOptions = this.getToneMapping(videoStream);
|
const tonemapOptions = this.getToneMapping(videoStream);
|
||||||
if (tonemapOptions.length === 0 && !videoStream.pixelFormat.endsWith('420p')) {
|
if (this.shouldScale(videoStream)) {
|
||||||
options.push(`scale_vaapi=${this.getScaling(videoStream)}:mode=hq:out_range=pc:format=nv12`);
|
options.push(`scale_vaapi=${this.getScaling(videoStream)}:mode=hq`);
|
||||||
} else if (this.shouldScale(videoStream)) {
|
|
||||||
options.push(`scale_vaapi=${this.getScaling(videoStream)}:mode=hq:out_range=pc`);
|
|
||||||
}
|
}
|
||||||
options.push(...tonemapOptions);
|
options.push(...tonemapOptions);
|
||||||
return options;
|
return options;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue