diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 6004129860..b1879b8d23 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -178,9 +178,7 @@ namespace MediaBrowser.Api.Playback.Hls
var probeSize = Kernel.Instance.FFMpegManager.GetProbeSizeArgument(state.Item);
- const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,0),gte(t,prev_forced_t+5))";
-
- return string.Format("{0} {1} -i {2}{3} -threads 0 {4} {5} {6}{7} -f ssegment -segment_list_flags +live -segment_time 10 -segment_list \"{8}\" \"{9}\"",
+ return string.Format("{0} {1} -i {2}{3} -threads 0 {4} {5} {6} -f ssegment -segment_list_flags +live -segment_time 10 -segment_list \"{7}\" \"{8}\"",
probeSize,
GetFastSeekCommandLineParameter(state.Request),
GetInputArgument(state.Item, state.IsoMount),
@@ -188,7 +186,6 @@ namespace MediaBrowser.Api.Playback.Hls
GetMapArgs(state),
GetVideoArguments(state),
GetAudioArguments(state),
- keyFrameArg,
outputPath,
segmentOutputPath
).Trim();
diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
index 699d45de3f..eb72f27d41 100644
--- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
@@ -8,14 +8,14 @@ using ServiceStack.ServiceHost;
namespace MediaBrowser.Api.Playback.Hls
{
[Route("/Videos/{Id}/stream.m3u8", "GET")]
- [ServiceStack.ServiceHost.Api(Description = "Gets a video stream using HTTP live streaming.")]
+ [Api(Description = "Gets a video stream using HTTP live streaming.")]
public class GetHlsVideoStream : VideoStreamRequest
{
}
[Route("/Videos/{Id}/segments/{SegmentId}/stream.ts", "GET")]
- [ServiceStack.ServiceHost.Api(Description = "Gets an Http live streaming segment file. Internal use only.")]
+ [Api(Description = "Gets an Http live streaming segment file. Internal use only.")]
public class GetHlsVideoSegment
{
public string Id { get; set; }
@@ -115,7 +115,9 @@ namespace MediaBrowser.Api.Playback.Hls
return IsH264(state.VideoStream) ? "-codec:v:0 copy -bsf h264_mp4toannexb" : "-codec:v:0 copy";
}
- var args = "-codec:v:0 " + codec + " -preset superfast";
+ const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,0),gte(t,prev_forced_t+5))";
+
+ var args = "-codec:v:0 " + codec + " -preset superfast" + keyFrameArg;
if (state.VideoRequest.VideoBitRate.HasValue)
{
@@ -154,6 +156,16 @@ namespace MediaBrowser.Api.Playback.Hls
args += " -vsync vfr";
+ if (!string.IsNullOrEmpty(state.VideoRequest.Profile))
+ {
+ args += " -profile:v" + state.VideoRequest.Profile;
+ }
+
+ if (!string.IsNullOrEmpty(state.VideoRequest.Level))
+ {
+ args += " -level 3" + state.VideoRequest.Level;
+ }
+
if (state.SubtitleStream != null)
{
// This is for internal graphical subs
diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
index 7a490cc705..b30a14ecc8 100644
--- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
@@ -81,17 +81,6 @@ namespace MediaBrowser.Api.Playback.Progressive
// Get the output codec name
var videoCodec = GetVideoCodec(state.VideoRequest);
- var graphicalSubtitleParam = string.Empty;
-
- if (state.SubtitleStream != null)
- {
- // This is for internal graphical subs
- if (!state.SubtitleStream.IsExternal && (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1))
- {
- graphicalSubtitleParam = GetInternalGraphicalSubtitleParam(state, videoCodec);
- }
- }
-
var format = string.Empty;
var keyFrame = string.Empty;
@@ -106,7 +95,7 @@ namespace MediaBrowser.Api.Playback.Progressive
keyFrame = " -g " + Math.Round(framerate);
}
- return string.Format("{0} {1} -i {2}{3}{4} -threads 0 {5} {6}{7} {8}{9} \"{10}\"",
+ return string.Format("{0} {1} -i {2}{3}{4} -threads 0 {5} {6} {7}{8} \"{9}\"",
probeSize,
GetFastSeekCommandLineParameter(state.Request),
GetInputArgument(video, state.IsoMount),
@@ -114,7 +103,6 @@ namespace MediaBrowser.Api.Playback.Progressive
keyFrame,
GetMapArgs(state),
GetVideoArguments(state, videoCodec),
- graphicalSubtitleParam,
GetAudioArguments(state),
format,
outputPath
@@ -125,42 +113,62 @@ namespace MediaBrowser.Api.Playback.Progressive
/// Gets video arguments to pass to ffmpeg
///
/// The state.
- /// The video codec.
+ /// The video codec.
/// System.String.
- private string GetVideoArguments(StreamState state, string videoCodec)
+ private string GetVideoArguments(StreamState state, string codec)
{
- var args = "-vcodec " + videoCodec;
+ var args = "-vcodec " + codec;
+
+ // See if we can save come cpu cycles by avoiding encoding
+ if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase))
+ {
+ return IsH264(state.VideoStream) ? args + " -bsf h264_mp4toannexb" : args;
+ }
+
+ const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,0),gte(t,prev_forced_t+2))";
+
+ args += keyFrameArg;
var request = state.VideoRequest;
- // If we're encoding video, add additional params
- if (!videoCodec.Equals("copy", StringComparison.OrdinalIgnoreCase))
+ // Add resolution params, if specified
+ if (request.Width.HasValue || request.Height.HasValue || request.MaxHeight.HasValue || request.MaxWidth.HasValue)
{
- // Add resolution params, if specified
- if (request.Width.HasValue || request.Height.HasValue || request.MaxHeight.HasValue || request.MaxWidth.HasValue)
- {
- args += GetOutputSizeParam(state, videoCodec);
- }
-
- if (request.Framerate.HasValue)
- {
- args += string.Format(" -r {0}", request.Framerate.Value);
- }
-
- // Add the audio bitrate
- var qualityParam = GetVideoQualityParam(request, videoCodec);
-
- if (!string.IsNullOrEmpty(qualityParam))
- {
- args += " " + qualityParam;
- }
-
- args += " -vsync vfr";
+ args += GetOutputSizeParam(state, codec);
}
- else if (IsH264(state.VideoStream))
+
+ if (request.Framerate.HasValue)
{
- // FFmpeg will fail to convert and give h264 bitstream malformated error if it isn't used when converting mp4 to transport stream.
- args += " -bsf h264_mp4toannexb";
+ args += string.Format(" -r {0}", request.Framerate.Value);
+ }
+
+ // Add the audio bitrate
+ var qualityParam = GetVideoQualityParam(request, codec);
+
+ if (!string.IsNullOrEmpty(qualityParam))
+ {
+ args += " " + qualityParam;
+ }
+
+ args += " -vsync vfr";
+
+ if (!string.IsNullOrEmpty(state.VideoRequest.Profile))
+ {
+ args += " -profile:v" + state.VideoRequest.Profile;
+ }
+
+ if (!string.IsNullOrEmpty(state.VideoRequest.Level))
+ {
+ args += " -level 3" + state.VideoRequest.Level;
+ }
+
+ if (state.SubtitleStream != null)
+ {
+ // This is for internal graphical subs
+ if (!state.SubtitleStream.IsExternal && (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1))
+ {
+ args += GetInternalGraphicalSubtitleParam(state, codec);
+ }
}
return args;
diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs
index a0b0a1a72d..d4da11e3f3 100644
--- a/MediaBrowser.Api/Playback/StreamRequest.cs
+++ b/MediaBrowser.Api/Playback/StreamRequest.cs
@@ -135,5 +135,19 @@ namespace MediaBrowser.Api.Playback
/// The framerate.
[ApiMember(Name = "Framerate", Description = "Optional. A specific video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.", IsRequired = false, DataType = "double", ParameterType = "query", Verb = "GET")]
public double? Framerate { get; set; }
+
+ ///
+ /// Gets or sets the profile.
+ ///
+ /// The profile.
+ [ApiMember(Name = "Profile", Description = "Optional. Specify a specific h264 profile, e.g. main, baseline, high.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string Profile { get; set; }
+
+ ///
+ /// Gets or sets the level.
+ ///
+ /// The level.
+ [ApiMember(Name = "Level", Description = "Optional. Specify a level for the h264 profile, e.g. 3, 3.1.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string Level { get; set; }
}
}
diff --git a/MediaBrowser.ServerApplication/EntryPoints/WebSocketEvents.cs b/MediaBrowser.ServerApplication/EntryPoints/WebSocketEvents.cs
index 2ee3193dc9..50d625739b 100644
--- a/MediaBrowser.ServerApplication/EntryPoints/WebSocketEvents.cs
+++ b/MediaBrowser.ServerApplication/EntryPoints/WebSocketEvents.cs
@@ -88,13 +88,13 @@ namespace MediaBrowser.ServerApplication.EntryPoints
void _taskManager_TaskCompleted(object sender, GenericEventArgs e)
{
- _serverManager.SendWebSocketMessage("ScheduledTaskEndExecute", e.Argument);
+ _serverManager.SendWebSocketMessage("ScheduledTaskEnded", e.Argument);
}
void _taskManager_TaskExecuting(object sender, EventArgs e)
{
var task = (IScheduledTask) sender;
- _serverManager.SendWebSocketMessage("ScheduledTaskBeginExecute", task.Name);
+ _serverManager.SendWebSocketMessage("ScheduledTaskStarted", task.Name);
}
///
@@ -164,7 +164,7 @@ namespace MediaBrowser.ServerApplication.EntryPoints
/// The instance containing the event data.
void kernel_HasPendingRestartChanged(object sender, EventArgs e)
{
- _serverManager.SendWebSocketMessage("HasPendingRestartChanged", _appHost.GetSystemInfo());
+ _serverManager.SendWebSocketMessage("RestartRequired", _appHost.GetSystemInfo());
}
///
diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec
index 19b811fe98..fbbddc5f31 100644
--- a/Nuget/MediaBrowser.Common.Internal.nuspec
+++ b/Nuget/MediaBrowser.Common.Internal.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common.Internal
- 3.0.61
+ 3.0.62
MediaBrowser.Common.Internal
Luke
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.
Copyright © Media Browser 2013
-
+
diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec
index 78a4fbbad3..34c9463da3 100644
--- a/Nuget/MediaBrowser.Common.nuspec
+++ b/Nuget/MediaBrowser.Common.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common
- 3.0.61
+ 3.0.62
MediaBrowser.Common
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
index 4a9693e7fe..0d554fb46f 100644
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ b/Nuget/MediaBrowser.Server.Core.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Server.Core
- 3.0.61
+ 3.0.62
Media Browser.Server.Core
Media Browser Team
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains core components required to build plugins for Media Browser Server.
Copyright © Media Browser 2013
-
+