示例#1
0
        public override bool BeginRecording(RecordingSession session)
        {
            if (!base.BeginRecording(session))
            {
                return(false);
            }

            if (!FFmpegPipe.IsAvailable)
            {
                Debug.LogError(
                    "Failed to initialize an FFmpeg session due to missing " +
                    "executable file. Please check FFmpeg installation."
                    );
                return(false);
            }

            m_Settings.fileNameGenerator.CreateDirectory(session);

            var input = m_Inputs[0] as BaseRenderTextureInput;
            var args  =
                "-y -f rawvideo -vcodec rawvideo -pixel_format rgba"
                + " -colorspace bt709"
                + " -video_size " + input.outputWidth + "x" + input.outputHeight
                + " -framerate " + session.settings.frameRate
                + " -loglevel error -i - " + m_Settings.preset.GetOptions()
                + " " + m_Settings.FrameRateArgs
                + " \"" + m_Settings.fileNameGenerator.BuildAbsolutePath(session) + "\"";

            _pipe = new FFmpegPipe(args);

            return(true);
        }
示例#2
0
 void OpenPipe()
 {
     timeStampList = new List <byte> ();
     DataRecorder.StartRecording();
     // Open an output stream.
     _pipe = new FFmpegPipe("Heatmap", renderingTexture.width, renderingTexture.height, _frameRate, PupilSettings.Instance.recorder.codec);
     Debug.Log("Capture started (" + _pipe.Filename + ")");
 }
示例#3
0
        protected override void DisposeEncoder()
        {
            base.DisposeEncoder();

            if (_pipe != null)
            {
                var error = _pipe.CloseAndGetOutput();

                if (!string.IsNullOrEmpty(error))
                {
                    Debug.LogWarning(
                        "FFmpeg returned with warning/error messages. " +
                        "See the following lines for details:\n" + error
                        );
                }

                _pipe.Dispose();
                _pipe = null;
            }
        }
示例#4
0
    void ClosePipe()
    {
        // Close the output stream.
        Debug.Log("Capture ended (" + _pipe.Filename + ").");

        // Write pupil timestamps to a file
        string timeStampFileName = "Heatmap_Timestamps";

        byte[] timeStampByteArray = timeStampList.ToArray();
        File.WriteAllBytes(_pipe.FilePath + "/" + timeStampFileName + ".time", timeStampByteArray);

        _pipe.Close();

        if (!string.IsNullOrEmpty(_pipe.Error))
        {
            Debug.LogWarning(
                "ffmpeg returned with a warning or an error message. " +
                "See the following lines for details:\n" + _pipe.Error
                );
        }

        _pipe = null;
    }