HLSFFmpegBuilder适用于hls协议的构造器 没具体测试
2024-08-23 04:33:13
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;
} }
最新文章
- 部署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
- awk 学习笔记
- kali基本设置
- 《css3实战》读书笔记 第一章 基于CSS需求而编写的HTML.
- 耦合 Coupling the object-oriented paradigm &;&; data coupling
- JavaScript Function.apply() 函数详解
- setBackgroundMusicLoop for cocos2dx
- MmSystem播放Wav格式声音
- Android之提交数据到服务端方法简单封装
- mysql数据库在Navicat Premium连接的时候出现1862错误
- 安装jdk时出现java -version权限不够问题
- (纪念第一道完全自己想的树DP)CodeForces 219D Choosing Capital for Treeland
- 启动nginx报错问题
- hive的排序,分組练习
- 关于第二次阅读作业中";银弹";“大泥球”等的个人理解
- Python day21模块介绍4(logging模块,configparser模块)
- Web页面切图和CSS注意事项
- GNU风格 ARM汇编语法4
- test推荐到极客头条002
- centos安装oracle客户端
热门文章
- LightOJ - 1282 - Leading and Trailing(数学技巧,快速幂取余)
- Springboot-data-jpa增删改查
- 2.1 什么是C++
- loj #6191. 「美团 CodeM 复赛」配对游戏 期望dp
- __try __except与__try __finally的嵌套使用以及__finally的调用时机
- 常见的 eslint 基本报错信息
- Java获取类方法上的注解
- luogu 2592 区间dp
- driud 异常
- 第12组 Alpha冲刺(2/6)