diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 64862da601..fa230473bf 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -2180,14 +2180,9 @@ namespace MediaBrowser.Api.Playback
if (state.VideoRequest != null)
{
- var videoCodec = GetVideoEncoder(state);
- // See if we can save come cpu cycles by avoiding encoding
- if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase))
{
- if (string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase))
- {
- inputModifier += " -noaccurate_seek";
- }
+ inputModifier += " -noaccurate_seek";
}
}
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
index c6abffd07c..95ff8cd0c1 100644
--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
@@ -513,7 +513,11 @@ namespace MediaBrowser.Api.Playback.Hls
// Main stream
var playlistUrl = isLiveStream ? "live.m3u8" : "main.m3u8";
- playlistUrl += queryString;
+
+ if ((Request.UserAgent ?? string.Empty).IndexOf("roku", StringComparison.OrdinalIgnoreCase) == -1)
+ {
+ playlistUrl += queryString;
+ }
var request = state.Request;
diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs
index 2ab2d11f60..5a2c286d5c 100644
--- a/MediaBrowser.Api/Playback/MediaInfoService.cs
+++ b/MediaBrowser.Api/Playback/MediaInfoService.cs
@@ -318,15 +318,17 @@ namespace MediaBrowser.Api.Playback
if (streamInfo != null)
{
streamInfo.PlaySessionId = playSessionId;
- SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
- }
- if (streamInfo != null && streamInfo.PlayMethod == PlayMethod.Transcode)
- {
- streamInfo.StartPositionTicks = startTimeTicks;
- mediaSource.TranscodingUrl = streamInfo.ToUrl("-", auth.Token).TrimStart('-');
- mediaSource.TranscodingContainer = streamInfo.Container;
- mediaSource.TranscodingSubProtocol = streamInfo.SubProtocol;
+ if (streamInfo.PlayMethod == PlayMethod.Transcode)
+ {
+ streamInfo.StartPositionTicks = startTimeTicks;
+ mediaSource.TranscodingUrl = streamInfo.ToUrl("-", auth.Token).TrimStart('-');
+ mediaSource.TranscodingContainer = streamInfo.Container;
+ mediaSource.TranscodingSubProtocol = streamInfo.SubProtocol;
+ }
+
+ // Do this after the above so that StartPositionTicks is set
+ SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
}
}
}
diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
index 51bb71bfb8..19e568ec47 100644
--- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
@@ -10,6 +10,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
using ServiceStack;
using System;
+using System.Globalization;
using System.IO;
using CommonIO;
@@ -100,7 +101,6 @@ namespace MediaBrowser.Api.Playback.Progressive
{
// Comparison: https://github.com/jansmolders86/mediacenterjs/blob/master/lib/transcoding/desktop.js
format = " -f mp4 -movflags frag_keyframe+empty_moov";
- //format = " -avoid_negative_ts disabled -start_at_zero -copyts -f mp4 -movflags frag_keyframe+empty_moov";
}
var threads = GetNumberOfThreads(state, string.Equals(videoCodec, "libvpx", StringComparison.OrdinalIgnoreCase));
@@ -124,27 +124,26 @@ 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 codec)
+ private string GetVideoArguments(StreamState state, string videoCodec)
{
- var args = "-codec:v:0 " + codec;
+ var args = "-codec:v:0 " + videoCodec;
if (state.EnableMpegtsM2TsMode)
{
args += " -mpegts_m2ts_mode 1";
}
- // See if we can save come cpu cycles by avoiding encoding
- if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
+ var isOutputMkv = string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase);
+
+ if (state.RunTimeTicks.HasValue)
+ {
+ //args += " -copyts -avoid_negative_ts disabled -start_at_zero";
+ }
+
+ if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- var isOutputMkv = string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase);
-
- if (isOutputMkv)
- {
- //args += " -copyts -avoid_negative_ts disabled -start_at_zero";
- }
-
if (state.VideoStream != null && IsH264(state.VideoStream) &&
(string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) || isOutputMkv))
{
@@ -164,10 +163,10 @@ namespace MediaBrowser.Api.Playback.Progressive
// Add resolution params, if specified
if (!hasGraphicalSubs)
{
- args += GetOutputSizeParam(state, codec);
+ args += GetOutputSizeParam(state, videoCodec);
}
- var qualityParam = GetVideoQualityParam(state, codec, false);
+ var qualityParam = GetVideoQualityParam(state, videoCodec, false);
if (!string.IsNullOrEmpty(qualityParam))
{
@@ -177,7 +176,7 @@ namespace MediaBrowser.Api.Playback.Progressive
// This is for internal graphical subs
if (hasGraphicalSubs)
{
- args += GetGraphicalSubtitleParam(state, codec);
+ args += GetGraphicalSubtitleParam(state, videoCodec);
}
return args;