mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-02-20 03:22:54 +00:00
update metadata editor
This commit is contained in:
@@ -342,9 +342,55 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
inputModifier += " -re";
|
||||
}
|
||||
|
||||
var videoDecoder = GetVideoDecoder(job);
|
||||
if (!string.IsNullOrWhiteSpace(videoDecoder))
|
||||
{
|
||||
inputModifier += " " + videoDecoder;
|
||||
}
|
||||
|
||||
return inputModifier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the output video codec
|
||||
/// </summary>
|
||||
/// <param name="state">The state.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
protected string GetVideoDecoder(EncodingJob state)
|
||||
{
|
||||
if (string.Equals(GetEncodingOptions().HardwareVideoDecoder, "qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
|
||||
{
|
||||
switch (state.MediaSource.VideoStream.Codec.ToLower())
|
||||
{
|
||||
case "avc":
|
||||
case "h264":
|
||||
if (MediaEncoder.SupportsDecoder("h264_qsv"))
|
||||
{
|
||||
return "-c:v h264_qsv ";
|
||||
}
|
||||
break;
|
||||
case "mpeg2video":
|
||||
if (MediaEncoder.SupportsDecoder("mpeg2_qsv"))
|
||||
{
|
||||
return "-c:v mpeg2_qsv ";
|
||||
}
|
||||
break;
|
||||
case "vc1":
|
||||
if (MediaEncoder.SupportsDecoder("vc1_qsv"))
|
||||
{
|
||||
return "-c:v vc1_qsv ";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// leave blank so ffmpeg will decide
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetUserAgentParam(EncodingJob job)
|
||||
{
|
||||
string useragent = null;
|
||||
@@ -436,7 +482,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
state.IsoMount = await IsoManager.Mount(state.MediaPath, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (state.MediaSource.RequiresOpening)
|
||||
if (state.MediaSource.RequiresOpening && string.IsNullOrWhiteSpace(state.LiveStreamId))
|
||||
{
|
||||
var liveStreamResponse = await MediaSourceManager.OpenLiveStream(new LiveStreamRequest
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
public bool EnableMpegtsM2TsMode { get; set; }
|
||||
public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
|
||||
public long? EncodingDurationTicks { get; set; }
|
||||
public string LiveTvStreamId { get; set; }
|
||||
public string LiveStreamId { get; set; }
|
||||
public long? RunTimeTicks;
|
||||
|
||||
public string ItemType { get; set; }
|
||||
|
||||
@@ -326,26 +326,36 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
/// <returns>System.Nullable{System.Int32}.</returns>
|
||||
private int? GetNumAudioChannelsParam(EncodingJobOptions request, MediaStream audioStream, string outputAudioCodec)
|
||||
{
|
||||
if (audioStream != null)
|
||||
{
|
||||
var codec = outputAudioCodec ?? string.Empty;
|
||||
var inputChannels = audioStream == null
|
||||
? null
|
||||
: audioStream.Channels;
|
||||
|
||||
if (audioStream.Channels > 2 && codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
// wmav2 currently only supports two channel output
|
||||
return 2;
|
||||
}
|
||||
if (inputChannels <= 0)
|
||||
{
|
||||
inputChannels = null;
|
||||
}
|
||||
|
||||
var codec = outputAudioCodec ?? string.Empty;
|
||||
|
||||
if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
// wmav2 currently only supports two channel output
|
||||
return Math.Min(2, inputChannels ?? 2);
|
||||
}
|
||||
|
||||
if (request.MaxAudioChannels.HasValue)
|
||||
{
|
||||
if (audioStream != null && audioStream.Channels.HasValue)
|
||||
if (inputChannels.HasValue)
|
||||
{
|
||||
return Math.Min(request.MaxAudioChannels.Value, audioStream.Channels.Value);
|
||||
return Math.Min(request.MaxAudioChannels.Value, inputChannels.Value);
|
||||
}
|
||||
|
||||
var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1
|
||||
? 2
|
||||
: 6;
|
||||
|
||||
// If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels
|
||||
return Math.Min(request.MaxAudioChannels.Value, 5);
|
||||
return Math.Min(request.MaxAudioChannels.Value, channelLimit);
|
||||
}
|
||||
|
||||
return request.AudioChannels;
|
||||
@@ -519,6 +529,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
return false;
|
||||
}
|
||||
|
||||
if (videoStream.IsAnamorphic ?? false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Can't stream copy if we're burning in subtitles
|
||||
if (request.SubtitleStreamIndex.HasValue)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user