amr转MP3
using System;
using System.Threading;
using System.IO;
using System.Diagnostics;
using System.Security;
public partial class cowala_201512Chritmas_amrtest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
changedPlay.Visible = false;
}
}
protected void Ffmpeg_Click(object sender, EventArgs e)
{
if (AmrFileUp.HasFile)
{
string key = AmrFileUp.FileName;
string savepath = Server.MapPath("~/upload/amr/") + key;
AmrFileUp.SaveAs(savepath);
string mp3SavePth = Server.MapPath("~/upload/mp3/") + key.Split('.')[0].ToString() + ".mp3";
if (!string.IsNullOrEmpty(ConvertToMp3(savepath, mp3SavePth)))
{
changedPlay.Visible = true;
changedPlay.Attributes.Add("src", "upload/mp3/" + key.Split('.')[0].ToString() + ".mp3");
Response.Write("<script>alert('转换成功!');</script>");
}
}
}
public string ConvertToMp3(string pathBefore, string pathLater)
{
string c = Server.MapPath("/ffmpeg/") + @"ffmpeg.exe -i " + pathBefore + " " + pathLater;
string str = RunCmd(c);
return str;
}
/// <summary>
/// 执行Cmd命令
/// </summary>
private string RunCmd(string c)
{
try
{
ProcessStartInfo info = new ProcessStartInfo("cmd.exe");
info.RedirectStandardOutput = false;
info.UseShellExecute = false;
Process p = Process.Start(info);
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.Start();
p.StandardInput.WriteLine(c);
p.StandardInput.AutoFlush = true;
Thread.Sleep(1000);
p.StandardInput.WriteLine("exit");
p.WaitForExit();
string outStr = p.StandardOutput.ReadToEnd();
p.Close();
return outStr;
}
catch (Exception ex)
{
return "error" + ex.Message;
}
}
}
amr转MP3的更多相关文章
- ffmpeg centos6.5上安装(测试 amr 转换为 mp3)
1. 下载相关源码包 wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz wget http://sourcefo ...
- 解决linux AMR转MP3出现转码成功却无法播放的问题
根据帖子:http://blog.csdn.net/z313731418/article/details/50218341 的提示,在linux安装ffmpeg,确实在linux下使用命令可以将am ...
- window64 PHP ffmpeg详解简单上手 音频amr转mp3
从网上找了一大堆关于window 64 ffmpeg的信息,都是又长又不关键,让人难消化. 我只要简单的amr转MP3格式而已. 终于搞明白.自己总结了下! 希望能帮助到喜欢言简意赅,一眼上手的同学. ...
- java实现windows下amr转换为mp3(可实现微信语音和qq语音转换)
最近做一个项目需要将微信的语音文件放在页面进行播放,查了好多资料发现,web页面直接播放并没有一个好的解决方案,于是就想到了先将amr文件转换成易于在页面播放的mp3文件,然后在进行播放,现在将amr ...
- AMR 转mp3 失败
private void changeToMp3(String sourcePath) { File source = new File(sourcePath); String mp3TargetPa ...
- jav音频格式转换 ffmpeg 微信录音amr转mp3
项目背景: 之前公司开发了一个微信公众号,要求把js-sdk录音文件在web网页也能播放.众所周知,html的<audio>标签ogg,mp3,wav,也有所说苹果safari支持m4a格 ...
- php自定义函数: amr转mp3格式
<?php function amr2mp3($file){ if (file_exists($file . '.mp3') == true) { return; } else { $param ...
- .net 音频转换 .amr 转 .mp3 (ffmpeg转换法)
最近看来是跟声音干上了啊! 音频转换的第二种方法,这种方法相对第一种来说,要简单的多! 首先,你得下载个“ffmpeg.exe” 插件,然后把它放到你的项目中,如下图: 程序中会调用该文件,以助于转换 ...
- .net 音频转换 .amr 转 .mp3 (七牛转换法)
.amr 用于移动设备的音频,压缩比比较大,多用于人声.通话,效果还行!所以,移动设备多采用amr格式来进行录存!比较常见的例子:通话录音,微信语音以及录音等! 这个鬼,用两个字来形容,就是“蛋疼”: ...
随机推荐
- 利用cubieboard设置samba打印服务器
#注意安装下面软件前,先将cubieboard的动态地址改为静态地址! apt-get install samba #安装samba vi /etc/samba/smb.conf //配置 workg ...
- Res_Orders_02
一.燃尽图展示 二.项目进展 1.实现用户名找回 2.css样式嵌入
- 获取B表数据添加到A表中作为一个下拉列表元素存在
1.ProductController类里toedit方法内添加: ProductModel product = ProductModel.dao.findById(id); //通过id查找服务类 ...
- php查看网页源代码的方法
这篇文章主要介绍了php查看网页源代码的方法,涉及php读取网页文件的技巧,具有一定参考借鉴价值,需要的朋友可以参考下 本文实例讲述了php查看网页源代码的方法.分享给大家供大家参考.具体实现 ...
- 项目在build machine中失败,本地Build成功的程序集版本问题
MSBuild在build machine中遇到which has a higher version than its reference assembly:(in my case let's say ...
- Maven项目导入后打红色X
在所有的配置都正确的情况,程序能正常运行跑起来,看一下problem下的红色错误 如果这两个错误不影响你的程序,或者已经配置或处理,直接右击删除这两个错就行了. 删除之后,就没有了吧,OK搞定
- Unix调试工具dbx使用方法
dbx 命令 用途 提供了一个调试和运行程序的环境. 语法 dbx [ -a ProcessID ] [ -c CommandFile ] [ -d NestingDepth ] [ -I Dire ...
- Listbox简单用法
<ListBox x:Name="ListBoxPatientAllergy" Grid.Row="1" ItemContainerStyle=" ...
- 移动端bug整理,随时更新
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #454545 } p.p2 { margin: 0.0p ...
- c++ auto_ptr智能指针
c++ auto_ptr智能指针 该类型在头文件memory中,在程序的开通通过 #include<memory> 导入,接下来讲解该智能指针的作用和使用. 使用方法: auto_ptr& ...