fix refFrames not being recorded

This commit is contained in:
Luke Pulverenti 2015-04-24 23:30:44 -04:00
parent 4d57e9b63e
commit 25cdbf014e
4 changed files with 42 additions and 11 deletions

View File

@ -1,7 +1,9 @@
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using ServiceStack; using ServiceStack;
using System.Threading;
namespace MediaBrowser.Api namespace MediaBrowser.Api
{ {
@ -52,7 +54,14 @@ namespace MediaBrowser.Api
var options = GetRefreshOptions(request); var options = GetRefreshOptions(request);
_providerManager.QueueRefresh(item.Id, options); if (item is Folder)
{
_providerManager.QueueRefresh(item.Id, options);
}
else
{
_providerManager.RefreshFullItem(item, options, CancellationToken.None);
}
} }
private MetadataRefreshOptions GetRefreshOptions(BaseRefreshRequest request) private MetadataRefreshOptions GetRefreshOptions(BaseRefreshRequest request)

View File

@ -119,7 +119,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
var extractKeyFrameInterval = request.ExtractKeyFrameInterval && request.Protocol == MediaProtocol.File && request.VideoType == VideoType.VideoFile; var extractKeyFrameInterval = request.ExtractKeyFrameInterval && request.Protocol == MediaProtocol.File && request.VideoType == VideoType.VideoFile;
return GetMediaInfoInternal(GetInputArgument(inputFiles, request.Protocol), request.InputPath, request.Protocol, extractChapters, extractKeyFrameInterval, return GetMediaInfoInternal(GetInputArgument(inputFiles, request.Protocol), request.InputPath, request.Protocol, extractChapters, extractKeyFrameInterval,
GetProbeSizeArgument(inputFiles, request.Protocol), request.MediaType == DlnaProfileType.Audio, cancellationToken); GetProbeSizeArgument(inputFiles, request.Protocol), request.MediaType == DlnaProfileType.Audio, request.VideoType, cancellationToken);
} }
/// <summary> /// <summary>
@ -155,6 +155,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
/// <param name="extractKeyFrameInterval">if set to <c>true</c> [extract key frame interval].</param> /// <param name="extractKeyFrameInterval">if set to <c>true</c> [extract key frame interval].</param>
/// <param name="probeSizeArgument">The probe size argument.</param> /// <param name="probeSizeArgument">The probe size argument.</param>
/// <param name="isAudio">if set to <c>true</c> [is audio].</param> /// <param name="isAudio">if set to <c>true</c> [is audio].</param>
/// <param name="videoType">Type of the video.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{MediaInfoResult}.</returns> /// <returns>Task{MediaInfoResult}.</returns>
/// <exception cref="System.ApplicationException"></exception> /// <exception cref="System.ApplicationException"></exception>
@ -165,6 +166,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
bool extractKeyFrameInterval, bool extractKeyFrameInterval,
string probeSizeArgument, string probeSizeArgument,
bool isAudio, bool isAudio,
VideoType videoType,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var args = extractChapters var args = extractChapters
@ -236,7 +238,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
} }
} }
var mediaInfo = new ProbeResultNormalizer(_logger, FileSystem).GetMediaInfo(result, isAudio, primaryPath, protocol); var mediaInfo = new ProbeResultNormalizer(_logger, FileSystem).GetMediaInfo(result, videoType, isAudio, primaryPath, protocol);
if (extractKeyFrameInterval && mediaInfo.RunTimeTicks.HasValue) if (extractKeyFrameInterval && mediaInfo.RunTimeTicks.HasValue)
{ {

View File

@ -25,7 +25,7 @@ namespace MediaBrowser.MediaEncoding.Probing
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
public Model.MediaInfo.MediaInfo GetMediaInfo(InternalMediaInfoResult data, bool isAudio, string path, MediaProtocol protocol) public Model.MediaInfo.MediaInfo GetMediaInfo(InternalMediaInfoResult data, VideoType videoType, bool isAudio, string path, MediaProtocol protocol)
{ {
var info = new Model.MediaInfo.MediaInfo var info = new Model.MediaInfo.MediaInfo
{ {
@ -79,7 +79,7 @@ namespace MediaBrowser.MediaEncoding.Probing
var videoStream = info.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video); var videoStream = info.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
if (videoStream != null) if (videoStream != null && videoType == VideoType.VideoFile)
{ {
UpdateFromMediaInfo(info, videoStream); UpdateFromMediaInfo(info, videoStream);
} }
@ -863,12 +863,14 @@ namespace MediaBrowser.MediaEncoding.Probing
private void UpdateFromMediaInfo(MediaSourceInfo video, MediaStream videoStream) private void UpdateFromMediaInfo(MediaSourceInfo video, MediaStream videoStream)
{ {
if (video.VideoType == VideoType.VideoFile && video.Protocol == MediaProtocol.File) if (video.Protocol == MediaProtocol.File)
{ {
if (videoStream != null) if (videoStream != null)
{ {
try try
{ {
_logger.Debug("Running MediaInfo against {0}", video.Path);
var result = new MediaInfoLib().GetVideoInfo(video.Path); var result = new MediaInfoLib().GetVideoInfo(video.Path);
videoStream.IsCabac = result.IsCabac ?? videoStream.IsCabac; videoStream.IsCabac = result.IsCabac ?? videoStream.IsCabac;

View File

@ -456,7 +456,7 @@ namespace MediaBrowser.Model.Dlna
playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue); playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
} }
int audioBitrate = GetAudioBitrate(playlistItem.TargetAudioChannels, playlistItem.TargetAudioCodec); int audioBitrate = GetAudioBitrate(playlistItem.TargetAudioChannels, playlistItem.TargetAudioCodec, audioStream);
playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate); playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate);
int? maxBitrateSetting = options.GetMaxBitrate(); int? maxBitrateSetting = options.GetMaxBitrate();
@ -479,17 +479,35 @@ namespace MediaBrowser.Model.Dlna
return playlistItem; return playlistItem;
} }
private int GetAudioBitrate(int? channels, string codec) private int GetAudioBitrate(int? channels, string outputCodec, MediaStream audioStream)
{ {
var defaultBitrate = 128000;
if (channels.HasValue) if (channels.HasValue)
{ {
if (channels.Value >= 5) if (channels.Value >= 5)
{ {
return 320000; defaultBitrate = 320000;
} }
} }
return 128000; int encoderAudioBitrateLimit = int.MaxValue;
if (audioStream != null)
{
// Seeing webm encoding failures when source has 1 audio channel and 22k bitrate.
// Any attempts to transcode over 64k will fail
if (audioStream.Channels.HasValue &&
audioStream.Channels.Value == 1)
{
if ((audioStream.BitRate ?? 0) < 64000)
{
encoderAudioBitrateLimit = 64000;
}
}
}
return Math.Min(defaultBitrate, encoderAudioBitrateLimit);
} }
private PlayMethod? GetVideoDirectPlayProfile(DeviceProfile profile, private PlayMethod? GetVideoDirectPlayProfile(DeviceProfile profile,