Opened 5 years ago
Closed 5 years ago
#8439 closed defect (invalid)
audio_frame_queue: Incorrect dequeued timestamps
Reported by: | Lastique | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | unspecified | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
The ff_af_queue_add/ff_af_queue_remove functions do not reproduce the timestamps that the user provides in AVFrame::pts. Effectively, the af_queue introduces a negative offset in the timestamps produced in AVPacket::pts.
For example, aacenc encoder has a delay of 1024 samples. If the user provides AVFrame::pts = 0 in the first frame sent to the encoder then the first packet received from the encoder will have AVPacket::pts = -1024.
Encoders should produce encoded timestamps equivalent to the timestamps that were passed by the users in decoded frames.
This problem was found when using ffmpeg through C API, I'm not sure it can be shown from CLI.
Attachments (1)
Change History (9)
comment:1 by , 5 years ago
Version: | 4.2 → unspecified |
---|
comment:2 by , 5 years ago
Resolution: | → needs_more_info |
---|---|
Status: | new → closed |
comment:3 by , 5 years ago
Version: | unspecified → 4.2 |
---|
I've attached a test case that demonstrates the problem. The test output is:
Input pts: 0, output pts: -2048
Input pts: 1024, output pts: -1024
Input pts: 2048, output pts: 0
Input pts: 3072, output pts: 1024
Input pts: 4096, output pts: 2048
The expected output should list the same values for input and output timestamps.
comment:4 by , 5 years ago
Resolution: | needs_more_info |
---|---|
Status: | closed → reopened |
comment:5 by , 5 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
This is just normal encoder delay.
comment:6 by , 5 years ago
Version: | 4.2 → unspecified |
---|
follow-up: 8 comment:7 by , 5 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
No. The delay is indicated by avcodec_receive_packet
returning AVERROR(EAGAIN)
and no packet. Subsequent calls returning packets are expected to return timestamps that were passed on input.
As it is, the encoder does not introduce a delay but a negative offset in timestamps.
comment:8 by , 5 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
Replying to Lastique:
No. The delay is indicated by
avcodec_receive_packet
returningAVERROR(EAGAIN)
and no packet. Subsequent calls returning packets are expected to return timestamps that were passed on input.
As it is, the encoder does not introduce a delay but a negative offset in timestamps.
You misunderstand, it is indeed encoder delay, or audio priming is another name for it:
https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
Is the issue reproducible with current FFmpeg git head?
Please provide a simplified testcase that allows to reproduce.