zoukankan      html  css  js  c++  java
  • .net core 在CentOS环境下将微信公众号语音文件amr转化成mp3

    微信语音是amr格式,如需mp3格式需要自行转换,

    转换方式可以用sox或用ffmpeg,这里我们使用ffmpeg

    首先安装系统编译环境

    yum install -y automake autoconf libtool gcc gcc-c++

    编译所需源码包

    yasm:汇编器

    wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
    
    tar -xzvf yasm-1.3.0.tar.gz
    
    cd yasm-1.3.0
    
    ./configure
    
    make
    
    make install

    lame

    wget http://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
    
    tar -xzvf lame-3.99.5.tar.gz
    
    cd lame-3.99.5
    
    ./configure
    
    make
    
    make install

    amr支持

    wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
    
    tar -xzvf opencore-amr-0.1.3.tar.gz
    
    cd opencore-amr-0.1.3
    
    ./configure
    
    make
    
    make install

    amrnb支持

    wget http://www.penguin.cz/~utx/ftp/amr/amrnb-11.0.0.0.tar.bz2
    
    tar -xjvf amrnb-11.0.0.0.tar.bz2
    
    cd amrnb-11.0.0.0
    
    ./configure
    
    make
    
    make install

    amrwb支持

    wget http://www.penguin.cz/~utx/ftp/amr/amrwb-11.0.0.0.tar.bz2
    
    tar -xjvf amrwb-11.0.0.0.tar.bz2
    
    cd amrwb-11.0.0.0
    
    ./configure
    
    make
    
    make install

    ffmpeg

    wget http://ffmpeg.org/releases/ffmpeg-2.5.3.tar.bz2
    
    tar -xjvf ffmpeg-2.5.3.tar.bz2
    
    cd ffmpeg-2.5.3
    
    ./configure --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-shared
    
    make
    
    make install

    编译安装完成后在/etc/ld.so.conf文件末尾加上:/usr/local/lib 然后执行

    ldconfig
    ffmpeg -i 1.amr 1.mp3                 #AMR转换MP3
    var file ="xxx/xxx/xxx.amr";
    var newFile = file.Replace(Path.GetExtension(file), ".mp3");
    var processStartInfo= new ProcessStartInfo("ffmpeg", $" -i {file} {newFilePath}");
    using (var process= Process.Start(processStartInfo))
    {
        process?.Close();
    }
  • 相关阅读:
    window7 上创建定时任务来运行自动化脚本
    初试接口测试
    list tuple dict (列表,元祖,字典间的相互转换)
    防止忘记的一些博客
    [python] 常用正则表达式爬取网页信息及分析HTML标签总结
    python正则表达式提取字符串
    关于json的dump和dumps
    三月23日测试Fiddler
    第六章 部署Python开发的web业务
    第五节 Nginx集群
  • 原文地址:https://www.cnblogs.com/zhangliang2008/p/13177021.html
Copyright © 2011-2022 走看看