import com.google.common.collect.ImmutableList;
import net.bramp.ffmpeg.builder.FFmpegBuilder; import java.util.ArrayList;
import java.util.List; /***
* 适用于hls协议的构造器,<a href="https://ffmpeg.org/ffmpeg-formats.html#hls-1">hls协议相关参数</a>
* @author dqk
*/ public class HLSFFmpegBuilder extends FFmpegBuilder { /***
* Set the maximum number of playlist entries. If set to 0 the list file will contain all the segments. Default value is 5.
*/
private Integer hlsListSize = 5; /***
* Set the target segment length in seconds. Default value is 2. Segment will be cut on the next key frame after this time has passed.
*/
private Integer hlsTime = 2; /***
* This is a deprecated option, you can use hls_list_size and hls_flags delete_segments instead it
*
* This option is useful to avoid to fill the disk with many segment files, and limits the maximum number of segment files written to disk to wrap.
*/
@Deprecated
private Integer hlsWrap = 0; public HLSFFmpegBuilder setHlsListSize(Integer hlsListSize) {
this.hlsListSize = hlsListSize;
return this;
} public HLSFFmpegBuilder setHlsTime(Integer hlsTime) {
this.hlsTime = hlsTime;
return this;
} public HLSFFmpegBuilder setHlsWrap(Integer hlsWrap) {
this.hlsWrap = hlsWrap;
return this;
} public Integer getHlsListSize() {
return hlsListSize;
} public Integer getHlsTime() {
return hlsTime;
} public Integer getHlsWrap() {
return hlsWrap;
} @Override
public List<String> build() {
List<String> args = super.build();
List<String> temp = new ArrayList<>(); setFormat("hls"); if(this.hlsWrap != null){
temp.add("-hls_wrap");
temp.add(hlsWrap.toString());
} if(this.hlsTime != null){
temp.add("-hls_time");
temp.add(hlsTime.toString());
} if(this.hlsListSize != null){
temp.add("-hls_list_size");
temp.add(hlsListSize.toString());
} for(String arg: temp){
args.add(arg);
}
List<String> newargs = ImmutableList.copyOf(args);
return newargs;
}
}
GkFFmpegBuilder.java
import com.google.common.collect.ImmutableList;
import net.bramp.ffmpeg.builder.FFmpegBuilder; import java.util.ArrayList;
import java.util.List; /**
* 为了方便拓展api中没有的参数
*/ public class GkFFmpegBuilder extends FFmpegBuilder { private Long itsoffset; @Override
public List<String> build() {
// 该数组为不可变数组 (原因未知)
List<String> args = super.build();
List<String> temp = new ArrayList<>();
if(this.itsoffset != null){
temp.add("-itsoffset");
temp.add(this.itsoffset.toString());
} for(String arg: args){
temp.add(arg);
}
List<String> newargs = ImmutableList.copyOf(temp);
return newargs;
} public Long getItsoffset() {
return itsoffset;
} public GkFFmpegBuilder setItsoffset(Long itsoffset) {
this.itsoffset = itsoffset;
return this;
} }

最新文章

  1. 部署samba服务之后,在客户端用挂载访问的方式,错误信息:mount: block device //192.168.1.108/mysqldata is write-protected, mounting read-only mount: cannot mount block device //192.168.1.108/mysqldata read-only
  2. awk 学习笔记
  3. kali基本设置
  4. 《css3实战》读书笔记 第一章 基于CSS需求而编写的HTML.
  5. 耦合 Coupling the object-oriented paradigm &amp;&amp; data coupling
  6. JavaScript Function.apply() 函数详解
  7. setBackgroundMusicLoop for cocos2dx
  8. MmSystem播放Wav格式声音
  9. Android之提交数据到服务端方法简单封装
  10. mysql数据库在Navicat Premium连接的时候出现1862错误
  11. 安装jdk时出现java -version权限不够问题
  12. (纪念第一道完全自己想的树DP)CodeForces 219D Choosing Capital for Treeland
  13. 启动nginx报错问题
  14. hive的排序,分組练习
  15. 关于第二次阅读作业中&quot;银弹&quot;“大泥球”等的个人理解
  16. Python day21模块介绍4(logging模块,configparser模块)
  17. Web页面切图和CSS注意事项
  18. GNU风格 ARM汇编语法4
  19. test推荐到极客头条002
  20. centos安装oracle客户端

热门文章

  1. LightOJ - 1282 - Leading and Trailing(数学技巧,快速幂取余)
  2. Springboot-data-jpa增删改查
  3. 2.1 什么是C++
  4. loj #6191. 「美团 CodeM 复赛」配对游戏 期望dp
  5. __try __except与__try __finally的嵌套使用以及__finally的调用时机
  6. 常见的 eslint 基本报错信息
  7. Java获取类方法上的注解
  8. luogu 2592 区间dp
  9. driud 异常
  10. 第12组 Alpha冲刺(2/6)