-
Notifications
You must be signed in to change notification settings - Fork 33
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
"Could not update timestamps for skipped samples." warning on AAC file #30
Comments
Hi @dceddia. Thank you. It is certainly the main point of this library to make the FFmpeg interface more Rust friendly. Regarding your issue - you can set let num = ...;
let den = ...;
let mut decoder = AudioDecoder::from_codec_parameters(params)?
.set_option("pkt_timebase", format!("{}/{}", num, den))
.build()?; This library attempts to deal with timebase-unaware I will also consider adding extra methods for constructing audio/video decoders from |
d9ee10b should fix the issue. |
Awesome, thanks @operutka! That solves it :) I've got my audio + video frames reading out and pairing together nicely now! I ended up implementing |
Hey, first off, amazing work on this crate! It's really nice to use and feels more Rust-y than the others I've tried :)
I'm putting together a video editing app and working on the basics right now, reading audio + video frames. I'm getting this warning while reading packets from an AAC (m4a) audio-only file:
I think this has something to do with AAC's "priming samples", where there are 2112 samples at the start that get skipped.
Here's a minimal example repo (includes a test audio file recorded with QuickTime). It's pretty much the
decoding.rs
example but with "video" replaced by "audio".I tracked it down to this block of code in ffmpeg's
libavcodec/decode.c
:https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/decode.c#L395-L407
It looks like this code is trying to increment the PTS of the packet by however many samples were skipped, and it only logs the warning if the AVCodecContext's
pkt_timebase.num
orsample_rate
are 0.I threw a print into
ffw_decoder_push_packet
and it shows apkt_timebase
of0/1
andsample_rate
of48000
.Docs for pkt_timebase say it's "set by the user" for decoding, so I guess I need to set this somewhere.
I'm not sure where's the right place to set it, though. I thought of setting it in
ffw_decoder_push_packet
if it's not set yet, but packets don't seem to know their timebase, so I guess it needs to come from the stream. It does seem like this should ideally be set during initialization somehow. Maybe theDecoder
could take astream
instead ofcodec_parameters
?The text was updated successfully, but these errors were encountered: