示例#1
0
        /// <summary>
        /// starts an ffmpeg process and sets up associated sockets
        /// </summary>
        void OpenFileSegment()
        {
            try
            {
                ffmpeg = new Process();
            #if WINDOWS
                ffmpeg.StartInfo.FileName = System.IO.Path.Combine(PathManager.GetBasePathAbsolute(), "dll", "ffmpeg.exe");
            #else
                ffmpeg.StartInfo.FileName = "ffmpeg"; // expecting native version to be in path
            #endif

                string filename = String.Format("{0}_{1,4:D4}{2}", baseName, segment, ext);
                ffmpeg.StartInfo.Arguments = String.Format("-y -f nut -i - {1} \"{0}\"", filename, token.commandline);
                ffmpeg.StartInfo.CreateNoWindow = true;

                // ffmpeg sends informative display to stderr, and nothing to stdout
                ffmpeg.StartInfo.RedirectStandardError = true;
                ffmpeg.StartInfo.RedirectStandardInput = true;
                ffmpeg.StartInfo.UseShellExecute = false;

                commandline = "ffmpeg " + ffmpeg.StartInfo.Arguments;

                ffmpeg.ErrorDataReceived += new DataReceivedEventHandler(StderrHandler);

                stderr = new Queue<string>(consolebuffer);

                ffmpeg.Start();
            }
            catch
            {
                ffmpeg.Dispose();
                ffmpeg = null;
                throw;
            }
            ffmpeg.BeginErrorReadLine();

            muxer = new NutMuxer(width, height, fpsnum, fpsden, sampleRate, channels, ffmpeg.StandardInput.BaseStream);
        }
示例#2
0
		void endsegment()
		{
			current.Finish();
			current = null;
		}
示例#3
0
        /// <summary>
        /// finishes an ffmpeg process
        /// </summary>
        void CloseFileSegment()
        {
            muxer.Finish();
            //ffmpeg.StandardInput.Close();

            // how long should we wait here?
            ffmpeg.WaitForExit(20000);
            ffmpeg.Dispose();
            ffmpeg = null;
            stderr = null;
            commandline = null;
            muxer = null;
        }
示例#4
0
		void startsegment()
		{
			var currentfile = System.IO.File.Open(String.Format("{0}_{1,4:D4}.nut", baseName, segment), System.IO.FileMode.Create, System.IO.FileAccess.Write);
			current = new NutMuxer(width, height, fpsnum, fpsden, sampleRate, channels, currentfile);
		}