ffmpeg 转码mpeg4

q2045377 2017-09-07 12:58:00
怎么转MPeg4,,,flv可行 就是转mpeg4的时候加上 commend.add("-c:v"); commend.add("libx264 "); 就会生成空文件

commend.add("-vcodec"); commend.add("libx264"); 生成的文件只有1k


下面是转flv格式的,,求转mpeg4,,因为前端的video标签
commend.add("f:\\ffmpeg\\ffmpeg");
commend.add("-i");
commend.add(oldfilepath);
commend.add("-ab");
commend.add("56");
commend.add("-ar");
commend.add("22050");
commend.add("-qscale");
commend.add("8");
commend.add("-r");
commend.add("15");
commend.add("-s");
commend.add("600x500");
commend.add(oldfilepath.substring(0, oldfilepath.lastIndexOf(".")) + ".flv");




...全文
509 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
http://download.csdn.net/download/cffishappy/4334581

Web开发学习资料推荐
javascript客户端图片预览
jqGrid中文API
75闪光雷 2017-09-07
  • 打赏
  • 举报
回复
给你介绍个ffmpeg的大神 http://blog.csdn.net/column/details/ffmpeg-devel.html
3. 安装FFmpeg 1) 指定第三方插件安装默认目录 [root@localhost ffmpeg]# vi /etc/ld.so.conf include ld.so.conf.d/*.conf /usr/local/bin /usr/local/lib 2) 安装各插件 安装lame [root@localhost ffmpeg]# tar -zxvf lame-3.99.5.tar.gz [root@localhost lame-3.99.5]# cd lame-3.99.5 [root@localhost lame-3.99.5]# ./configure --enable-shared [root@localhost lame-3.99.5]# make && make install [root@localhost lame-3.99.5]# ldconfig 安装yasm [root@localhost ffmpeg]# tar -zxvf yasm-1.2.0.gz [root@localhost yasm-1.2.0]# cd yasm-1.2.0 [root@localhost yasm-1.2.0]# ./configure --enable-shared [root@localhost yasm-1.2.0]# make && make install [root@localhost yasm-1.2.0]# ldconfig 安装xvidcore (注意目录位置,不在直接的解压后的文件下) [root@localhost ffmpeg]# tar -zxvf xvidcore-1.1.3.tar.gz [root@localhost ffmpeg]# cd xvidcore-1.1.3/build/generic/ [root@localhost generic]# ./configure [root@localhost generic]# make && make install [root@localhost generic]# ldconfig 安装x264 (注意格式为.tar.bz2) [root@localhost ffmpeg]# bunzip2 last_x264.tar.bz2 [root@localhost ffmpeg]# tar -xvf last_x264.tar [root@localhost ffmpeg]# cd x264-snapshot-20121030-2245/ [root@localhost x264-snapshot-20121030-2245]# ./configure --enable-shared [root@localhost x264-snapshot-20121030-2245]# make && make install [root@localhost x264-snapshot-20121030-2245]# ldconfig 安装a52dec [root@localhost ffmpeg]# tar -zxvf a52dec-0.7.4.tar.gz [root@localhost ffmpeg]# cd a52dec-0.7.4 [root@localhost a52dec-0.7.4]# ./configure --enable-shared=PKGS && make && make install [root@localhost a52dec-0.7.4]# ldconfig 安装 faac [root@localhost ffmpeg]# yum install -y automake autoconf libtool [root@localhost ffmpeg]# tar -zxvf faac-1.28.tar.gz [root@localhost ffmpeg]# cd faac-1.28 [root@localhost faac-1.28]# vi ./common/mp4v2/mpeg4ip.h … :123 #ifdef __cplusplus extern "C" { #endif //char *strcasestr(const char *haystack, const char *needle); #ifdef __cplusplus } #endif [root@localhost faac-1.28]# ./bootstrap && ./configure && make && make install [root@localhost faac-1.28]# ldconfig 安装 faad2 [root@localhost ffmpeg]# tar -zxvf faad2-2.7.tar.gz [root@localhost ffmpeg]# cd faad2-2.7 [root@localhost faad2-2.7]# chmod 755 bootstrap [root@localhost faad2-2.7]# ./bootstrap && ./configure && make && make install [root@localhost faad2-2.7]# ldconfig 安装 vo-aacenc [root@localhost ffmpeg]# tar -zxvf vo-aacenc_0.1.3.orig.tar.gz [root@localhost ffmpeg]# cd vo-aacenc-0.1.3/ [root@localhost vo-aacenc-0.1.3]# ./configure [root@localhost vo-aacenc-0.1.3]# make && make install [root@localhost vo-aacenc-0.1.3]# ldconfig 3) 安装FFmpeg [root@localhost ffmpeg]# tar -zxvf ffmpeg-1.2.11.tar.gz [root@localhost ffmpeg]# cd ffmpeg-1.2.11 [root@localhost ffmpeg-1.2.11]# ./configure --enable-gpl --enable-version3 --enable-postproc --enable-nonfree --enable-postproc --enable-swscale --enable-avfilter --enable-pthreads --enable-libxvid --enable-libx264 --enable-libmp3lame --enable-libfaac --enable-libvo-aacenc [root@localhost ffmpeg-1.2.11]# make && make install [root@localhost ffmpeg-1.2.11]# ldconfig [root@localhost ffmpeg-1.2.11]# cp /usr/local/bin/ffmpeg /usr/bin/ 4) 安装qt-faststart [root@localhost ffmpeg-1.2.11]# cd ffmpeg-1.2.11 [root@localhost ffmpeg-1.2.11]# make tools/qt-faststart [root@localhost ffmpeg-1.2.11]# cp -a tools/qt-faststart /usr/bin/ 5) 查看版本和转换测试 查看版本 [root@localhost software]# ffmpeg ffmpeg version 1.2.11 Copyright (c) 2000-2014 the FFmpeg developers built on Apr 21 2016 17:48:12 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16) configuration: --enable-gpl --enable-postproc --enable-nonfree --enable-postproc --enable-swscale --enable-avfilter --enable-pthreads --enable-libxvid --enable-libx264 --enable-libmp3lame --enable-libfaac libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... 测试 [root@localhost software]# ffmpeg -i ./09.mp4 -y -acodec libmp3lame -ab 128 -ar 22050 -vcodec h264 -b 96k -r 25 ./01.flv … [root@localhost software]# ll total 32232 -rw-r--r--. 1 root root 4378561 Apr 21 17:56 01.flv -rw-r--r--. 1 root root 28609569 Apr 21 17:52 09.mp4 成功!

87,993

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧