Skip to content

Commit b945972

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

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public abstract class AbstractFFmpegOutputBuilder<T extends AbstractFFmpegOutput
2727
@Deprecated
2828
public Double constantRateFactor;
2929

30-
/** @deprecated Use {@link #getAudioSampleFormat()} instead*/
30+
/** @deprecated Use {@link #getAudioSamp leFormat()} instead*/
3131
@Deprecated
3232
public String audio_sample_format;
3333

@@ -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)