public override void Initialize(object config, string outPath)
        {
            if (!fcAPI.fcWebMIsSupported())
            {
                Debug.LogError("WebM encoder is not available on this platform.");
                return;
            }

            m_config = (fcAPI.fcWebMConfig)config;
            if (m_config.audio && m_config.audioEncoder == fcAPI.fcWebMAudioEncoder.Opus)
            {
                var sampleRate = AudioSettings.outputSampleRate;
                if (sampleRate != 8000 && sampleRate != 12000 && sampleRate != 16000 && sampleRate != 24000 && sampleRate != 48000)
                {
                    Debug.LogError("Current output sample rate is " + sampleRate + ". It must be 8000, 12000, 16000, 24000 or 48000 to use Opus audio encoder. Fallback to Vorbis.");
                    m_config.audioEncoder = fcAPI.fcWebMAudioEncoder.Vorbis;
                }
            }

            m_config.audioSampleRate  = AudioSettings.outputSampleRate;
            m_config.audioNumChannels = fcAPI.fcGetNumAudioChannels();
            m_ctx = fcAPI.fcWebMCreateContext(ref m_config);

            var path   = outPath + ".webm";
            var stream = fcAPI.fcCreateFileStream(path);

            fcAPI.fcWebMAddOutputStream(m_ctx, stream);
            stream.Release();
        }
Exemple #2
0
        public override void Initialize(object config, string outPath)
        {
            m_config = (fcAPI.fcWebMConfig)config;
            m_config.videoTargetFramerate = 60;
            m_config.audioSampleRate      = AudioSettings.outputSampleRate;
            m_config.audioNumChannels     = fcAPI.fcGetNumAudioChannels();
            m_ctx = fcAPI.fcWebMCreateContext(ref m_config);

            var path = outPath + ".webm";

            m_ostream = fcAPI.fcCreateFileStream(path);
            fcAPI.fcWebMAddOutputStream(m_ctx, m_ostream);
        }
Exemple #3
0
        public override void Initialize(MovieRecorder recorder)
        {
            m_config = recorder.webmConfig;
            fcAPI.fcWebMConfig webmconf = fcAPI.fcWebMConfig.default_value;
            webmconf                        = fcAPI.fcWebMConfig.default_value;
            webmconf.video                  = m_config.captureVideo;
            webmconf.audio                  = m_config.captureAudio;
            webmconf.video_width            = recorder.scratchBuffer.width;
            webmconf.video_height           = recorder.scratchBuffer.height;
            webmconf.video_target_framerate = 60;
            webmconf.video_target_bitrate   = m_config.videoBitrate;
            webmconf.audio_target_bitrate   = m_config.audioBitrate;
            webmconf.audio_sample_rate      = AudioSettings.outputSampleRate;
            webmconf.audio_num_channels     = fcAPI.fcGetNumAudioChannels();
            m_ctx = fcAPI.fcWebMCreateContext(ref webmconf);

            var path = recorder.outputDir.GetFullPath() + "/" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".webm";

            m_ostream = fcAPI.fcCreateFileStream(path);
            fcAPI.fcWebMAddOutputStream(m_ctx, m_ostream);
        }