mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* fix playback with invalid ffmpeg profile * fix 10 bit output with nvidia and graphics enginepull/2427/head
16 changed files with 13432 additions and 36 deletions
@ -0,0 +1,45 @@ |
|||||||
|
using ErsatzTV.Core.Domain; |
||||||
|
using ErsatzTV.FFmpeg; |
||||||
|
using ErsatzTV.FFmpeg.Format; |
||||||
|
using ErsatzTV.FFmpeg.Preset; |
||||||
|
|
||||||
|
namespace ErsatzTV.Core.FFmpeg; |
||||||
|
|
||||||
|
public static class FFmpegLibraryHelper |
||||||
|
{ |
||||||
|
public static ICollection<string> PresetsForFFmpegProfile( |
||||||
|
HardwareAccelerationKind hardwareAccelerationKind, |
||||||
|
FFmpegProfileVideoFormat videoFormat, |
||||||
|
FFmpegProfileBitDepth bitDepth) => AvailablePresets.ForAccelAndFormat( |
||||||
|
MapAccel(hardwareAccelerationKind), |
||||||
|
MapVideoFormat(videoFormat), |
||||||
|
MapBitDepth(bitDepth)); |
||||||
|
|
||||||
|
public static HardwareAccelerationMode MapAccel(HardwareAccelerationKind kind) => |
||||||
|
kind switch |
||||||
|
{ |
||||||
|
HardwareAccelerationKind.Amf => HardwareAccelerationMode.Amf, |
||||||
|
HardwareAccelerationKind.Nvenc => HardwareAccelerationMode.Nvenc, |
||||||
|
HardwareAccelerationKind.Qsv => HardwareAccelerationMode.Qsv, |
||||||
|
HardwareAccelerationKind.Vaapi => HardwareAccelerationMode.Vaapi, |
||||||
|
HardwareAccelerationKind.VideoToolbox => HardwareAccelerationMode.VideoToolbox, |
||||||
|
HardwareAccelerationKind.V4l2m2m => HardwareAccelerationMode.V4l2m2m, |
||||||
|
HardwareAccelerationKind.Rkmpp => HardwareAccelerationMode.Rkmpp, |
||||||
|
_ => HardwareAccelerationMode.None |
||||||
|
}; |
||||||
|
|
||||||
|
public static string MapVideoFormat(FFmpegProfileVideoFormat format) => |
||||||
|
format switch |
||||||
|
{ |
||||||
|
FFmpegProfileVideoFormat.H264 => VideoFormat.H264, |
||||||
|
FFmpegProfileVideoFormat.Hevc => VideoFormat.Hevc, |
||||||
|
_ => VideoFormat.Mpeg2Video |
||||||
|
}; |
||||||
|
|
||||||
|
public static int MapBitDepth(FFmpegProfileBitDepth bitDepth) => |
||||||
|
bitDepth switch |
||||||
|
{ |
||||||
|
FFmpegProfileBitDepth.EightBit => 8, |
||||||
|
_ => 10 |
||||||
|
}; |
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
namespace ErsatzTV.FFmpeg.Format; |
||||||
|
|
||||||
|
public class PixelFormatYuva420P10Le : IPixelFormat |
||||||
|
{ |
||||||
|
public string Name => PixelFormat.YUVA420P10LE; |
||||||
|
public string FFmpegName => FFmpegFormat.YUVA420P10; |
||||||
|
public int BitDepth => 10; |
||||||
|
} |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@ |
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||||
|
|
||||||
|
#nullable disable |
||||||
|
|
||||||
|
namespace ErsatzTV.Infrastructure.MySql.Migrations |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Add_FixH264VideoPreset : Migration |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
// clear video preset on all h264/10 bit ffmpeg profiles
|
||||||
|
migrationBuilder.Sql("UPDATE `FFmpegProfile` SET `VideoPreset`='' WHERE `VideoFormat` = 1 AND `BitDepth` = 1"); |
||||||
|
} |
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@ |
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||||
|
|
||||||
|
#nullable disable |
||||||
|
|
||||||
|
namespace ErsatzTV.Infrastructure.Sqlite.Migrations |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Add_FixH264VideoPreset : Migration |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
// clear video preset on all h264/10 bit ffmpeg profiles
|
||||||
|
migrationBuilder.Sql("UPDATE `FFmpegProfile` SET `VideoPreset`='' WHERE `VideoFormat` = 1 AND `BitDepth` = 1"); |
||||||
|
} |
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue