2019-01-13 20:02:23 +00:00
|
|
|
using System;
|
2019-01-13 19:26:04 +00:00
|
|
|
using MediaBrowser.Controller.Configuration;
|
2018-12-14 09:40:55 +00:00
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
using MediaBrowser.Controller.MediaEncoding;
|
|
|
|
using MediaBrowser.Controller.Session;
|
2019-01-13 19:26:04 +00:00
|
|
|
using MediaBrowser.Model.Diagnostics;
|
2018-12-14 09:40:55 +00:00
|
|
|
using MediaBrowser.Model.IO;
|
2018-12-14 23:48:06 +00:00
|
|
|
using Microsoft.Extensions.Logging;
|
2018-12-14 09:40:55 +00:00
|
|
|
|
|
|
|
namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
|
{
|
|
|
|
public class VideoEncoder : BaseEncoder
|
|
|
|
{
|
|
|
|
public VideoEncoder(MediaEncoder mediaEncoder, ILogger logger, IServerConfigurationManager configurationManager, IFileSystem fileSystem, IIsoManager isoManager, ILibraryManager libraryManager, ISessionManager sessionManager, ISubtitleEncoder subtitleEncoder, IMediaSourceManager mediaSourceManager, IProcessFactory processFactory) : base(mediaEncoder, logger, configurationManager, fileSystem, isoManager, libraryManager, sessionManager, subtitleEncoder, mediaSourceManager, processFactory)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override string GetCommandLineArguments(EncodingJob state)
|
|
|
|
{
|
|
|
|
// Get the output codec name
|
|
|
|
var encodingOptions = GetEncodingOptions();
|
|
|
|
|
|
|
|
return EncodingHelper.GetProgressiveVideoFullCommandLine(state, encodingOptions, state.OutputFilePath, "superfast");
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override string GetOutputFileExtension(EncodingJob state)
|
|
|
|
{
|
|
|
|
var ext = base.GetOutputFileExtension(state);
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(ext))
|
|
|
|
{
|
|
|
|
return ext;
|
|
|
|
}
|
|
|
|
|
|
|
|
var videoCodec = state.Options.VideoCodec;
|
|
|
|
|
|
|
|
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return ".ts";
|
|
|
|
}
|
|
|
|
if (string.Equals(videoCodec, "theora", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return ".ogv";
|
|
|
|
}
|
|
|
|
if (string.Equals(videoCodec, "vpx", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return ".webm";
|
|
|
|
}
|
|
|
|
if (string.Equals(videoCodec, "wmv", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return ".asf";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-01-13 20:31:14 +00:00
|
|
|
protected override bool IsVideoEncoder => true;
|
2018-12-14 09:40:55 +00:00
|
|
|
}
|
2018-12-14 23:48:06 +00:00
|
|
|
}
|