视频转换/查看

POJO类中的字段,配置`isVideo`属性后,则需要此配置来支持视频转换及在线播放

支持的视频格式:
asx,asf,mpg,3gp,mp4,mov,avi,flv,wmv9,rm,rmvb,wmv

1、安装必要软件

(1)ffmpeg:--enable-shared --enable-gpl --enable-libmp3lame --enable-libx264 --enable-nonfree --enable-libfdk-aac
(2)flvtool2
(3)mencoder

2、配置文件

文件位置:dodo_framework_config.properties
#(1)截取缩略图
dodo.video.get.thumbnail.command=/usr/local/ffmpeg/bin/ffmpeg -loglevel error -i ${in} -y -f mjpeg -ss 7 -t 0.001 -s 350x240 ${out}  
#(2)获取视频信息
dodo.video.get.info.command=/usr/local/ffmpeg/bin/ffmpeg -loglevel info -i ${in}
#(3)转flv
# 质量高一点:/usr/local/ffmpeg/bin/ffmpeg -loglevel error -i ${in} -max_muxing_queue_size 1024 -ab 128 -ac 1 -ar 22050 -r 29.97 -qscale 6 -f flv -y ${out}
dodo.video.converter.toflv.command=/usr/local/ffmpeg/bin/ffmpeg -loglevel error -i ${in} -max_muxing_queue_size 1024 -ab 128 -ar 22050 -r 29.97 -f flv -y ${out}
#(4)转mp4
dodo.video.converter.tomp4.command=/usr/local/ffmpeg/bin/ffmpeg -loglevel error -i ${in} -max_muxing_queue_size 1024 -ab 128 -acodec libfdk_aac -ac 1 -ar 22050 -r 29.97 -qscale 6 -s 640x480 -f mp4 -y ${out}
#(5)转avi
dodo.video.converter.toavi.command=/usr/bin/mencoder -oac mp3lame -lameopts aq\=7\:vbr\=2\:q\=4 -srate 32000  -ovc xvid -xvidencopts fixed_quant\=8 ${in} -o ${out}
#(6)转swf
dodo.video.converter.toswf.command=/usr/local/ffmpeg/bin/ffmpeg -loglevel error -i ${in} -max_muxing_queue_size 1024 -ab 128 -ac 1 -ar 22050 -r 29.97 -qscale 6 -s 640x480 -f swf -y ${out}
#(7)添加关键帧
dodo.video.timeframe.add.command=/usr/local/bin/flvtool2 -U ${in}
#(8)支持的视频格式
dodo.video.converter.support=asx,asf,mpg,3gp,mp4,mov,avi,flv,wmv9,rm,rmvb,wmv

3、POJO类中配置视频字段

    // isVideo = true
    @DodoField(sortSeq = 24, name = "视频文件", isVideo = true, maxFileSize = 2)
    private String            videoField;

4、效果图

登录图片

Copyright © DodoFramework 2020 all right reservedModify At: 2020-10-28 00:14:58