bramp / ffmpeg-cli-wrapper

Java wrapper around the FFmpeg command line tool
BSD 2-Clause "Simplified" License
1.72k stars 413 forks source link

Add option to configure b-frames `-bf` #346

Closed Euklios closed 3 months ago

Euklios commented 3 months ago

Is your feature request related to a problem? Please describe. Sources from the issue #318. FFmpeg tends to emits b-frames, which are not understood by all parsers.

Describe the solution you'd like There should be an option to configure bframes, which should allow to disable them entirely -bf 0.

Describe alternatives you've considered This could also be done using extraArgs

Euklios commented 3 months ago

@AlexanderSchuetz97 for documentation purposes: To my understanding, the option -bf specifies how many b-frames ffmpeg is allowed to emit between I/P-Frames. So -bf 2 allows 2 b frames, while -bf 0 essentially limits the number of b-frames to 0, therefore disabling it.

AlexanderSchuetz97 commented 3 months ago

Your understanding matches mine. I have to deal with decoders for h264 for example that cannot handle bframes so I have to turn them off. If one of those decoders attempts to decode a video stream with b frames then the video will jitter as it will play the frames in the order that it has read them. This means that the video will appear to playback in reverse sometimes for half a second before jumping forward a second again.

I do not think I will ever set a value other than 0 explicitly, but that is my, someone else may need to set this to 1 or higher forwhatever reason. I have observed that 2 appears to be the default that ffmpeg uses if you specify nothing. (I have seen this in ffprobes output from looking at created files)