Exemplo n.º 1
0
        private void VideoCombine1(NavBarItemLink narBarItemLink)
        {
            if (_sceneVideoInfoList.Count == 0)
            {
                MessageBox.Show("请添加视频");
                return;
            }
            //等待窗口调用
            ShowMessage();
            for (int i = 0; i < _sceneVideoInfoList.Count; i++)
            {
                SplashScreenManager.Default.SetWaitFormCaption("正在处理第" + (i + 1) + "个视频,请稍后...");
                SplashScreenManager.Default.SetWaitFormCaption("正在处理第" + (i + 1) + "个视频,请稍后...");
                VideoInfo videoInfo = _sceneVideoInfoList[i];
                string    cmdConvert;//转换命令
                string    convertVideoName = FileHelper.GetFileAbsolutePath("SourceVideos\\") + videoInfo.VideoName + ".mp4";
                string    tempVideoName    = FileHelper.GetFileAbsolutePath("SourceVideos\\") + videoInfo.VideoName + ".ts";
                if (!videoInfo.VideoFormat.Equals(".mp4"))
                {
                    cmdConvert = VideoHelper.ConvertToMp4Cmd(videoInfo.VideoPath, convertVideoName);
                    VideoHelper.RunFFMpeg(_ffmpegPath, cmdConvert);
                }
                //文件格式转换mp4->mpegts
                cmdConvert = VideoHelper.Mp4ToTsCmd(convertVideoName, tempVideoName);
                VideoHelper.RunFFMpeg(_ffmpegPath, cmdConvert);
            }
            string itemCaption = narBarItemLink.Caption;

            //创建或更新视频列表.txt
            VideoHelper.CreateOrUpdateVideoList(_sceneVideoInfoList, itemCaption);
            //视频合并命令
            string cmdCombine = VideoHelper.GetCombineCmd(_sceneVideoInfoList, itemCaption);

            VideoHelper.RunFFMpeg(_ffmpegPath, cmdCombine);
            //刷新当前场景的截图
            FreshSceneItem(narBarItemLink);
            VideoHelper.DeleteTempVideos(_sceneVideoInfoList);
            HideMessage();
        }
Exemplo n.º 2
0
        /// <summary>视频合并操作</summary>
        /// <param name="narBarItemLink"></param>
        private void VideoCombine(NavBarItemLink narBarItemLink)
        {
            if (_sceneVideoInfoList.Count == 0)
            {
                MessageBox.Show("请添加视频");
                return;
            }
            //等待窗口调用
            ShowMessage();
            foreach (var videoInfo in _sceneVideoInfoList)
            {
                string cmdConvert;//转换命令
                string convertVideoName = FileHelper.GetFileAbsolutePath("SourceVideos\\") + videoInfo.VideoName + ".mp4";
                string tempVideoName    = FileHelper.GetFileAbsolutePath("SourceVideos\\") + videoInfo.VideoName + ".ts";
                if (!videoInfo.VideoFormat.Equals(".mp4"))
                {
                    cmdConvert = VideoHelper.ConvertToMp4Cmd(videoInfo.VideoPath, convertVideoName);
                    VideoHelper.RunFFMpeg(_ffmpegPath, cmdConvert);
                }
                //文件格式转换mp4->mpegts
                cmdConvert = VideoHelper.Mp4ToTsCmd(convertVideoName, tempVideoName);
                VideoHelper.RunFFMpeg(_ffmpegPath, cmdConvert);
            }
            string itemCaption = narBarItemLink.Caption;

            //创建或更新视频列表.txt
            VideoHelper.CreateOrUpdateVideoList(_sceneVideoInfoList, itemCaption);
            //视频合并命令
            string cmdCombine = VideoHelper.GetCombineCmd(_sceneVideoInfoList, itemCaption);

            if (VideoHelper.RunFFMpeg(_ffmpegPath, cmdCombine))
            {
                //刷新当前场景的截图
                FreshSceneItem(narBarItemLink);
                VideoHelper.DeleteTempVideos(_sceneVideoInfoList);
                simpleButtonCombine.Visible = false;
            }
            HideMessage();
        }