コード例 #1
0
        private RecordingMetadata ConvertStudioRecording(string inputFileName, string outputFolder)
        {
            // identify file paths
            var slideVideoPath = inputFileName.Replace("_meta.json", "_slides.mp4");
            var thVideoPath    = inputFileName.Replace("_meta.json", "_talkinghead.mp4");
            var ckFile         = inputFileName.Replace("_meta.json", ".ckparams");

            // setup of recording
            var targetDimension = Dimension.Dim720p;
            var recordingStyle  = new TKStudioStyle(targetDimension);

            if (File.Exists(ckFile))
            {
                dynamic ckInfo = JsonConvert.DeserializeObject(File.ReadAllText(ckFile));

                if (ckInfo["color"] != null)
                {
                    recordingStyle.ChromaKeyParams.Color = ckInfo["color"];
                }
                else
                {
                    recordingStyle.ChromaKeyParams.Color = chromaKeyParamGuesser.GuessChromaKeyParams(thVideoPath);
                }

                if (ckInfo["similarity"] != null)
                {
                    recordingStyle.ChromaKeyParams.Similarity = ckInfo["similarity"];
                }
                if (ckInfo["blend"] != null)
                {
                    recordingStyle.ChromaKeyParams.Blend = ckInfo["blend"];
                }
            }
            else
            {
                recordingStyle.ChromaKeyParams.Color = chromaKeyParamGuesser.GuessChromaKeyParams(thVideoPath);
            }

            var config = new ConversionConfiguration()
            {
                SlideVideoPath       = slideVideoPath,
                TalkingHeadVideoPath = thVideoPath,
                MetadataPath         = inputFileName,
                OutputDirectory      = outputFolder,
                ProjectName          = Path.GetFileName(inputFileName).Replace("_meta.json", ""),
                RecordingStyle       = recordingStyle,
                ExportJson           = false
            };

            return(converter.ConvertPreviewMedia(config));
        }