[Libav-user] Some first questions using libav for audio decoding
Martin Guy
martinwguy at gmail.com
Tue Feb 14 04:47:43 EET 2023
Greetings, all.
I'm trying to get libav to do sample-accurate seeking in audio files
and have a couple of questions:
The audio streams's start_time found by:
fmt_ctx->streams[audio_stream_index]->start_time where
audio_stream_index = av_find_best_stream(fmt_ctx,
AVMEDIA_TYPE_AUDIO, -1, -1, &dec, 0)
is 0 for Ogg files and 324870 (0.0230208 seconds) for an MP3 file
created by lame, but for a WAV file created by "sox synth" it
is -9223372036854775808, which is 0x8000000000000000, the same as the
averror code for "Success",
At present I'm checking for this value and setting it to 0 if so, but
that seems bizarre so I wonder if I'm missing something here.
The second query is a suggestion to improve a minor point in the documentation:
AVFrame's pts field is said to be the "Presentation timestamp in
time_base units" but AVFrame doesn't have a time_base field.
While searching for other time_bases I spotted that AVCodecContext's
time_base's docs say "This is the fundamental unit of time (in
seconds) in terms of which frame timestamps are represented." and it
is 1/48000 which gives the right results, while there are also
AVStream's time_base of 1/14112000 and AV_TIME_BASE of 1000000
Can I suggest updating AVFrame's documentation to say that its pts and
friends are measured in the AVCodecContext's time_base to save other
noobs trying to decode frames my confusion?
Thanks and sorry for the noise
M
More information about the Libav-user
mailing list