Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set time_base for AudioResampler #11

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion av/audio/resampler.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ cdef class AudioResampler(object):
# handle resampling with aformat filter
# (similar to configure_output_audio_filter from ffmpeg)
self.graph = av.filter.Graph()
extra_args = {}
if frame.time_base is not None:
extra_args["time_base"] = str(frame.time_base)
abuffer = self.graph.add("abuffer",
sample_rate=str(frame.sample_rate),
sample_fmt=AudioFormat(frame.format).name,
channel_layout=frame.layout.name)
channel_layout=frame.layout.name,
**extra_args)
aformat = self.graph.add("aformat",
sample_rates=str(self.rate),
sample_fmts=self.format.name,
Expand Down