Skip to content

Commit 310eea5

Browse files
committed
feat: Add support for -bf option
Fixes: bramp#346
1 parent 9289e50 commit 310eea5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegOutputBuilder.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ public abstract class AbstractFFmpegOutputBuilder<T extends AbstractFFmpegOutput
6767
@Deprecated
6868
public String video_bit_stream_filter;
6969

70+
/**
71+
* Specifies the number of b-frames ffmpeg is allowed to use.
72+
* 0 will disable b-frames, null will let ffmpeg decide.
73+
*/
74+
private Integer bFrames;
75+
7076
public AbstractFFmpegOutputBuilder() {
7177
super();
7278
}
@@ -118,6 +124,18 @@ public T setVideoPreset(String preset) {
118124
return (T) this;
119125
}
120126

127+
/**
128+
* Sets the number of b-frames ffmpeg is allowed to use.
129+
* 0 -> Do not use b-frames at all
130+
*
131+
* @param bFrames number of b-frames
132+
* @return this
133+
*/
134+
public T setBFrames(int bFrames) {
135+
this.bFrames = bFrames;
136+
return (T) this;
137+
}
138+
121139
/**
122140
* Sets Video Filter
123141
*
@@ -349,6 +367,10 @@ protected void addVideoFlags(FFmpegBuilder parent, ImmutableList.Builder<String>
349367
if (!Strings.isNullOrEmpty(video_bit_stream_filter)) {
350368
args.add("-bsf:v", video_bit_stream_filter);
351369
}
370+
371+
if (bFrames != null) {
372+
args.add("-bf", Integer.toString(bFrames));
373+
}
352374
}
353375

354376
@Override

0 commit comments

Comments
 (0)