0
点赞
收藏
分享

微信扫一扫

c#批量提取视频中的图片

_刘彦辉 2023-10-31 阅读 35


//c#获取MP4文件夹下所有视频文件,然后批量提取视频中的图片,命名为MP4的文件.jpg 
string[] files = Directory.GetFiles(folderPath, "*.mp4", SearchOption.AllDirectories);
            foreach (string file in files)
            {
                using (System.Diagnostics.Process process = new System.Diagnostics.Process())
                {
                    process.StartInfo.FileName = @"C:\Program Files\ffmpeg\bin\ffmpeg.exe";
                    string fileName = Path.GetFileName(file).Replace("#","").Replace(".mp4","");
                    process.StartInfo.Arguments = @"-i " + file + " -ss 5 -f image2 D:\\fangyuan\\"+fileName+".jpg";
                    process.Start();
                }
            }

举报

相关推荐

0 条评论