add configurable encoding params
This commit is contained in:
parent
daeedb98ea
commit
9c7eef891b
|
@ -346,12 +346,28 @@ namespace MediaBrowser.Api.Playback
|
|||
var isVc1 = state.VideoStream != null &&
|
||||
string.Equals(state.VideoStream.Codec, "vc1", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
var encodingOptions = ApiEntryPoint.Instance.GetEncodingOptions();
|
||||
|
||||
if (string.Equals(videoCodec, "libx264", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(encodingOptions.H264Preset))
|
||||
{
|
||||
param = "-preset " + encodingOptions.H264Preset;
|
||||
}
|
||||
else
|
||||
{
|
||||
param = "-preset superfast";
|
||||
}
|
||||
|
||||
if (encodingOptions.H264Crf >= 0 && encodingOptions.H264Crf <= 51)
|
||||
{
|
||||
param = " -crf " + encodingOptions.H264Crf.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
param += " -crf 23";
|
||||
}
|
||||
}
|
||||
|
||||
else if (string.Equals(videoCodec, "libx265", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
|
|
@ -113,7 +113,8 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
var standaloneTypes = new List<string>
|
||||
{
|
||||
CollectionType.Playlists
|
||||
CollectionType.Playlists,
|
||||
CollectionType.BoxSets
|
||||
};
|
||||
|
||||
var collectionFolder = folder as ICollectionFolder;
|
||||
|
|
|
@ -928,7 +928,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
{
|
||||
StartProcess(processWrapper);
|
||||
|
||||
ranToCompletion = process.WaitForExit(10000);
|
||||
var timeoutMs = ConfigurationManager.Configuration.ImageExtractionTimeoutMs;
|
||||
if (timeoutMs <= 0)
|
||||
{
|
||||
timeoutMs = 10000;
|
||||
}
|
||||
ranToCompletion = process.WaitForExit(timeoutMs);
|
||||
|
||||
if (!ranToCompletion)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,8 @@ namespace MediaBrowser.Model.Configuration
|
|||
public string HardwareAccelerationType { get; set; }
|
||||
public string EncoderAppPath { get; set; }
|
||||
public string VaapiDevice { get; set; }
|
||||
public int H264Crf { get; set; }
|
||||
public string H264Preset { get; set; }
|
||||
|
||||
public EncodingOptions()
|
||||
{
|
||||
|
@ -19,6 +21,8 @@ namespace MediaBrowser.Model.Configuration
|
|||
ThrottleDelaySeconds = 180;
|
||||
EncodingThreadCount = -1;
|
||||
VaapiDevice = "/dev/dri/card0";
|
||||
H264Crf = 23;
|
||||
H264Preset = "superfast";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,6 +207,7 @@ namespace MediaBrowser.Model.Configuration
|
|||
public bool EnableChannelView { get; set; }
|
||||
public bool EnableExternalContentInSuggestions { get; set; }
|
||||
|
||||
public int ImageExtractionTimeoutMs { get; set; }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
||||
/// </summary>
|
||||
|
@ -216,6 +217,7 @@ namespace MediaBrowser.Model.Configuration
|
|||
Migrations = new string[] { };
|
||||
CodecsUsed = new string[] { };
|
||||
SqliteCacheSize = 0;
|
||||
ImageExtractionTimeoutMs = 10000;
|
||||
|
||||
EnableLocalizedGuids = true;
|
||||
DisplaySpecialsWithinSeasons = true;
|
||||
|
|
|
@ -14,17 +14,20 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CommonIO;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.UserViews
|
||||
{
|
||||
public class DynamicImageProvider : BaseDynamicImageProvider<UserView>
|
||||
{
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public DynamicImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, IUserManager userManager)
|
||||
public DynamicImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, IUserManager userManager, ILibraryManager libraryManager)
|
||||
: base(fileSystem, providerManager, applicationPaths, imageProcessor)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
public override IEnumerable<ImageType> GetSupportedImages(IHasImages item)
|
||||
|
@ -50,7 +53,15 @@ namespace MediaBrowser.Server.Implementations.UserViews
|
|||
|
||||
if (string.Equals(view.ViewType, CollectionType.LiveTv, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new List<BaseItem>();
|
||||
var programs = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
|
||||
ImageTypes = new[] { ImageType.Primary },
|
||||
Limit = 30,
|
||||
IsMovie = true
|
||||
}).ToList();
|
||||
|
||||
return GetFinalItems(programs).ToList();
|
||||
}
|
||||
|
||||
if (string.Equals(view.ViewType, SpecialFolder.MovieGenre, StringComparison.OrdinalIgnoreCase) ||
|
||||
|
@ -147,6 +158,7 @@ namespace MediaBrowser.Server.Implementations.UserViews
|
|||
CollectionType.MusicVideos,
|
||||
CollectionType.HomeVideos,
|
||||
CollectionType.BoxSets,
|
||||
CollectionType.LiveTv,
|
||||
CollectionType.Playlists,
|
||||
CollectionType.Photos,
|
||||
string.Empty
|
||||
|
|
Loading…
Reference in New Issue
Block a user