示例#1
0
        internal override bool SupportsTransparency(MovieRecorderSettings settings, out string errorMessage)
        {
            if (!base.SupportsTransparency(settings, out errorMessage))
            {
                return(false);
            }

            errorMessage = "";
            if (settings.OutputFormat == VideoRecorderOutputFormat.MP4)
            {
                errorMessage = "MP4 format does not support alpha.";
            }
            return(settings.OutputFormat == VideoRecorderOutputFormat.WebM && settings.ImageInputSettings.SupportsTransparent);
        }
示例#2
0
        private static MovieRecorderSettings GetRecorder()
        {
            var recorderWindow = EditorWindow.GetWindow <RecorderWindow>();

            if (!recorderWindow)
            {
                return(null);
            }

            // first try to get the selected item, if it's not a MovieRecorder,
            // then go through the list and try to find one that is called "Shotgun".
            // if there isn't one then just take one of the MovieRecorders.
            var selectedRecorder = GetFieldValue("m_SelectedRecorderItem", recorderWindow);

            if (selectedRecorder != null)
            {
                RecorderSettings recorderSettings = GetPropertyValue("settings", selectedRecorder, BindingFlags.Public | BindingFlags.Instance) as RecorderSettings;
                if (recorderSettings.GetType().Equals(typeof(MovieRecorderSettings)))
                {
                    // found movie recorder settings
                    return(recorderSettings as MovieRecorderSettings);
                }
            }

            var recorderList = GetFieldValue("m_RecordingListItem", recorderWindow);
            var itemList     = (IEnumerable)GetPropertyValue("items", recorderList, BindingFlags.Public | BindingFlags.Instance);
            MovieRecorderSettings movieRecorder = null;

            foreach (var item in itemList)
            {
                RecorderSettings settings = GetPropertyValue("settings", item, BindingFlags.Public | BindingFlags.Instance) as RecorderSettings;
                var recorder = settings as MovieRecorderSettings;
                if (recorder == null)
                {
                    continue;
                }
                movieRecorder = recorder;

                var editableLabel = GetFieldValue("m_EditableLabel", item);
                var labelText     = (string)GetPropertyValue("text", editableLabel);
                if (labelText.Equals("Shotgun"))
                {
                    return(movieRecorder);
                }
            }
            return(movieRecorder);
        }
示例#3
0
        internal override bool SupportsTransparency(MovieRecorderSettings settings, out string errorMessage)
        {
            if (!base.SupportsTransparency(settings, out errorMessage))
            {
                return(false);
            }

            ProResOut.ProResCodecFormat selectedFormat = (ProResOut.ProResCodecFormat)settings.encoderPresetSelected;
            if (!ProResOut.ProResPresetExtensions.CodecFormatSupportsTransparency(selectedFormat))
            {
                errorMessage = string.Format("Codec format '{0}' does not support transparency.", ProResOut.ProResPresetExtensions.GetDisplayName(selectedFormat));
                return(false);
            }

            errorMessage = "";
            return(settings.ImageInputSettings.SupportsTransparent);
        }
示例#4
0
        internal virtual bool SupportsResolution(MovieRecorderSettings settings, int width, int height, out string errorMessage, out string warningMessage)
        {
            errorMessage   = "";
            warningMessage = "";
            if (width <= 0 || height <= 0)
            {
                var rtSettings    = settings.ImageInputSettings as RenderTextureInputSettings;
                var inputIsNullRT = rtSettings != null && rtSettings.renderTexture == null;
                if (!inputIsNullRT)
                {
                    // We don't log this message for null RT input because in that case the fix should be to assign a RT
                    errorMessage = string.Format("The encoder doesn't support the input resolution {0}x{1}.", width, height);
                    return(false);
                }
            }

            return(true);
        }
        internal override bool SupportsResolution(MovieRecorderSettings settings, int width, int height, out string errorMessage, out string warningMessage)
        {
            if (!base.SupportsResolution(settings, width, height, out errorMessage, out warningMessage))
            {
                return(false);
            }

            errorMessage = "";
            if (settings.OutputFormat == VideoRecorderOutputFormat.MP4)
            {
                if (height % 2 != 0 || width % 2 != 0)
                {
                    errorMessage = "The MP4 format does not support odd values in resolution";
                    return(false);
                }
            }

            return(true);
        }
示例#6
0
        internal void Initialize()
        {
            var controllerSettings = ScriptableObject.CreateInstance <RecorderControllerSettings>();

            m_RecorderController = new RecorderController(controllerSettings);

            var mediaOutputFolder = new DirectoryInfo(Path.Combine(Application.dataPath, "..", "SampleRecordings"));

            // Video
            m_Settings         = ScriptableObject.CreateInstance <MovieRecorderSettings>();
            m_Settings.name    = "My Video Recorder";
            m_Settings.Enabled = true;

            // This example performs an MP4 recording
            m_Settings.OutputFormat     = MovieRecorderSettings.VideoRecorderOutputFormat.MP4;
            m_Settings.VideoBitRateMode = VideoBitrateMode.High;

            m_Settings.ImageInputSettings = new GameViewInputSettings
            {
                OutputWidth  = 1920,
                OutputHeight = 1080
            };

            m_Settings.AudioInputSettings.PreserveAudio = m_RecordAudio;

            // Simple file name (no wildcards) so that FileInfo constructor works in OutputFile getter.
            m_Settings.OutputFile = mediaOutputFolder.FullName + "/" + "video";

            // Setup Recording
            controllerSettings.AddRecorderSettings(m_Settings);
            controllerSettings.SetRecordModeToManual();
            controllerSettings.FrameRate = 60.0f;

            RecorderOptions.VerboseMode = false;
            m_RecorderController.PrepareRecording();
            m_RecorderController.StartRecording();

            Debug.Log($"Started recording for file {OutputFile.FullName}");
        }
示例#7
0
        internal override bool SupportsResolution(MovieRecorderSettings settings, int width, int height, out string errorMessage)
        {
            if (!base.SupportsResolution(settings, width, height, out errorMessage))
            {
                return(false);
            }

            errorMessage = "";
            if (settings.OutputFormat == VideoRecorderOutputFormat.MP4)
            {
                if (height % 2 != 0 || width % 2 != 0)
                {
                    errorMessage = "The MP4 format does not support odd values in resolution";
                    return(false);
                }

                if (width > 4096 || height > 4096)
                {
                    Debug.LogWarning(string.Format("MP4 format might not support resolutions bigger than 4096. Current resolution: {0} x {1}.", width, height));
                }
            }

            return(true);
        }
示例#8
0
 internal virtual bool SupportsTransparency(MovieRecorderSettings settings, out string errorMessage)
 {
     errorMessage = "";
     return(true);
 }
示例#9
0
 /// <summary>
 /// Gets the texture format that is required for this encoder, in the given context.
 /// The returned value might depend on support for transparency and source image bit depth, for instance.
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 internal virtual TextureFormat GetTextureFormat(MovieRecorderSettings settings)
 {
     return(TextureFormat.RGBA32);
 }
示例#10
0
        internal override bool PerformsVerticalFlip => false; // the ProRes wrappers do not perform a VFlip

        internal override TextureFormat GetTextureFormat(MovieRecorderSettings settings)
        {
            return(settings.WillIncludeAlpha() ? TextureFormat.ARGB32 : TextureFormat.RGB24);
        }