[FFmpeg-user] Advice on optimizing bitstream filter usage - unexplained frame count differences

Marton Balint cus at passwd.hu
Sat May 11 10:37:03 EEST 2024

On Fri, 10 May 2024, Gia Ferrari wrote:

> Greetings,
> I feel I've come up against the limits of my ability to narrow down the cause of a surprising behavior related to bitstream filters, and could use a pointer or two on where to focus my learning. A general description of the system challenge I'm trying to solve is at the bottom of this message if you're curious, but my primary interest is in understanding why my solution is yielding odd results.
> Source file is HEVC, containing 1557 keyframes (and many more non-keyframes). I'd like to select only the keyframes before decoding (CPU is scarce), rescale the selected frames, and write to a new MP4.
> $ ffmpeg -i test_input.mp4 -bsf:v "noise=drop=not(key)" -vf "scale=320:-1" -an -fps_mode vfr -enc_time_base -1 -c:v libx265 -crf 32 -preset ultrafast test_output_combined_command.mp4
> This takes 5 minutes and is CPU-bound. It also generates much fewer frames than I expect, resulting in choppy video.

As far as I understand you want to filter the input with the BSF, so you 
should apply the BSF as an input option, preceeding "-i input". What you 
are doing instead is you are filtering the x265 encoded output with the 


More information about the ffmpeg-user mailing list