Пример #1
0
        public string Convert(string inputFile, AudioEncoder audioEncoder, Bitrate audioBitrate, string outputFile)
        {
            var arguments = "-i " + "\"" + inputFile + "\"" +
                            " -v quiet -stats " +
                            _arguments.GetValue(audioEncoder.ToString()) +
                            _arguments.GetValue(audioBitrate.ToString()) +
                            " -y " + outputFile;

            return(arguments);
        }
Пример #2
0
        public static string ToNormalizedString(this Bitrate bRate)
        {
            string bitrateString = bRate.ToString();
            char   size          = bitrateString[0];

            bitrateString  = bitrateString.Replace('_', '.');
            bitrateString  = bitrateString.Remove(0, 1);
            bitrateString += size;
            return(bitrateString);
        }
Пример #3
0
        public string Capture(string inputFile, int durationInSeconds, AudioEncoder audioEncoder, Bitrate audioBitrate, string outputFile)
        {
            var arguments = "-i " + "\"" + inputFile + "\"" +
                            " -c copy" +
                            " -t " + durationInSeconds +
                            _arguments.GetValue(audioEncoder.ToString()) +
                            _arguments.GetValue(audioBitrate.ToString()) +
                            " -y " + "\"" + outputFile + "\"";

            return(arguments);
        }
Пример #4
0
        public string Convert(string inputFile, VideoEncoder videoEncoder, VideoResize videoResize,
                              VideoPreset videoPreset, ConstantRateFactor videoConstantRateFactor,
                              AudioCodec audioCodec, Bitrate audioBitrate, string outputFile)
        {
            //-vf scale=-1:720 -c:v libx264 -preset veryfast -crf 23 -c:a aac -b:a 160k

            var arguments = "-i " + "\"" + inputFile + "\"" +
                            " -v quiet -stats " +
                            _arguments.GetValue(videoResize.ToString()) +
                            _arguments.GetValue(videoEncoder.ToString()) +
                            _arguments.GetValue(videoPreset.ToString()) +
                            _arguments.GetValue(videoConstantRateFactor.ToString()) +
                            _arguments.GetValue(audioCodec.ToString()) +
                            _arguments.GetValue(audioBitrate.ToString()) +
                            " -y " + "\"" + outputFile + "\"";



            return(arguments);
        }
Пример #5
0
 public virtual string GetSourceName()
 {
     return(Source + "_" + Bitrate.ToString() + "_" + (string.IsNullOrEmpty(TrackName) ? "unknown" :TrackName.ToString()));
 }
Пример #6
0
        /// <summary>
        /// Streams a given music file. (Renamed from request name "stream")
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="id">Required: Yes; A string which uniquely identifies the file to stream. 
        /// Obtained by calls to getMusicDirectory.</param>
        /// <param name="maxBitRate">Required: No; If specified, the server will attempt to 
        /// limit the bitrate to this value, in kilobits per second.  </param>
        /// <returns></returns>
        public static Stream StreamSong(ISubsonicConnection connection, string id, Bitrate maxBitRate = Bitrate.NoPreference)
        {
            // Reades the id of the song and sets it as a parameter
            Dictionary<string, string> theParameters = new Dictionary<string, string> {{"id", id}};
            if (!maxBitRate.Equals(Bitrate.NoPreference))
            {
                theParameters.Add("maxBitRate", maxBitRate.ToString());
            }

            // Makes the request
            return connection.GetResponseStream("stream", theParameters);
        }
Пример #7
0
 public virtual string GetSourceName()
 {
     return(Source + "_" + Bitrate.ToString() + "_" + TrackName.ToString());
 }