Skip to content

Pass the stream's time base to bitstream filters - #2516

Merged
WyattBlue merged 1 commit into
PyAV-Org:masterfrom
NotAFlightRisk:fix-bsf-time-base-in
Nov 16, 2026
Merged

WyattBlue merged 1 commit into
PyAV-Org:masterfrom
NotAFlightRisk:fix-bsf-time-base-in

Conversation

@NotAFlightRisk

Copy link
Copy Markdown
Contributor

pcm_rechunk returns every packet with a pts of None when it runs through BitStreamFilterContext, and so does any setts expression that uses TB, like pts=PTS+10/TB. Both read the filter's input time base, which bsf.h says the caller sets before av_bsf_init(). PyAV copies the stream's codec parameters across but never its time base, so the filter sees 0/0.

On av 19.0.2 a 48 kHz WAV through pcm_rechunk=nb_out_samples=1024 comes out as [None, None, None, None], and as [0, 1024, 2048, 3072] with this change. I've left the output side alone, so a filter that changes the time base (setts with time_base=) still doesn't pass it on to out_stream.

@WyattBlue
WyattBlue merged commit 264c428 into PyAV-Org:master Nov 16, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants