推荐一款基于Java的音视频处理开源项目--JAVE

JAVE(Java Audio Video Encoder),是一款将音频和视频在不同格式间进行转化的工具,是基于ffmpeg项目的Java封装。

JAVE,需要J2SE 1.4+、Windows 或 Linux 操作系统均可运行。

JAVE支持的编码和解码格式见下表:

Decoding

Formato Descrizione
4xm 4X Technologies format
MTV MTV format
RoQ Id RoQ format
aac ADTS AAC
ac3 raw ac3
aiff Audio IFF
alaw pcm A law format
amr 3gpp amr file format
apc CRYO APC format
ape Monkey's Audio
asf asf format
au SUN AU Format
avi avi format
avs AVISynth
bethsoftvid Bethesda Softworks 'Daggerfall' VID format
c93 Interplay C93
daud D-Cinema audio format
dsicin Delphine Software International CIN format
dts raw dts
dv DV video format
dxa dxa
ea Electronic Arts Multimedia Format
ea_cdata Electronic Arts cdata
ffm ffm format
film_cpk Sega FILM/CPK format
flac raw flac
flic FLI/FLC/FLX animation format
flv flv format
gif GIF Animation
gxf GXF format
h261 raw h261
h263 raw h263
h264 raw H264 video format
idcin Id CIN format
image2 image2 sequence
image2pipe piped image2 sequence
ingenient Ingenient MJPEG
ipmovie Interplay MVE format
libnut nut format
m4v raw MPEG4 video format
matroska Matroska File Format
mjpeg MJPEG video
mm American Laser Games MM format
mmf mmf format
mov,mp4,m4a,3gp,3g2,mj2 QuickTime/MPEG4/Motion JPEG 2000 format
mp3 MPEG audio layer 3
mpc musepack
mpc8 musepack8
mpeg MPEG1 System format
mpegts MPEG2 transport stream format
mpegtsraw MPEG2 raw transport stream format
mpegvideo MPEG video
mulaw pcm mu law format
mxf MXF format
nsv NullSoft Video format
nut nut format
nuv NuppelVideo format
ogg Ogg format
psxstr Sony Playstation STR format
rawvideo raw video format
redir Redirector format
rm rm format
rtsp RTSP input format
s16be pcm signed 16 bit big endian format
s16le pcm signed 16 bit little endian format
s8 pcm signed 8 bit format
sdp SDP
shn raw shorten
siff Beam Software SIFF
smk Smacker Video
sol Sierra SOL Format
swf Flash format
thp THP
tiertexseq Tiertex Limited SEQ format
tta true-audio
txd txd format
u16be pcm unsigned 16 bit big endian format
u16le pcm unsigned 16 bit little endian format
u8 pcm unsigned 8 bit format
vc1 raw vc1
vmd Sierra VMD format
voc Creative Voice File format
wav wav format
wc3movie Wing Commander III movie format
wsaud Westwood Studios audio format
wsvqa Westwood Studios VQA format
wv WavPack
yuv4mpegpipe YUV4MPEG pipe format

 

Encoding

Formato Descrizione
3g2 3gp2 format
3gp 3gp format
RoQ Id RoQ format
ac3 raw ac3
adts ADTS AAC
aiff Audio IFF
alaw pcm A law format
amr 3gpp amr file format
asf asf format
asf_stream asf format
au SUN AU Format
avi avi format
crc crc testing format
dv DV video format
dvd MPEG2 PS format (DVD VOB)
ffm ffm format
flac raw flac
flv flv format
framecrc framecrc testing format
gif GIF Animation
gxf GXF format
h261 raw h261
h263 raw h263
h264 raw H264 video format
image2 image2 sequence
image2pipe piped image2 sequence
libnut nut format
m4v raw MPEG4 video format
matroska Matroska File Format
mjpeg MJPEG video
mmf mmf format
mov mov format
mp2 MPEG audio layer 2
mp3 MPEG audio layer 3
mp4 mp4 format
mpeg MPEG1 System format
mpeg1video MPEG video
mpeg2video MPEG2 video
mpegts MPEG2 transport stream format
mpjpeg Mime multipart JPEG format
mulaw pcm mu law format
null null video format
nut nut format
ogg Ogg format
psp psp mp4 format
rawvideo raw video format
rm rm format
rtp RTP output format
s16be pcm signed 16 bit big endian format
s16le pcm signed 16 bit little endian format
s8 pcm signed 8 bit format
svcd MPEG2 PS format (VOB)
swf Flash format
u16be pcm unsigned 16 bit big endian format
u16le pcm unsigned 16 bit little endian format
u8 pcm unsigned 8 bit format
vcd MPEG1 System format (VCD)
vob MPEG2 PS format (VOB)
voc Creative Voice File format
wav wav format
yuv4mpegpipe YUV4MPEG pipe format

 

JAVE的使用非常简便,将包jave-1.0.jar导入工程路径即可。下面给出一段将AVI转换成FLV的代码片段:

File source = new File("source.avi"); File target = new File("target.flv"); AudioAttributes audio = new AudioAttributes(); audio.setCodec("libmp3lame"); audio.setBitRate(new Integer(64000)); audio.setChannels(new Integer(1)); audio.setSamplingRate(new Integer(22050)); VideoAttributes video = new VideoAttributes(); video.setCodec("flv"); video.setBitRate(new Integer(160000)); video.setFrameRate(new Integer(15)); video.setSize(new VideoSize(400, 300)); EncodingAttributes attrs = new EncodingAttributes(); attrs.setFormat("flv"); attrs.setAudioAttributes(audio); attrs.setVideoAttributes(video); Encoder encoder = new Encoder(); encoder.encode(source, target, attrs);

细心看这段代码,不难找到其中可以设置压缩码率、分辨率、音频解码率等参数,非常的简便。

JAVE工程网站:http://www.sauronsoftware.it/projects/jave/index.php

截至目前此项目最新版本是v1.0.2

 

 

 

 

 

 

 

 

你可能感兴趣的:(Java体系)