protected void TranscodeFile(StorageFile videoFile, StorageFile audioFile)
        {
            var arguments = String.Format("-i \"{0}\" -acodec mp3 -y -ac 2 -ab 160 \"{1}\"", videoFile, audioFile);
            var process = new Process {
                EnableRaisingEvents = true,
                StartInfo = {
                    FileName = _applicationPath + "\\Executables\\ffmpeg.exe",
                    Arguments = arguments,
                    CreateNoWindow = true,
                    RedirectStandardError = true,
                    RedirectStandardOutput = true,
                    UseShellExecute = false,
                }
            };
            if (_onEntryDownloadStatusChange != null) _onEntryDownloadStatusChange(_youtubeEntry, DownloadState.ConvertAudioStart, 50);

            process.Start();
            using (var d = process.StandardError) {
                var duration = new TimeSpan();
                TimeSpan current;
                do {
                    var s = d.ReadLine() ?? "";
                    Debug.WriteLine(s);
                    if (s.Contains("Duration: ")) {
                        duration = ParseDuration("Duration: ", ',', s);
                    }
                    else {
                        if (s.Contains(" time=")) {
                            current = ParseDuration(" time=", ' ', s);
                            var percentage = (current.TotalMilliseconds / duration.TotalMilliseconds) * 50;
                            if (_onEntryDownloadStatusChange != null) _onEntryDownloadStatusChange(_youtubeEntry, DownloadState.DownloadProgressChanged, 50 + percentage );
                        }
                    }
                } while (!d.EndOfStream);
            }
            process.WaitForExit();
            DownloadState state;
            state = process.ExitCode == 0 ? DownloadState.Ready : DownloadState.Error;
            if (_onEntryDownloadStatusChange != null) _onEntryDownloadStatusChange(_youtubeEntry, state, 100.0);
            process.Close();
        }
 public static bool FileExists(StorageFolder folder, string videoFile)
 {
     var file = new StorageFile {StorageFolder = folder, FileName = videoFile};
     return File.Exists(file.ToString());
 }