利用ffmpeg转换3gp文件的方法

利用ffmpeg转换3gp文件的方法

[转载]利用ffmpeg转换3gp文件

1.先到[url]www.3gpp.org[/url]下载以下三个文件:

- [url]http://www.3gpp.org/ftp/Specs/2004-03/Rel-5/26_series/26204-520.zip[/url]
- [url]http://www.3gpp.org/ftp/Specs/2004-03/Rel-5/26_series/26073-530.zip[/url]
- [url]http://www.3gpp.org/ftp/Specs/2004-03/Rel-5/26_series/26104-540.zip[/url]

分别解压缩到以下文件夹:

- 26204-520.zip into libavcodec/amrwb_float
- 26073-530.zip into libavcodec/amr
- 26104-540.zip into libavcodec/amr_float

2.重新编译ffmpeg,记得加上–enable-amr_nb –enable-amr_wb

3.执行以下命令即可完成转换,具体参数含义查看man

ffmpeg -i test.avi -y -b 20 -s sqcif -r 10 -acodec amr_wb -ab 23.85 -ac 1 -ar 16000 test.3gp

截取一祯图象作缩略图

将flv文件第三秒往后一祯的视频保存为 图象:

ffmpeg -i “test.flv” -ss 3 -vframes 1 -r 1 -ac 1 -ab 2 -s 160×120 -f image2 “a.jpg”

//----------------------------------------------------
在没有按上面的步骤操作,可以转换如下文件:
D:/project/test>ffmpeg -i test.avi -y -b 20 -s sqcif -r 10 test.3gp
ffmpeg version CVS, build 3342336, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-memalign-hack --enable-mingw32 --enable-mp3lame --ext
ra-cflags=-I/local/include --extra-ldflags=-L/local/lib
built on Aug 14 2006 13:44:13, gcc: 3.2.3 (mingw special 20030504-1)
Input #0, avi, from 'test.avi':
Duration: 00:00:10.3, start: 0.000000, bitrate: 700 kb/s
Stream #0.0, 15.00 fps: Video: cinepak, yuv420p, 128x128
Output #0, 3gp, to 'test.3gp':
Stream #0.0, -1.#J fps: Video: h263, yuv420p, 128x96, q=2-31, 20 kb/s
Stream mapping:
Stream #0.0 -> #0.0
[h263 @ 0071D920]removing common factors from framerate
frame= 104 q=0.0 Lsize= 44kB time=10.4 bitrate= 34.4kbits/s
video:42kB audio:0kB global headers:0kB muxing overhead 3.574653%

但是不可以转换音视频一起的文件:
D:/project/test>ffmpeg -i 123.3gp 123.avi
ffmpeg version CVS, build 3342336, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-memalign-hack --enable-mingw32 --enable-mp3lame --ext
ra-cflags=-I/local/include --extra-ldflags=-L/local/lib
built on Aug 14 2006 13:44:13, gcc: 3.2.3 (mingw special 20030504-1)
Input #0, mov,mp4,m4a,3gp,3g2, from '123.3gp':
Duration: 00:01:20.0, start: 0.000000, bitrate: 192 kb/s
Stream #0.0: Audio: mp4a / 0x6134706D, 32000 Hz, stereo
Stream #0.1, 14.99 fps: Video: mpeg4, yuv420p, 176x144
Output #0, avi, to '123.avi':
Stream #0.0, -1.#J fps: Video: mpeg4, yuv420p, 176x144, q=2-31, 200 kb/s
Stream #0.1: Audio: mp2, 32000 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
[mpeg4 @ 0071D920]removing common factors from framerate
Unsupported codec (id=86018) for input stream #0.0
按照上面的操作,但是编译出来的ffmpeg.exe找不到amr_wb和amr_nb命令