minor changes per suggestions

pull/4432/head
nyanmisaka 4 years ago
parent 1abd3d1bd8
commit 5048719a64

@ -1412,7 +1412,7 @@ namespace Jellyfin.Api.Controllers
return string.Format( return string.Format(
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
"{0} {1} -map_metadata -1 -map_chapters -1 -threads {2} {3} {4} {5} -copyts -avoid_negative_ts disabled -max_muxing_queue_size {6} -f hls -max_delay 5000000 -hls_time {7} -individual_header_trailer 0 -hls_segment_type {8} -start_number {9} -hls_segment_filename \"{10}\" -hls_playlist_type vod -hls_list_size 0 -y \"{11}\"", "{0} {1} -map_metadata -1 -map_chapters -1 -threads {2} {3} {4} {5} -copyts -avoid_negative_ts 0 -max_muxing_queue_size {6} -f hls -max_delay 5000000 -hls_time {7} -individual_header_trailer 0 -hls_segment_type {8} -start_number {9} -hls_segment_filename \"{10}\" -hls_playlist_type vod -hls_list_size 0 -y \"{11}\"",
inputModifier, inputModifier,
_encodingHelper.GetInputArgument(state, encodingOptions), _encodingHelper.GetInputArgument(state, encodingOptions),
threads, threads,
@ -1576,7 +1576,9 @@ namespace Jellyfin.Api.Controllers
args += " " + gopArg; args += " " + gopArg;
} }
else if (string.Equals(codec, "libx264", StringComparison.OrdinalIgnoreCase) else if (string.Equals(codec, "libx264", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codec, "libx265", StringComparison.OrdinalIgnoreCase)) || string.Equals(codec, "libx265", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codec, "h264_vaapi", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codec, "hevc_vaapi", StringComparison.OrdinalIgnoreCase))
{ {
args += " " + keyFrameArg; args += " " + keyFrameArg;
} }

@ -9,13 +9,38 @@ namespace Jellyfin.Api.Helpers
/// </summary> /// </summary>
public static class HlsCodecStringHelpers public static class HlsCodecStringHelpers
{ {
/// <summary>
/// Codec name for MP3.
/// </summary>
public const string MP3 = "mp4a.40.34";
/// <summary>
/// Codec name for AC-3.
/// </summary>
public const string AC3 = "mp4a.a5";
/// <summary>
/// Codec name for E-AC-3.
/// </summary>
public const string EAC3 = "mp4a.a6";
/// <summary>
/// Codec name for FLAC.
/// </summary>
public const string FLAC = "fLaC";
/// <summary>
/// Codec name for ALAC.
/// </summary>
public const string ALAC = "alac";
/// <summary> /// <summary>
/// Gets a MP3 codec string. /// Gets a MP3 codec string.
/// </summary> /// </summary>
/// <returns>MP3 codec string.</returns> /// <returns>MP3 codec string.</returns>
public static string GetMP3String() public static string GetMP3String()
{ {
return "mp4a.40.34"; return MP3;
} }
/// <summary> /// <summary>
@ -40,6 +65,42 @@ namespace Jellyfin.Api.Helpers
return result.ToString(); return result.ToString();
} }
/// <summary>
/// Gets an AC-3 codec string.
/// </summary>
/// <returns>AC-3 codec string.</returns>
public static string GetAC3String()
{
return AC3;
}
/// <summary>
/// Gets an E-AC-3 codec string.
/// </summary>
/// <returns>E-AC-3 codec string.</returns>
public static string GetEAC3String()
{
return EAC3;
}
/// <summary>
/// Gets an FLAC codec string.
/// </summary>
/// <returns>FLAC codec string.</returns>
public static string GetFLACString()
{
return FLAC;
}
/// <summary>
/// Gets an ALAC codec string.
/// </summary>
/// <returns>ALAC codec string.</returns>
public static string GetALACString()
{
return ALAC;
}
/// <summary> /// <summary>
/// Gets a H.264 codec string. /// Gets a H.264 codec string.
/// </summary> /// </summary>
@ -104,41 +165,5 @@ namespace Jellyfin.Api.Helpers
return result.ToString(); return result.ToString();
} }
/// <summary>
/// Gets an AC-3 codec string.
/// </summary>
/// <returns>AC-3 codec string.</returns>
public static string GetAC3String()
{
return "mp4a.a5";
}
/// <summary>
/// Gets an E-AC-3 codec string.
/// </summary>
/// <returns>E-AC-3 codec string.</returns>
public static string GetEAC3String()
{
return "mp4a.a6";
}
/// <summary>
/// Gets an FLAC codec string.
/// </summary>
/// <returns>FLAC codec string.</returns>
public static string GetFLACString()
{
return "fLaC";
}
/// <summary>
/// Gets an ALAC codec string.
/// </summary>
/// <returns>ALAC codec string.</returns>
public static string GetALACString()
{
return "alac";
}
} }
} }

@ -662,6 +662,10 @@ namespace MediaBrowser.Controller.MediaEncoding
if (string.Equals(state.ActualOutputVideoCodec, "hevc", StringComparison.OrdinalIgnoreCase) if (string.Equals(state.ActualOutputVideoCodec, "hevc", StringComparison.OrdinalIgnoreCase)
|| string.Equals(state.ActualOutputVideoCodec, "h265", StringComparison.OrdinalIgnoreCase)) || string.Equals(state.ActualOutputVideoCodec, "h265", StringComparison.OrdinalIgnoreCase))
{ {
// Transcode to level 5.0 and lower for maximum compatibility
// level 5.0 is suitable for up to 4k 30fps hevc encoding, otherwise let the encoder to handle it
// https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding_tiers_and_levels
// MaxLumaSampleRate = 3840*2160*30 = 248832000 < 267386880,
if (requestLevel >= 150) if (requestLevel >= 150)
{ {
return "150"; return "150";
@ -3293,7 +3297,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (state.RunTimeTicks.HasValue && state.BaseRequest.CopyTimestamps) if (state.RunTimeTicks.HasValue && state.BaseRequest.CopyTimestamps)
{ {
args += " -copyts -avoid_negative_ts disabled -start_at_zero"; args += " -copyts -avoid_negative_ts 0 -start_at_zero";
} }
if (!state.RunTimeTicks.HasValue) if (!state.RunTimeTicks.HasValue)
@ -3341,7 +3345,7 @@ namespace MediaBrowser.Controller.MediaEncoding
args += " -copyts"; args += " -copyts";
} }
args += " -avoid_negative_ts disabled"; args += " -avoid_negative_ts 0";
if (!(state.SubtitleStream != null && state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream)) if (!(state.SubtitleStream != null && state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream))
{ {

Loading…
Cancel
Save