ffmpeg录音录像

ffmpeg录音录像 ffmpeg,ffplay,ffprobe主要用来录音录像播放查看多媒体文件的信息。本文带领大家学习常用命令。常用参数比较多,可以使用ffprobe --help来查看详细的帮助信息

#region ffmpeg录音录像 ffmpeg,ffplay,ffprobe主要用来录音录像播放查看多媒体文件的信息。本文带领大家学习常用命令。常用参数比较多,可以使用ffprobe --help来查看详细的帮助信息#region ffmpeg 录像Process process = null;private void btnFfmepgStart_Click(object sender, EventArgs e){#region MyRegion//System.Diagnostics.Process.Start(@"C:\Users\Administrator\Desktop\Debug\WindowsFormsTestVideo.exe","参数122");//Process process1 = new Process();//process1.StartInfo = new ProcessStartInfo(@"C:\Users\Administrator\Desktop\Debug\WindowsFormsTestVideo.exe");//process1.StartInfo.Arguments = "参数12277777777777777";//process1.Start();process1.WaitForExit(10000);process1.Close();//process1.Dispose(); #endregion//ProcessStartInfo StartInfo = new ProcessStartInfo(@"C:\Windows\System32\cmd.exe");process = new Process();process.StartInfo = new ProcessStartInfo(@"C:\Windows\System32\cmd.exe");process.StartInfo.CreateNoWindow = true;process.StartInfo.UseShellExecute = false;process.StartInfo.RedirectStandardInput = true;process.StartInfo.RedirectStandardOutput = true;process.StartInfo.RedirectStandardError = true;//process.StartInfo.WorkingDirectory = @"C:\Windows\System32";// AppDomain.CurrentDomain.BaseDirectory;process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;string a = "ffmpeg -rtbufsize 200M -f dshow  -i video=\"USB Camera\" -f dshow -i audio=\"麦克风阵列 (Realtek High Definition Audio)\" -pix_fmt yuv420p   -b:v 300k -r 10 -vcodec libx264 -tune zerolatency -acodec aac -b:a 32k -ar 16000 -af volume=10 -y  \"123.mp4\"";string at = @"ffmpeg -rtbufsize 200M -f dshow  -i video=""USB Camera"" -f dshow -i audio=""麦克风阵列 (Realtek High Definition Audio)"" -pix_fmt yuv420p   -b:v 300k -r 10 -vcodec libx264 -tune zerolatency -acodec aac -b:a 32k -ar 16000 -af volume=10 -y  ""123.mp4""";//Log(a, MessageType.info);//Log(at, MessageType.info);//process.StandardInput.WriteLine(a);process.OutputDataReceived += Process_OutputDataReceived;process.ErrorDataReceived += Process_ErrorDataReceived;//process.StartInfo.Arguments = a;process.Start();process.BeginErrorReadLine();process.BeginOutputReadLine();a = @"ffmpeg.exe -rtbufsize 200M  -f dshow  -i video=""USB Camera"" -f dshow -i audio=""麦克风阵列 (Realtek High Definition Audio)"" -pix_fmt yuv420p -tune zerolatency -af volume=5 -y 123.mp4";//噪音很大,去掉 -af volume=5,噪音会好很多//-ac 通道 声道 1,2;//-ar 8000 声音的采样率 psp 24000Hz//-ab 音频数据流,一般选择32,64,96,128 44100置成这个参数音频底噪会小,但是音色会有些发闷//-vol音量 放大倍数a = @"ffmpeg.exe -rtbufsize 200M  -f dshow  -i video=""USB Camera"" -f dshow -i audio=""麦克风阵列 (Realtek High Definition Audio)"" -pix_fmt yuv420p -tune zerolatency -ac 1 -ar 8000 -ab 44100 -vol 800 -y 123.mp4";process.StandardInput.WriteLine(a);//process.StandardInput.WriteLine(at/* + Environment.NewLine*/);//process.StandardInput.WriteLine("\r\n");Log(a, MessageType.info);Log(at, MessageType.info);lblffmepg.ForeColor = Color.Green;lblffmepg.Text = "开始录音录像";}private void Process_ErrorDataReceived(object sender, DataReceivedEventArgs e){Log(e.Data, MessageType.error);}private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e){Log(e.Data, MessageType.info);}private void btnFfmpegStop_Click(object sender, EventArgs e){string a = "q";process.StandardInput.WriteLine(a);process.StandardInput.WriteLine("exit");process.WaitForExit();process.Close();process.Dispose();Process.Start("123.mp4");lblffmepg.ForeColor = DefaultForeColor;lblffmepg.Text = null;}#endregion#region ffplay 播放// ffplay -autoexit ww.mp4#endregion#region ffprobe 查看信息// ffprobe -show_packets ww.mp4#endregion #endregion

注意:ffmpeg相关的类库拷贝到运行目录,下载地址:https://download.csdn.net/download/LongtengGensSupreme/21059889


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部