2019-01-13 20:26:04 +01:00
using System ;
using System.Collections.Generic ;
using System.Globalization ;
using System.IO ;
using System.Linq ;
2019-10-26 22:53:53 +02:00
using System.Text.Json ;
2019-02-12 23:05:42 +01:00
using System.Text.RegularExpressions ;
2019-01-13 20:26:04 +01:00
using System.Threading ;
using System.Threading.Tasks ;
using MediaBrowser.Common.Configuration ;
using MediaBrowser.Common.Extensions ;
2018-12-14 10:40:55 +01:00
using MediaBrowser.Controller.Configuration ;
using MediaBrowser.Controller.MediaEncoding ;
using MediaBrowser.MediaEncoding.Probing ;
2019-01-13 20:26:04 +01:00
using MediaBrowser.Model.Configuration ;
2018-12-14 10:40:55 +01:00
using MediaBrowser.Model.Dlna ;
using MediaBrowser.Model.Entities ;
2019-03-14 22:31:51 +01:00
using MediaBrowser.Model.Globalization ;
2018-12-14 10:40:55 +01:00
using MediaBrowser.Model.IO ;
using MediaBrowser.Model.MediaInfo ;
2019-02-12 23:05:42 +01:00
using MediaBrowser.Model.System ;
2020-03-24 16:12:06 +01:00
using Microsoft.Extensions.Logging ;
2020-03-27 00:10:16 +01:00
using System.Diagnostics ;
2018-12-14 10:40:55 +01:00
namespace MediaBrowser.MediaEncoding.Encoder
{
/// <summary>
/// Class MediaEncoder
/// </summary>
public class MediaEncoder : IMediaEncoder , IDisposable
{
/// <summary>
2019-10-26 22:53:53 +02:00
/// The default image extraction timeout in milliseconds.
2018-12-14 10:40:55 +01:00
/// </summary>
2019-10-26 22:53:53 +02:00
internal const int DefaultImageExtractionTimeout = 5000 ;
2018-12-14 10:40:55 +01:00
2020-06-06 02:15:56 +02:00
private readonly ILogger < MediaEncoder > _logger ;
2019-10-26 22:53:53 +02:00
private readonly IServerConfigurationManager _configurationManager ;
private readonly IFileSystem _fileSystem ;
private readonly ILocalizationManager _localization ;
2020-04-11 16:53:13 +02:00
private readonly Lazy < EncodingHelper > _encodingHelperFactory ;
2019-10-26 22:53:53 +02:00
private readonly string _startupOptionFFmpegPath ;
2018-12-14 10:40:55 +01:00
2019-04-30 23:35:39 +02:00
private readonly SemaphoreSlim _thumbnailResourcePool = new SemaphoreSlim ( 2 , 2 ) ;
2019-10-26 22:53:53 +02:00
private readonly object _runningProcessesLock = new object ( ) ;
2018-12-14 10:40:55 +01:00
private readonly List < ProcessWrapper > _runningProcesses = new List < ProcessWrapper > ( ) ;
2019-10-26 22:53:53 +02:00
private string _ffmpegPath ;
private string _ffprobePath ;
2018-12-14 10:40:55 +01:00
2019-01-17 23:55:05 +01:00
public MediaEncoder (
2019-10-26 22:53:53 +02:00
ILogger < MediaEncoder > logger ,
2019-01-02 15:12:52 +01:00
IServerConfigurationManager configurationManager ,
IFileSystem fileSystem ,
2019-10-26 22:53:53 +02:00
ILocalizationManager localization ,
2020-04-11 16:53:13 +02:00
Lazy < EncodingHelper > encodingHelperFactory ,
2019-10-26 22:53:53 +02:00
string startupOptionsFFmpegPath )
{
_logger = logger ;
_configurationManager = configurationManager ;
_fileSystem = fileSystem ;
2019-03-14 22:31:51 +01:00
_localization = localization ;
2020-04-11 16:53:13 +02:00
_encodingHelperFactory = encodingHelperFactory ;
2019-10-26 22:53:53 +02:00
_startupOptionFFmpegPath = startupOptionsFFmpegPath ;
2018-12-14 10:40:55 +01:00
}
2020-04-11 16:53:13 +02:00
private EncodingHelper EncodingHelper = > _encodingHelperFactory . Value ;
2019-10-26 22:53:53 +02:00
/// <inheritdoc />
public string EncoderPath = > _ffmpegPath ;
/// <inheritdoc />
public FFmpegLocation EncoderLocation { get ; private set ; }
2019-02-08 14:35:26 +01:00
/// <summary>
/// Run at startup or if the user removes a Custom path from transcode page.
2019-02-12 23:05:42 +01:00
/// Sets global variables FFmpegPath.
/// Precedence is: Config > CLI > $PATH
2019-02-08 14:35:26 +01:00
/// </summary>
2019-02-28 23:47:56 +01:00
public void SetFFmpegPath ( )
2018-12-14 10:40:55 +01:00
{
2019-02-28 23:06:56 +01:00
// 1) Custom path stored in config/encoding xml file under tag <EncoderAppPath> takes precedence
2019-10-26 22:53:53 +02:00
if ( ! ValidatePath ( _configurationManager . GetConfiguration < EncodingOptions > ( "encoding" ) . EncoderAppPath , FFmpegLocation . Custom ) )
2018-12-14 10:40:55 +01:00
{
2019-02-12 23:05:42 +01:00
// 2) Check if the --ffmpeg CLI switch has been given
2019-10-26 22:53:53 +02:00
if ( ! ValidatePath ( _startupOptionFFmpegPath , FFmpegLocation . SetByArgument ) )
2018-12-14 10:40:55 +01:00
{
2019-02-12 23:05:42 +01:00
// 3) Search system $PATH environment variable for valid FFmpeg
2019-02-28 23:06:56 +01:00
if ( ! ValidatePath ( ExistsOnSystemPath ( "ffmpeg" ) , FFmpegLocation . System ) )
2019-02-12 23:05:42 +01:00
{
EncoderLocation = FFmpegLocation . NotFound ;
2019-10-26 22:53:53 +02:00
_ffmpegPath = null ;
2019-02-12 23:05:42 +01:00
}
2018-12-14 10:40:55 +01:00
}
}
2019-02-28 23:06:56 +01:00
// Write the FFmpeg path to the config/encoding.xml file as <EncoderAppPathDisplay> so it appears in UI
2019-10-26 22:53:53 +02:00
var config = _configurationManager . GetConfiguration < EncodingOptions > ( "encoding" ) ;
config . EncoderAppPathDisplay = _ffmpegPath ? ? string . Empty ;
_configurationManager . SaveConfiguration ( "encoding" , config ) ;
2018-12-14 10:40:55 +01:00
2019-02-08 14:35:26 +01:00
// Only if mpeg path is set, try and set path to probe
2019-10-26 22:53:53 +02:00
if ( _ffmpegPath ! = null )
2018-12-14 10:40:55 +01:00
{
2019-02-28 23:06:56 +01:00
// Determine a probe path from the mpeg path
2019-10-26 22:53:53 +02:00
_ffprobePath = Regex . Replace ( _ffmpegPath , @"[^\/\\]+?(\.[^\/\\\n.]+)?$" , @"ffprobe$1" ) ;
2018-12-14 10:40:55 +01:00
2019-02-28 23:06:56 +01:00
// Interrogate to understand what coders are supported
2019-10-26 22:53:53 +02:00
var validator = new EncoderValidator ( _logger , _ffmpegPath ) ;
2018-12-14 10:40:55 +01:00
2019-09-28 01:29:54 +02:00
SetAvailableDecoders ( validator . GetDecoders ( ) ) ;
SetAvailableEncoders ( validator . GetEncoders ( ) ) ;
2020-04-08 18:15:01 +02:00
SetAvailableHwaccels ( validator . GetHwaccels ( ) ) ;
2018-12-14 10:40:55 +01:00
}
2020-04-27 03:25:57 +02:00
_logger . LogInformation ( "FFmpeg: {EncoderLocation}: {FfmpegPath}" , EncoderLocation , _ffmpegPath ? ? string . Empty ) ;
2018-12-14 10:40:55 +01:00
}
2019-02-08 14:35:26 +01:00
/// <summary>
2019-02-28 23:06:56 +01:00
/// Triggered from the Settings > Transcoding UI page when users submits Custom FFmpeg path to use.
/// Only write the new path to xml if it exists. Do not perform validation checks on ffmpeg here.
2019-02-08 14:35:26 +01:00
/// </summary>
/// <param name="path"></param>
/// <param name="pathType"></param>
2018-12-14 10:40:55 +01:00
public void UpdateEncoderPath ( string path , string pathType )
{
2019-02-28 23:06:56 +01:00
string newPath ;
2018-12-14 10:40:55 +01:00
2020-04-27 03:25:57 +02:00
_logger . LogInformation ( "Attempting to update encoder path to {Path}. pathType: {PathType}" , path ? ? string . Empty , pathType ? ? string . Empty ) ;
2018-12-14 10:40:55 +01:00
2019-02-08 14:35:26 +01:00
if ( ! string . Equals ( pathType , "custom" , StringComparison . OrdinalIgnoreCase ) )
2018-12-14 10:40:55 +01:00
{
2019-02-08 14:35:26 +01:00
throw new ArgumentException ( "Unexpected pathType value" ) ;
2018-12-14 10:40:55 +01:00
}
2019-02-28 23:06:56 +01:00
else if ( string . IsNullOrWhiteSpace ( path ) )
2018-12-14 10:40:55 +01:00
{
2019-02-28 23:06:56 +01:00
// User had cleared the custom path in UI
newPath = string . Empty ;
2018-12-14 10:40:55 +01:00
}
2019-02-28 23:06:56 +01:00
else if ( File . Exists ( path ) )
2018-12-14 10:40:55 +01:00
{
2019-02-28 23:06:56 +01:00
newPath = path ;
2018-12-14 10:40:55 +01:00
}
2019-02-28 23:06:56 +01:00
else if ( Directory . Exists ( path ) )
2018-12-14 10:40:55 +01:00
{
2019-02-28 23:06:56 +01:00
// Given path is directory, so resolve down to filename
newPath = GetEncoderPathFromDirectory ( path , "ffmpeg" ) ;
2018-12-14 10:40:55 +01:00
}
2019-02-12 23:05:42 +01:00
else
2018-12-14 10:40:55 +01:00
{
2019-02-28 23:06:56 +01:00
throw new ResourceNotFoundException ( ) ;
2018-12-14 10:40:55 +01:00
}
2019-02-28 23:06:56 +01:00
// Write the new ffmpeg path to the xml as <EncoderAppPath>
// This ensures its not lost on next startup
2019-10-26 22:53:53 +02:00
var config = _configurationManager . GetConfiguration < EncodingOptions > ( "encoding" ) ;
2019-02-28 23:06:56 +01:00
config . EncoderAppPath = newPath ;
2019-10-26 22:53:53 +02:00
_configurationManager . SaveConfiguration ( "encoding" , config ) ;
2018-12-14 10:40:55 +01:00
2019-02-28 23:47:56 +01:00
// Trigger SetFFmpegPath so we validate the new path and setup probe path
SetFFmpegPath ( ) ;
2018-12-14 10:40:55 +01:00
}
2019-02-12 23:05:42 +01:00
/// <summary>
2019-02-28 23:06:56 +01:00
/// Validates the supplied FQPN to ensure it is a ffmpeg utility.
/// If checks pass, global variable FFmpegPath and EncoderLocation are updated.
2019-02-12 23:05:42 +01:00
/// </summary>
/// <param name="path">FQPN to test</param>
/// <param name="location">Location (External, Custom, System) of tool</param>
/// <returns></returns>
2019-02-28 23:06:56 +01:00
private bool ValidatePath ( string path , FFmpegLocation location )
2018-12-14 10:40:55 +01:00
{
2019-02-12 23:05:42 +01:00
bool rc = false ;
2018-12-14 10:40:55 +01:00
2019-02-08 14:35:26 +01:00
if ( ! string . IsNullOrEmpty ( path ) )
2018-12-14 10:40:55 +01:00
{
2019-02-08 14:35:26 +01:00
if ( File . Exists ( path ) )
{
2019-09-28 01:29:54 +02:00
rc = new EncoderValidator ( _logger , path ) . ValidateVersion ( ) ;
2018-12-14 10:40:55 +01:00
2019-02-28 23:06:56 +01:00
if ( ! rc )
2019-02-08 14:35:26 +01:00
{
2020-04-27 03:25:57 +02:00
_logger . LogWarning ( "FFmpeg: {Location}: Failed version check: {Path}" , location , path ) ;
2019-02-08 14:35:26 +01:00
}
2018-12-14 10:40:55 +01:00
2019-02-28 23:06:56 +01:00
// ToDo - Enable the ffmpeg validator. At the moment any version can be used.
rc = true ;
2018-12-14 10:40:55 +01:00
2019-10-26 22:53:53 +02:00
_ffmpegPath = path ;
2019-02-28 23:06:56 +01:00
EncoderLocation = location ;
2018-12-14 10:40:55 +01:00
}
2019-02-08 14:35:26 +01:00
else
2018-12-14 10:40:55 +01:00
{
2020-04-27 03:25:57 +02:00
_logger . LogWarning ( "FFmpeg: {Location}: File not found: {Path}" , location , path ) ;
2018-12-14 10:40:55 +01:00
}
}
2019-02-12 23:05:42 +01:00
return rc ;
2018-12-14 10:40:55 +01:00
}
2020-04-27 03:25:57 +02:00
private string GetEncoderPathFromDirectory ( string path , string filename , bool recursive = false )
2018-12-14 10:40:55 +01:00
{
2019-02-08 14:35:26 +01:00
try
2018-12-14 10:40:55 +01:00
{
2020-04-27 03:25:57 +02:00
var files = _fileSystem . GetFilePaths ( path , recursive ) ;
2018-12-14 10:40:55 +01:00
2019-02-08 14:35:26 +01:00
var excludeExtensions = new [ ] { ".c" } ;
2018-12-14 10:40:55 +01:00
2019-02-12 23:05:42 +01:00
return files . FirstOrDefault ( i = > string . Equals ( Path . GetFileNameWithoutExtension ( i ) , filename , StringComparison . OrdinalIgnoreCase )
& & ! excludeExtensions . Contains ( Path . GetExtension ( i ) ? ? string . Empty ) ) ;
2019-02-08 14:35:26 +01:00
}
catch ( Exception )
2018-12-14 10:40:55 +01:00
{
2019-02-08 14:35:26 +01:00
// Trap all exceptions, like DirNotExists, and return null
return null ;
2018-12-14 10:40:55 +01:00
}
}
2019-02-08 14:35:26 +01:00
/// <summary>
/// Search the system $PATH environment variable looking for given filename.
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
2019-09-28 01:29:54 +02:00
private string ExistsOnSystemPath ( string fileName )
2018-12-14 10:40:55 +01:00
{
2020-04-27 03:25:57 +02:00
var inJellyfinPath = GetEncoderPathFromDirectory ( AppContext . BaseDirectory , fileName , recursive : true ) ;
2019-04-05 08:04:54 +02:00
if ( ! string . IsNullOrEmpty ( inJellyfinPath ) )
{
return inJellyfinPath ;
}
2019-02-08 14:35:26 +01:00
var values = Environment . GetEnvironmentVariable ( "PATH" ) ;
2018-12-14 10:40:55 +01:00
2019-02-08 14:35:26 +01:00
foreach ( var path in values . Split ( Path . PathSeparator ) )
2018-12-14 10:40:55 +01:00
{
2019-09-28 01:29:54 +02:00
var candidatePath = GetEncoderPathFromDirectory ( path , fileName ) ;
2018-12-14 10:40:55 +01:00
2019-02-12 23:05:42 +01:00
if ( ! string . IsNullOrEmpty ( candidatePath ) )
2018-12-14 10:40:55 +01:00
{
2019-02-08 14:35:26 +01:00
return candidatePath ;
2018-12-14 10:40:55 +01:00
}
}
2019-09-28 01:29:54 +02:00
2019-02-08 14:35:26 +01:00
return null ;
2018-12-14 10:40:55 +01:00
}
private List < string > _encoders = new List < string > ( ) ;
2019-01-02 01:23:49 +01:00
public void SetAvailableEncoders ( IEnumerable < string > list )
2018-12-14 10:40:55 +01:00
{
_encoders = list . ToList ( ) ;
2020-06-14 11:11:11 +02:00
// _logger.Info("Supported encoders: {0}", string.Join(",", list.ToArray()));
2018-12-14 10:40:55 +01:00
}
private List < string > _decoders = new List < string > ( ) ;
2019-01-02 01:23:49 +01:00
public void SetAvailableDecoders ( IEnumerable < string > list )
2018-12-14 10:40:55 +01:00
{
_decoders = list . ToList ( ) ;
2020-06-14 11:11:11 +02:00
// _logger.Info("Supported decoders: {0}", string.Join(",", list.ToArray()));
2018-12-14 10:40:55 +01:00
}
2020-05-26 17:41:38 +02:00
private List < string > _hwaccels = new List < string > ( ) ;
2020-04-08 18:15:01 +02:00
public void SetAvailableHwaccels ( IEnumerable < string > list )
{
_hwaccels = list . ToList ( ) ;
//_logger.Info("Supported hwaccels: {0}", string.Join(",", list.ToArray()));
}
2018-12-14 10:40:55 +01:00
public bool SupportsEncoder ( string encoder )
{
return _encoders . Contains ( encoder , StringComparer . OrdinalIgnoreCase ) ;
}
public bool SupportsDecoder ( string decoder )
{
return _decoders . Contains ( decoder , StringComparer . OrdinalIgnoreCase ) ;
}
2020-04-08 18:15:01 +02:00
public bool SupportsHwaccel ( string hwaccel )
{
return _hwaccels . Contains ( hwaccel , StringComparer . OrdinalIgnoreCase ) ;
}
2018-12-14 10:40:55 +01:00
public bool CanEncodeToAudioCodec ( string codec )
{
if ( string . Equals ( codec , "opus" , StringComparison . OrdinalIgnoreCase ) )
{
codec = "libopus" ;
}
else if ( string . Equals ( codec , "mp3" , StringComparison . OrdinalIgnoreCase ) )
{
codec = "libmp3lame" ;
}
return SupportsEncoder ( codec ) ;
}
public bool CanEncodeToSubtitleCodec ( string codec )
{
// TODO
return true ;
}
/// <summary>
/// Gets the media info.
/// </summary>
/// <param name="request">The request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
public Task < MediaInfo > GetMediaInfo ( MediaInfoRequest request , CancellationToken cancellationToken )
{
var extractChapters = request . MediaType = = DlnaProfileType . Video & & request . ExtractChapters ;
2019-10-26 22:53:53 +02:00
var inputFiles = MediaEncoderHelpers . GetInputArgument ( _fileSystem , request . MediaSource . Path , request . MountedIso , request . PlayableStreamFileNames ) ;
2018-12-14 10:40:55 +01:00
var probeSize = EncodingHelper . GetProbeSizeArgument ( inputFiles . Length ) ;
string analyzeDuration ;
if ( request . MediaSource . AnalyzeDurationMs > 0 )
{
analyzeDuration = "-analyzeduration " +
( request . MediaSource . AnalyzeDurationMs * 1000 ) . ToString ( ) ;
}
else
{
analyzeDuration = EncodingHelper . GetAnalyzeDurationArgument ( inputFiles . Length ) ;
}
probeSize = probeSize + " " + analyzeDuration ;
probeSize = probeSize . Trim ( ) ;
var forceEnableLogging = request . MediaSource . Protocol ! = MediaProtocol . File ;
return GetMediaInfoInternal ( GetInputArgument ( inputFiles , request . MediaSource . Protocol ) , request . MediaSource . Path , request . MediaSource . Protocol , extractChapters ,
probeSize , request . MediaType = = DlnaProfileType . Audio , request . MediaSource . VideoType , forceEnableLogging , cancellationToken ) ;
}
/// <summary>
/// Gets the input argument.
/// </summary>
/// <param name="inputFiles">The input files.</param>
/// <param name="protocol">The protocol.</param>
/// <returns>System.String.</returns>
2019-01-13 21:37:13 +01:00
/// <exception cref="ArgumentException">Unrecognized InputType</exception>
2019-02-24 15:47:59 +01:00
public string GetInputArgument ( IReadOnlyList < string > inputFiles , MediaProtocol protocol )
= > EncodingUtils . GetInputArgument ( inputFiles , protocol ) ;
2018-12-14 10:40:55 +01:00
/// <summary>
/// Gets the media info internal.
/// </summary>
/// <returns>Task{MediaInfoResult}.</returns>
private async Task < MediaInfo > GetMediaInfoInternal ( string inputPath ,
string primaryPath ,
MediaProtocol protocol ,
bool extractChapters ,
string probeSizeArgument ,
bool isAudio ,
VideoType ? videoType ,
bool forceEnableLogging ,
CancellationToken cancellationToken )
{
var args = extractChapters
2019-02-24 15:47:59 +01:00
? "{0} -i {1} -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"
: "{0} -i {1} -threads 0 -v warning -print_format json -show_streams -show_format" ;
args = string . Format ( args , probeSizeArgument , inputPath ) . Trim ( ) ;
2018-12-14 10:40:55 +01:00
2020-04-11 19:25:50 +02:00
var process = new Process
2018-12-14 10:40:55 +01:00
{
2020-04-11 19:25:50 +02:00
StartInfo = new ProcessStartInfo
{
CreateNoWindow = true ,
UseShellExecute = false ,
2018-12-14 10:40:55 +01:00
2020-04-11 19:25:50 +02:00
// Must consume both or ffmpeg may hang due to deadlocks. See comments below.
RedirectStandardOutput = true ,
2019-02-24 15:47:59 +01:00
2020-04-11 19:25:50 +02:00
FileName = _ffprobePath ,
Arguments = args ,
2019-02-24 15:47:59 +01:00
2018-12-14 10:40:55 +01:00
2020-04-11 19:25:50 +02:00
WindowStyle = ProcessWindowStyle . Hidden ,
ErrorDialog = false ,
} ,
2018-12-14 10:40:55 +01:00
EnableRaisingEvents = true
2020-03-27 00:45:48 +01:00
} ;
2018-12-14 10:40:55 +01:00
if ( forceEnableLogging )
{
2020-04-11 19:25:50 +02:00
_logger . LogInformation ( "{ProcessFileName} {ProcessArgs}" , process . StartInfo . FileName , process . StartInfo . Arguments ) ;
2018-12-14 10:40:55 +01:00
}
else
{
2020-04-11 19:25:50 +02:00
_logger . LogDebug ( "{ProcessFileName} {ProcessArgs}" , process . StartInfo . FileName , process . StartInfo . Arguments ) ;
2018-12-14 10:40:55 +01:00
}
2019-10-26 22:53:53 +02:00
using ( var processWrapper = new ProcessWrapper ( process , this ) )
2018-12-14 10:40:55 +01:00
{
2019-02-24 15:47:59 +01:00
_logger . LogDebug ( "Starting ffprobe with args {Args}" , args ) ;
2018-12-14 10:40:55 +01:00
StartProcess ( processWrapper ) ;
2019-02-24 15:47:59 +01:00
InternalMediaInfoResult result ;
2018-12-14 10:40:55 +01:00
try
{
2019-10-26 22:53:53 +02:00
result = await JsonSerializer . DeserializeAsync < InternalMediaInfoResult > (
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
process . StandardOutput . BaseStream ,
cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
2019-02-24 15:47:59 +01:00
}
catch
{
StopProcess ( processWrapper , 100 ) ;
2018-12-14 10:40:55 +01:00
2019-02-24 15:47:59 +01:00
throw ;
}
2018-12-14 10:40:55 +01:00
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
if ( result = = null | | ( result . Streams = = null & & result . Format = = null ) )
2019-02-24 15:47:59 +01:00
{
throw new Exception ( "ffprobe failed - streams and format are both null." ) ;
}
2018-12-14 10:40:55 +01:00
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
if ( result . Streams ! = null )
2019-02-24 15:47:59 +01:00
{
// Normalize aspect ratio if invalid
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
foreach ( var stream in result . Streams )
2018-12-14 10:40:55 +01:00
{
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
if ( string . Equals ( stream . DisplayAspectRatio , "0:1" , StringComparison . OrdinalIgnoreCase ) )
2018-12-14 10:40:55 +01:00
{
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
stream . DisplayAspectRatio = string . Empty ;
2018-12-14 10:40:55 +01:00
}
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
if ( string . Equals ( stream . SampleAspectRatio , "0:1" , StringComparison . OrdinalIgnoreCase ) )
2019-02-24 15:47:59 +01:00
{
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
stream . SampleAspectRatio = string . Empty ;
2019-02-24 15:47:59 +01:00
}
}
2018-12-14 10:40:55 +01:00
}
2020-02-23 10:53:51 +01:00
return new ProbeResultNormalizer ( _logger , _localization ) . GetMediaInfo ( result , videoType , isAudio , primaryPath , protocol ) ;
2018-12-14 10:40:55 +01:00
}
}
/// <summary>
/// The us culture
/// </summary>
protected readonly CultureInfo UsCulture = new CultureInfo ( "en-US" ) ;
public Task < string > ExtractAudioImage ( string path , int? imageStreamIndex , CancellationToken cancellationToken )
{
return ExtractImage ( new [ ] { path } , null , null , imageStreamIndex , MediaProtocol . File , true , null , null , cancellationToken ) ;
}
public Task < string > ExtractVideoImage ( string [ ] inputFiles , string container , MediaProtocol protocol , MediaStream videoStream , Video3DFormat ? threedFormat , TimeSpan ? offset , CancellationToken cancellationToken )
{
return ExtractImage ( inputFiles , container , videoStream , null , protocol , false , threedFormat , offset , cancellationToken ) ;
}
public Task < string > ExtractVideoImage ( string [ ] inputFiles , string container , MediaProtocol protocol , MediaStream imageStream , int? imageStreamIndex , CancellationToken cancellationToken )
{
return ExtractImage ( inputFiles , container , imageStream , imageStreamIndex , protocol , false , null , null , cancellationToken ) ;
}
private async Task < string > ExtractImage ( string [ ] inputFiles , string container , MediaStream videoStream , int? imageStreamIndex , MediaProtocol protocol , bool isAudio ,
Video3DFormat ? threedFormat , TimeSpan ? offset , CancellationToken cancellationToken )
{
var inputArgument = GetInputArgument ( inputFiles , protocol ) ;
if ( isAudio )
{
if ( imageStreamIndex . HasValue & & imageStreamIndex . Value > 0 )
{
// It seems for audio files we need to subtract 1 (for the audio stream??)
imageStreamIndex = imageStreamIndex . Value - 1 ;
}
}
else
{
try
{
return await ExtractImageInternal ( inputArgument , container , videoStream , imageStreamIndex , threedFormat , offset , true , cancellationToken ) . ConfigureAwait ( false ) ;
}
catch ( ArgumentException )
{
throw ;
}
2018-12-20 13:11:26 +01:00
catch ( Exception ex )
2018-12-14 10:40:55 +01:00
{
2020-04-19 11:16:09 +02:00
_logger . LogError ( ex , "I-frame image extraction failed, will attempt standard way. Input: {Arguments}" , inputArgument ) ;
2018-12-14 10:40:55 +01:00
}
}
return await ExtractImageInternal ( inputArgument , container , videoStream , imageStreamIndex , threedFormat , offset , false , cancellationToken ) . ConfigureAwait ( false ) ;
}
private async Task < string > ExtractImageInternal ( string inputPath , string container , MediaStream videoStream , int? imageStreamIndex , Video3DFormat ? threedFormat , TimeSpan ? offset , bool useIFrame , CancellationToken cancellationToken )
{
if ( string . IsNullOrEmpty ( inputPath ) )
{
2019-01-06 21:50:43 +01:00
throw new ArgumentNullException ( nameof ( inputPath ) ) ;
2018-12-14 10:40:55 +01:00
}
2019-10-26 22:53:53 +02:00
var tempExtractPath = Path . Combine ( _configurationManager . ApplicationPaths . TempDirectory , Guid . NewGuid ( ) + ".jpg" ) ;
2019-01-26 22:08:04 +01:00
Directory . CreateDirectory ( Path . GetDirectoryName ( tempExtractPath ) ) ;
2018-12-14 10:40:55 +01:00
2019-01-08 17:29:34 +01:00
// apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
2018-12-14 10:40:55 +01:00
// This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar
var vf = "scale=600:trunc(600/dar/2)*2" ;
if ( threedFormat . HasValue )
{
switch ( threedFormat . Value )
{
case Video3DFormat . HalfSideBySide :
vf = "crop=iw/2:ih:0:0,scale=(iw*2):ih,setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale=600:trunc(600/dar/2)*2" ;
// hsbs crop width in half,scale to correct size, set the display aspect,crop out any black bars we may have made the scale width to 600. Work out the correct height based on the display aspect it will maintain the aspect where -1 in this case (3d) may not.
break ;
case Video3DFormat . FullSideBySide :
vf = "crop=iw/2:ih:0:0,setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale=600:trunc(600/dar/2)*2" ;
2020-06-14 11:11:11 +02:00
// fsbs crop width in half,set the display aspect,crop out any black bars we may have made the scale width to 600.
2018-12-14 10:40:55 +01:00
break ;
case Video3DFormat . HalfTopAndBottom :
vf = "crop=iw:ih/2:0:0,scale=(iw*2):ih),setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale=600:trunc(600/dar/2)*2" ;
2020-06-14 11:11:11 +02:00
// htab crop heigh in half,scale to correct size, set the display aspect,crop out any black bars we may have made the scale width to 600
2018-12-14 10:40:55 +01:00
break ;
case Video3DFormat . FullTopAndBottom :
vf = "crop=iw:ih/2:0:0,setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale=600:trunc(600/dar/2)*2" ;
// ftab crop heigt in half, set the display aspect,crop out any black bars we may have made the scale width to 600
break ;
default :
break ;
}
}
2019-01-08 17:29:34 +01:00
2018-12-14 10:40:55 +01:00
var mapArg = imageStreamIndex . HasValue ? ( " -map 0:v:" + imageStreamIndex . Value . ToString ( CultureInfo . InvariantCulture ) ) : string . Empty ;
var enableThumbnail = ! new List < string > { "wtv" } . Contains ( container ? ? string . Empty , StringComparer . OrdinalIgnoreCase ) ;
// Use ffmpeg to sample 100 (we can drop this if required using thumbnail=50 for 50 frames) frames and pick the best thumbnail. Have a fall back just in case.
var thumbnail = enableThumbnail ? ",thumbnail=24" : string . Empty ;
var args = useIFrame ? string . Format ( "-i {0}{3} -threads 0 -v quiet -vframes 1 -vf \"{2}{4}\" -f image2 \"{1}\"" , inputPath , tempExtractPath , vf , mapArg , thumbnail ) :
string . Format ( "-i {0}{3} -threads 0 -v quiet -vframes 1 -vf \"{2}\" -f image2 \"{1}\"" , inputPath , tempExtractPath , vf , mapArg ) ;
var probeSizeArgument = EncodingHelper . GetProbeSizeArgument ( 1 ) ;
var analyzeDurationArgument = EncodingHelper . GetAnalyzeDurationArgument ( 1 ) ;
if ( ! string . IsNullOrWhiteSpace ( probeSizeArgument ) )
{
args = probeSizeArgument + " " + args ;
}
if ( ! string . IsNullOrWhiteSpace ( analyzeDurationArgument ) )
{
args = analyzeDurationArgument + " " + args ;
}
if ( offset . HasValue )
{
args = string . Format ( "-ss {0} " , GetTimeParameter ( offset . Value ) ) + args ;
}
if ( videoStream ! = null )
{
2018-12-28 00:27:57 +01:00
/ * fix
2018-12-14 10:40:55 +01:00
var decoder = encodinghelper . GetHardwareAcceleratedVideoDecoder ( VideoType . VideoFile , videoStream , GetEncodingOptions ( ) ) ;
if ( ! string . IsNullOrWhiteSpace ( decoder ) )
{
args = decoder + " " + args ;
}
2018-12-28 00:27:57 +01:00
* /
2018-12-14 10:40:55 +01:00
}
if ( ! string . IsNullOrWhiteSpace ( container ) )
{
2019-10-26 22:53:53 +02:00
var inputFormat = EncodingHelper . GetInputFormat ( container ) ;
2018-12-14 10:40:55 +01:00
if ( ! string . IsNullOrWhiteSpace ( inputFormat ) )
{
args = "-f " + inputFormat + " " + args ;
}
}
2020-04-11 19:25:50 +02:00
var process = new Process
2018-12-14 10:40:55 +01:00
{
2020-04-11 19:25:50 +02:00
StartInfo = new ProcessStartInfo
{
CreateNoWindow = true ,
UseShellExecute = false ,
FileName = _ffmpegPath ,
Arguments = args ,
WindowStyle = ProcessWindowStyle . Hidden ,
ErrorDialog = false ,
} ,
2019-02-24 16:33:05 +01:00
EnableRaisingEvents = true
2020-03-27 00:45:48 +01:00
} ;
2018-12-14 10:40:55 +01:00
2020-04-11 19:25:50 +02:00
_logger . LogDebug ( "{ProcessFileName} {ProcessArguments}" , process . StartInfo . FileName , process . StartInfo . Arguments ) ;
2018-12-14 10:40:55 +01:00
2019-10-26 22:53:53 +02:00
using ( var processWrapper = new ProcessWrapper ( process , this ) )
2018-12-14 10:40:55 +01:00
{
bool ranToCompletion ;
2019-04-30 23:35:39 +02:00
await _thumbnailResourcePool . WaitAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
try
2018-12-14 10:40:55 +01:00
{
2019-04-30 23:35:39 +02:00
StartProcess ( processWrapper ) ;
2019-10-26 22:53:53 +02:00
var timeoutMs = _configurationManager . Configuration . ImageExtractionTimeoutMs ;
2019-04-30 23:35:39 +02:00
if ( timeoutMs < = 0 )
{
2019-10-26 22:53:53 +02:00
timeoutMs = DefaultImageExtractionTimeout ;
2019-04-30 23:35:39 +02:00
}
2018-12-14 10:40:55 +01:00
2020-03-27 01:09:09 +01:00
ranToCompletion = await process . WaitForExitAsync ( TimeSpan . FromMilliseconds ( timeoutMs ) ) . ConfigureAwait ( false ) ;
2018-12-14 10:40:55 +01:00
2019-04-30 23:35:39 +02:00
if ( ! ranToCompletion )
{
StopProcess ( processWrapper , 1000 ) ;
}
}
finally
2018-12-14 10:40:55 +01:00
{
2019-04-30 23:35:39 +02:00
_thumbnailResourcePool . Release ( ) ;
2018-12-14 10:40:55 +01:00
}
var exitCode = ranToCompletion ? processWrapper . ExitCode ? ? 0 : - 1 ;
2019-10-26 22:53:53 +02:00
var file = _fileSystem . GetFileInfo ( tempExtractPath ) ;
2018-12-14 10:40:55 +01:00
if ( exitCode = = - 1 | | ! file . Exists | | file . Length = = 0 )
{
var msg = string . Format ( "ffmpeg image extraction failed for {0}" , inputPath ) ;
2018-12-15 00:48:06 +01:00
_logger . LogError ( msg ) ;
2018-12-14 10:40:55 +01:00
throw new Exception ( msg ) ;
}
return tempExtractPath ;
}
}
public string GetTimeParameter ( long ticks )
{
var time = TimeSpan . FromTicks ( ticks ) ;
return GetTimeParameter ( time ) ;
}
public string GetTimeParameter ( TimeSpan time )
{
return time . ToString ( @"hh\:mm\:ss\.fff" , UsCulture ) ;
}
2019-04-30 23:35:39 +02:00
public async Task ExtractVideoImagesOnInterval (
string [ ] inputFiles ,
2018-12-14 10:40:55 +01:00
string container ,
MediaStream videoStream ,
MediaProtocol protocol ,
Video3DFormat ? threedFormat ,
TimeSpan interval ,
string targetDirectory ,
string filenamePrefix ,
int? maxWidth ,
CancellationToken cancellationToken )
{
var inputArgument = GetInputArgument ( inputFiles , protocol ) ;
var vf = "fps=fps=1/" + interval . TotalSeconds . ToString ( UsCulture ) ;
if ( maxWidth . HasValue )
{
var maxWidthParam = maxWidth . Value . ToString ( UsCulture ) ;
vf + = string . Format ( ",scale=min(iw\\,{0}):trunc(ow/dar/2)*2" , maxWidthParam ) ;
}
2019-01-26 22:08:04 +01:00
Directory . CreateDirectory ( targetDirectory ) ;
2018-12-14 10:40:55 +01:00
var outputPath = Path . Combine ( targetDirectory , filenamePrefix + "%05d.jpg" ) ;
var args = string . Format ( "-i {0} -threads 0 -v quiet -vf \"{2}\" -f image2 \"{1}\"" , inputArgument , outputPath , vf ) ;
var probeSizeArgument = EncodingHelper . GetProbeSizeArgument ( 1 ) ;
var analyzeDurationArgument = EncodingHelper . GetAnalyzeDurationArgument ( 1 ) ;
if ( ! string . IsNullOrWhiteSpace ( probeSizeArgument ) )
{
args = probeSizeArgument + " " + args ;
}
if ( ! string . IsNullOrWhiteSpace ( analyzeDurationArgument ) )
{
args = analyzeDurationArgument + " " + args ;
}
if ( videoStream ! = null )
{
2018-12-28 00:27:57 +01:00
/ * fix
2018-12-14 10:40:55 +01:00
var decoder = encodinghelper . GetHardwareAcceleratedVideoDecoder ( VideoType . VideoFile , videoStream , GetEncodingOptions ( ) ) ;
if ( ! string . IsNullOrWhiteSpace ( decoder ) )
{
args = decoder + " " + args ;
}
2018-12-28 00:27:57 +01:00
* /
2018-12-14 10:40:55 +01:00
}
if ( ! string . IsNullOrWhiteSpace ( container ) )
{
2019-10-26 22:53:53 +02:00
var inputFormat = EncodingHelper . GetInputFormat ( container ) ;
2018-12-14 10:40:55 +01:00
if ( ! string . IsNullOrWhiteSpace ( inputFormat ) )
{
args = "-f " + inputFormat + " " + args ;
}
}
2020-03-27 00:45:48 +01:00
var processStartInfo = new ProcessStartInfo
2018-12-14 10:40:55 +01:00
{
CreateNoWindow = true ,
UseShellExecute = false ,
2019-10-26 22:53:53 +02:00
FileName = _ffmpegPath ,
2018-12-14 10:40:55 +01:00
Arguments = args ,
2020-03-27 00:10:16 +01:00
WindowStyle = ProcessWindowStyle . Hidden ,
ErrorDialog = false
2020-03-27 00:45:48 +01:00
} ;
2018-12-14 10:40:55 +01:00
2020-03-27 01:53:08 +01:00
_logger . LogInformation ( processStartInfo . FileName + " " + processStartInfo . Arguments ) ;
2018-12-14 10:40:55 +01:00
2019-04-30 23:35:39 +02:00
await _thumbnailResourcePool . WaitAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
2018-12-14 10:40:55 +01:00
bool ranToCompletion = false ;
2020-04-11 19:25:50 +02:00
var process = new Process
{
StartInfo = processStartInfo ,
EnableRaisingEvents = true
} ;
2019-10-26 22:53:53 +02:00
using ( var processWrapper = new ProcessWrapper ( process , this ) )
2018-12-14 10:40:55 +01:00
{
try
{
StartProcess ( processWrapper ) ;
// Need to give ffmpeg enough time to make all the thumbnails, which could be a while,
// but we still need to detect if the process hangs.
// Making the assumption that as long as new jpegs are showing up, everything is good.
bool isResponsive = true ;
int lastCount = 0 ;
while ( isResponsive )
{
2020-03-27 01:09:09 +01:00
if ( await process . WaitForExitAsync ( TimeSpan . FromSeconds ( 30 ) ) . ConfigureAwait ( false ) )
2018-12-14 10:40:55 +01:00
{
ranToCompletion = true ;
break ;
}
cancellationToken . ThrowIfCancellationRequested ( ) ;
2019-10-26 22:53:53 +02:00
var jpegCount = _fileSystem . GetFilePaths ( targetDirectory )
2018-12-14 10:40:55 +01:00
. Count ( i = > string . Equals ( Path . GetExtension ( i ) , ".jpg" , StringComparison . OrdinalIgnoreCase ) ) ;
2019-10-26 22:53:53 +02:00
isResponsive = jpegCount > lastCount ;
2018-12-14 10:40:55 +01:00
lastCount = jpegCount ;
}
if ( ! ranToCompletion )
{
StopProcess ( processWrapper , 1000 ) ;
}
}
finally
{
2019-04-30 23:35:39 +02:00
_thumbnailResourcePool . Release ( ) ;
2018-12-14 10:40:55 +01:00
}
var exitCode = ranToCompletion ? processWrapper . ExitCode ? ? 0 : - 1 ;
if ( exitCode = = - 1 )
{
var msg = string . Format ( "ffmpeg image extraction failed for {0}" , inputArgument ) ;
2018-12-15 00:48:06 +01:00
_logger . LogError ( msg ) ;
2018-12-14 10:40:55 +01:00
throw new Exception ( msg ) ;
}
}
}
private void StartProcess ( ProcessWrapper process )
{
process . Process . Start ( ) ;
2019-10-26 22:53:53 +02:00
lock ( _runningProcessesLock )
2018-12-14 10:40:55 +01:00
{
_runningProcesses . Add ( process ) ;
}
}
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
2018-12-14 10:40:55 +01:00
private void StopProcess ( ProcessWrapper process , int waitTimeMs )
{
try
{
if ( process . Process . WaitForExit ( waitTimeMs ) )
{
return ;
}
2018-12-15 00:48:06 +01:00
_logger . LogInformation ( "Killing ffmpeg process" ) ;
2018-12-14 10:40:55 +01:00
process . Process . Kill ( ) ;
}
Fix exceptions while scanning
Fixes these exceptions:
```
[2019-12-22 20:48:14.779 +01:00] [ERR] Error in WaitForExit
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.GetWaitState()
at System.Diagnostics.Process.WaitForExitCore(Int32 milliseconds)
at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
at Emby.Server.Implementations.Diagnostics.CommonProcess.WaitForExit(Int32 timeMs) in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 100
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 785
[2019-12-22 20:48:14.790 +01:00] [INF] Killing ffmpeg process
[2019-12-22 20:48:14.795 +01:00] [ERR] Error killing process
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.Kill()
at Emby.Server.Implementations.Diagnostics.CommonProcess.Kill() in /home/pi/dev/jellyfin/Emby.Server.Implementations/Diagnostics/CommonProcess.cs:line 95
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.StopProcess(ProcessWrapper process, Int32 waitTimeMs) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 799
[2019-12-22 20:48:14.808 +01:00] [ERR] Error in "ffprobe"
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.streams[0].start_pts | LineNumber: 32 | BytePositionInLine: 26.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Converters.JsonConverterString.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnRead(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonPropertyInfo.Read(JsonTokenType tokenType, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.JsonSerializer.HandleValue(JsonTokenType tokenType, JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadCore(JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& readStack)
at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable`1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs:line 399
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs:line 122
at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken) in /home/pi/dev/jellyfin/MediaBrowser.Providers/Manager/MetadataService.cs:line 815
```
2019-12-22 21:39:26 +01:00
catch ( InvalidOperationException )
{
// The process has already exited or
// there is no process associated with this Process object.
}
2018-12-14 10:40:55 +01:00
catch ( Exception ex )
{
2018-12-20 13:11:26 +01:00
_logger . LogError ( ex , "Error killing process" ) ;
2018-12-14 10:40:55 +01:00
}
}
private void StopProcesses ( )
{
List < ProcessWrapper > proceses ;
2019-10-26 22:53:53 +02:00
lock ( _runningProcessesLock )
2018-12-14 10:40:55 +01:00
{
proceses = _runningProcesses . ToList ( ) ;
_runningProcesses . Clear ( ) ;
}
foreach ( var process in proceses )
{
if ( ! process . HasExited )
{
StopProcess ( process , 500 ) ;
}
}
}
public string EscapeSubtitleFilterPath ( string path )
{
// https://ffmpeg.org/ffmpeg-filters.html#Notes-on-filtergraph-escaping
// We need to double escape
return path . Replace ( '\\' , '/' ) . Replace ( ":" , "\\:" ) . Replace ( "'" , "'\\\\\\''" ) ;
}
2019-10-26 22:53:53 +02:00
/// <inheritdoc />
2018-12-14 10:40:55 +01:00
public void Dispose ( )
{
Dispose ( true ) ;
2019-10-26 22:53:53 +02:00
GC . SuppressFinalize ( this ) ;
2018-12-14 10:40:55 +01:00
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose ( bool dispose )
{
if ( dispose )
{
StopProcesses ( ) ;
}
}
2020-01-16 13:30:38 +01:00
/// <inheritdoc />
2018-12-14 10:40:55 +01:00
public Task ConvertImage ( string inputPath , string outputPath )
{
throw new NotImplementedException ( ) ;
}
2020-01-16 13:30:38 +01:00
/// <inheritdoc />
2018-12-14 10:40:55 +01:00
public IEnumerable < string > GetPrimaryPlaylistVobFiles ( string path , IIsoMount isoMount , uint? titleNumber )
{
2020-01-16 13:30:38 +01:00
// min size 300 mb
const long MinPlayableSize = 314572800 ;
var root = isoMount ! = null ? isoMount . MountedPath : path ;
// Try to eliminate menus and intros by skipping all files at the front of the list that are less than the minimum size
// Once we reach a file that is at least the minimum, return all subsequent ones
var allVobs = _fileSystem . GetFiles ( root , true )
. Where ( file = > string . Equals ( file . Extension , ".vob" , StringComparison . OrdinalIgnoreCase ) )
. OrderBy ( i = > i . FullName )
. ToList ( ) ;
// If we didn't find any satisfying the min length, just take them all
if ( allVobs . Count = = 0 )
{
_logger . LogWarning ( "No vobs found in dvd structure." ) ;
return Enumerable . Empty < string > ( ) ;
}
if ( titleNumber . HasValue )
{
2020-01-16 15:02:50 +01:00
var prefix = string . Format (
CultureInfo . InvariantCulture ,
titleNumber . Value > = 10 ? "VTS_{0}_" : "VTS_0{0}_" ,
titleNumber . Value ) ;
2020-01-16 13:30:38 +01:00
var vobs = allVobs . Where ( i = > i . Name . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) ) . ToList ( ) ;
if ( vobs . Count > 0 )
{
var minSizeVobs = vobs
. SkipWhile ( f = > f . Length < MinPlayableSize )
. ToList ( ) ;
return minSizeVobs . Count = = 0 ? vobs . Select ( i = > i . FullName ) : minSizeVobs . Select ( i = > i . FullName ) ;
}
2020-04-27 03:25:57 +02:00
_logger . LogWarning ( "Could not determine vob file list for {Path} using DvdLib. Will scan using file sizes." , path ) ;
2020-01-16 13:30:38 +01:00
}
var files = allVobs
. SkipWhile ( f = > f . Length < MinPlayableSize )
. ToList ( ) ;
// If we didn't find any satisfying the min length, just take them all
if ( files . Count = = 0 )
{
_logger . LogWarning ( "Vob size filter resulted in zero matches. Taking all vobs." ) ;
files = allVobs ;
}
// Assuming they're named "vts_05_01", take all files whose second part matches that of the first file
if ( files . Count > 0 )
{
var parts = _fileSystem . GetFileNameWithoutExtension ( files [ 0 ] ) . Split ( '_' ) ;
if ( parts . Length = = 3 )
{
var title = parts [ 1 ] ;
files = files . TakeWhile ( f = >
{
var fileParts = _fileSystem . GetFileNameWithoutExtension ( f ) . Split ( '_' ) ;
return fileParts . Length = = 3 & & string . Equals ( title , fileParts [ 1 ] , StringComparison . OrdinalIgnoreCase ) ;
} ) . ToList ( ) ;
// If this resulted in not getting any vobs, just take them all
if ( files . Count = = 0 )
{
_logger . LogWarning ( "Vob filename filter resulted in zero matches. Taking all vobs." ) ;
files = allVobs ;
}
}
}
return files . Select ( i = > i . FullName ) ;
2018-12-14 10:40:55 +01:00
}
public bool CanExtractSubtitles ( string codec )
{
2019-01-20 21:03:18 +01:00
// TODO is there ever a case when a subtitle can't be extracted??
return true ;
2018-12-14 10:40:55 +01:00
}
private class ProcessWrapper : IDisposable
{
private readonly MediaEncoder _mediaEncoder ;
2019-10-26 22:53:53 +02:00
private bool _disposed = false ;
2020-03-27 00:10:16 +01:00
public ProcessWrapper ( Process process , MediaEncoder mediaEncoder )
2018-12-14 10:40:55 +01:00
{
Process = process ;
_mediaEncoder = mediaEncoder ;
2019-10-26 22:53:53 +02:00
Process . Exited + = OnProcessExited ;
2018-12-14 10:40:55 +01:00
}
2020-03-27 00:10:16 +01:00
public Process Process { get ; }
2019-10-26 22:53:53 +02:00
public bool HasExited { get ; private set ; }
public int? ExitCode { get ; private set ; }
2020-04-19 11:16:09 +02:00
private void OnProcessExited ( object sender , EventArgs e )
2018-12-14 10:40:55 +01:00
{
2020-03-27 00:10:16 +01:00
var process = ( Process ) sender ;
2018-12-14 10:40:55 +01:00
HasExited = true ;
try
{
ExitCode = process . ExitCode ;
}
catch
{
}
DisposeProcess ( process ) ;
}
2020-03-27 00:10:16 +01:00
private void DisposeProcess ( Process process )
2018-12-14 10:40:55 +01:00
{
2019-10-26 22:53:53 +02:00
lock ( _mediaEncoder . _runningProcessesLock )
2018-12-14 10:40:55 +01:00
{
_mediaEncoder . _runningProcesses . Remove ( this ) ;
}
try
{
process . Dispose ( ) ;
}
catch
{
}
}
public void Dispose ( )
{
2019-10-26 22:53:53 +02:00
if ( ! _disposed )
2018-12-14 10:40:55 +01:00
{
2019-10-26 22:53:53 +02:00
if ( Process ! = null )
2018-12-14 10:40:55 +01:00
{
2019-10-26 22:53:53 +02:00
Process . Exited - = OnProcessExited ;
DisposeProcess ( Process ) ;
2018-12-14 10:40:55 +01:00
}
}
2019-10-26 22:53:53 +02:00
_disposed = true ;
2018-12-14 10:40:55 +01:00
}
}
}
2018-12-28 00:27:57 +01:00
}