Browse Source

hls changes

Luke Pulverenti 12 years ago
parent
commit
c3fa40715c

+ 2 - 2
MediaBrowser.Api/Playback/Hls/BaseHlsService.cs

@@ -230,7 +230,7 @@ namespace MediaBrowser.Api.Playback.Hls
         {
         {
             var probeSize = GetProbeSizeArgument(state.Item);
             var probeSize = GetProbeSizeArgument(state.Item);
 
 
-            var args = string.Format("{0} {1} {2} -i {3}{4} -threads 0 {5} {6} {7} -hls_time 10 -start_number 0 -hls_list_size 1440 \"{8}\"",
+            var args = string.Format("{0} {1} {2} -i {3}{4} -threads 0 {5} {6} -sc_threshold 0 {7} -hls_time 10 -start_number 0 -hls_list_size 1440 \"{8}\"",
                 probeSize,
                 probeSize,
                 GetUserAgentParam(state.Item),
                 GetUserAgentParam(state.Item),
                 GetFastSeekCommandLineParameter(state.Request),
                 GetFastSeekCommandLineParameter(state.Request),
@@ -246,7 +246,7 @@ namespace MediaBrowser.Api.Playback.Hls
             {
             {
                 var lowBitratePath = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath) + "-low.m3u8");
                 var lowBitratePath = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath) + "-low.m3u8");
 
 
-                var lowBitrateParams = string.Format(" -threads 0 -vn -codec:a:{1} aac -strict experimental -ac 2 -ab 64000 -hls_time 10 -start_number 0 -hls_list_size 1440 \"{0}\"",
+                var lowBitrateParams = string.Format(" -threads 0 -vn -codec:a:{1} libmp3lame -ac 2 -ab 32000 -hls_time 10 -start_number 0 -hls_list_size 1440 \"{0}\"",
                     lowBitratePath,
                     lowBitratePath,
                     state.AudioStream.Index);
                     state.AudioStream.Index);
 
 

+ 2 - 2
MediaBrowser.Api/Playback/Hls/VideoHlsService.cs

@@ -180,7 +180,7 @@ namespace MediaBrowser.Api.Playback.Hls
                 return IsH264(state.VideoStream) ? "-codec:v:0 copy -bsf h264_mp4toannexb" : "-codec:v:0 copy";
                 return IsH264(state.VideoStream) ? "-codec:v:0 copy -bsf h264_mp4toannexb" : "-codec:v:0 copy";
             }
             }
 
 
-            const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,1),gte(t,prev_forced_t+5))";
+            const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,.1),gte(t,prev_forced_t+5))";
 
 
             var args = "-codec:v:0 " + codec + " -preset superfast" + keyFrameArg;
             var args = "-codec:v:0 " + codec + " -preset superfast" + keyFrameArg;
 
 
@@ -188,7 +188,7 @@ namespace MediaBrowser.Api.Playback.Hls
 
 
             if (bitrate.HasValue)
             if (bitrate.HasValue)
             {
             {
-                args += string.Format(" -b:v {0} -maxrate {0} -minrate {0} -bufsize ({0}/10)", bitrate.Value.ToString(UsCulture));
+                args += string.Format(" -b:v {0} -maxrate {0} -minrate {0} -bufsize ({0}/11)", bitrate.Value.ToString(UsCulture));
             }
             }
             
             
             // Add resolution params, if specified
             // Add resolution params, if specified

+ 2 - 2
MediaBrowser.Api/Playback/Progressive/VideoService.cs

@@ -144,7 +144,7 @@ namespace MediaBrowser.Api.Playback.Progressive
                 return state.VideoStream != null && IsH264(state.VideoStream) ? args + " -bsf h264_mp4toannexb" : args;
                 return state.VideoStream != null && IsH264(state.VideoStream) ? args + " -bsf h264_mp4toannexb" : args;
             }
             }
 
 
-            const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,1),gte(t,prev_forced_t+5))";
+            const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,.1),gte(t,prev_forced_t+5))";
 
 
             args += keyFrameArg;
             args += keyFrameArg;
 
 
@@ -285,7 +285,7 @@ namespace MediaBrowser.Api.Playback.Progressive
 
 
             if (bitrate.HasValue)
             if (bitrate.HasValue)
             {
             {
-                args += " -b:v " + bitrate.Value.ToString(UsCulture);
+                args += string.Format(" -b:v {0} -maxrate {0} -minrate {0} -bufsize ({0}/11)", bitrate.Value.ToString(UsCulture));
             }
             }
 
 
             return args.Trim();
             return args.Trim();