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

Add support for camera with realtime source timestamp. #12

Closed
ThibaultBee opened this issue Jun 7, 2021 · 10 comments
Closed

Add support for camera with realtime source timestamp. #12

ThibaultBee opened this issue Jun 7, 2021 · 10 comments
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@ThibaultBee
Copy link
Owner

ThibaultBee commented Jun 7, 2021

On device with realtime source timestamp, it is not possible to read stream from ffmpeg.
On ffmpeg side, the following errors happen:

2:41:18.339593/T0x700008c41000!W:SRT.qr: @898072221:No room to store incoming packet: offset=0 avail=0 ack.seq=1646609462 pkt.seq=1646609462 rcv-remain=8191 drift=1545
12:41:18.339743/T0x700008c41000!W:SRT.qr: @898072221:No room to store incoming packet: offset=1 avail=0 ack.seq=1646609462 pkt.seq=1646609463 rcv-remain=8191 drift=1545
12:41:19.324344/T0x700008c41000!W:SRT.qr: @898072221:No room to store incoming packet: offset=8 avail=0 ack.seq=1646609462 pkt.seq=1646609470 rcv-remain=8191 drift=1545
12:41:19.324490/T0x700008c41000!W:SRT.qr: @898072221:No room to store incoming packet: offset=9 avail=0 ack.seq=1646609462 pkt.seq=1646609471 rcv-remain=8191 drift=1545
12:41:19.340980/T0x700008c41000!W:SRT.qr: @898072221:No room to store incoming packet: offset=12 avail=0 ack.seq=1646609462 pkt.seq=1646609474 rcv-remain=8191 drift=1545
12:41:19.341026/T0x700008c41000!W:SRT.qr: @898072221:No room to store incoming packet: offset=13 avail=0 ack.seq=1646609462 pkt.seq=1646609475 rcv-remain=8191 drift=1545
12:41:19.372917/T0x700008c41000!W:SRT.qr: @898072221:No room to store incoming packet: offset=17 avail=0 ack.seq=1646609462 pkt.seq=1646609479 rcv-remain=8191 drift=1545

See #11 (comment)

@ThibaultBee
Copy link
Owner Author

ThibaultBee commented Jun 8, 2021

@RobbieEllias can you test #13?
I assume that a phone camera sources are either realtime either unknown. It can't have one camera with a realtime ts source and another with an unknown ts source.

@RobbieElias
Copy link

RobbieElias commented Jun 8, 2021

Just tested, it doesn't work.

@ThibaultBee
Copy link
Owner Author

Ok, I must have missed something.
I added a commit with a lot of logcat trace. Can you test it and send me your logcat content?

@RobbieElias
Copy link

Here you go: logcat.txt

@ThibaultBee
Copy link
Owner Author

Audio timestamp source is also odd.
Sorry, you will have to retest https://github.com/ThibaultBee/StreamPack/tree/feature/camera_realtime_ts_source.

@RobbieElias
Copy link

Here you go: logcat.txt

The video played, but the audio was a little out of sync.

@ThibaultBee
Copy link
Owner Author

ThibaultBee commented Jun 10, 2021

Yeah :) the stream is working!

This look likes another issue (maybe SRT configuration?) but your logcat seems alright. Do you have error on ffmpeg logs?
What do you mean by a little out of sync? Few ms? 1-10 seconds? Is it always the same time shift ?

By the way, I also removed Log.i from the branch, because it might generate issue in A/V sync.

@RobbieElias
Copy link

It's only off by a few ms. I get a lot of errors in ffplay:

[aac @ 0x7f910b032e00] Multiple frames in a packet.sq= 0B f=0/0
[aac @ 0x7f910b032e00] Number of bands (41) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (41) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (41) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (50) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (50) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] invalid band typevq= 1740KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] Number of bands (46) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] invalid band typevq= 1756KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] invalid band typevq= 1750KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] Number of bands (51) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (42) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] invalid band typevq= 1736KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] Number of bands (41) exceeds limit (40).
[aac @ 0x7f910b032e00] invalid band typevq= 1745KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] Number of bands (41) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (41) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] invalid band typevq= 1735KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] invalid band typevq= 1722KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] invalid band typevq= 1725KB sq= 0B f=0/0
[h264 @ 0x7f9109155200] error while decoding MB 113 67, bytestream -6
[h264 @ 0x7f9109155200] concealing 56 DC, 56 AC, 56 MV errors in P frame
[h264 @ 0x7f9109154600] error while decoding MB 116 67, bytestream -8
[h264 @ 0x7f9109154600] concealing 53 DC, 53 AC, 53 MV errors in P frame
[aac @ 0x7f910b032e00] invalid band typevq= 1709KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] Number of bands (53) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] invalid band type
[aac @ 0x7f910b032e00] Gain control is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 0x7f910b032e00] channel element 0.9 is not allocated
[aac @ 0x7f910b032e00] skip_data_stream_element: Input buffer exhausted before END element found
[aac @ 0x7f910b032e00] invalid band typevq= 1619KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] Input buffer exhausted before END element found
[aac @ 0x7f910b032e00] Number of bands (54) exceeds limit (40).0/0
[h264 @ 0x7f9109155200] error while decoding MB 113 67, bytestream -14
[h264 @ 0x7f9109155200] concealing 56 DC, 56 AC, 56 MV errors in P frame
[h264 @ 0x7f910919aa00] concealing 5 DC, 5 AC, 5 MV errors in P frame
[h264 @ 0x7f910916d000] error while decoding MB 115 67, bytestream -14
[h264 @ 0x7f910916d000] concealing 54 DC, 54 AC, 54 MV errors in P frame
[aac @ 0x7f910b032e00] Number of bands (69) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (43) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (49) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (41) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (42) exceeds limit (40).
[aac @ 0x7f910b032e00] invalid band typevq= 1555KB sq= 0B f=0/0
[aac @ 0x7f910b032e00] Number of bands (41) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (61) exceeds limit (40).0/0
[h264 @ 0x7f9109155200] error while decoding MB 104 67, bytestream -6
[h264 @ 0x7f9109155200] concealing 65 DC, 65 AC, 65 MV errors in P frame
[aac @ 0x7f910b032e00] Number of bands (41) exceeds limit (40).0/0
[h264 @ 0x7f910916d000] error while decoding MB 94 67, bytestream -12
[h264 @ 0x7f910916d000] concealing 75 DC, 75 AC, 75 MV errors in P frame
[h264 @ 0x7f910916ca00] error while decoding MB 97 67, bytestream -6
[h264 @ 0x7f910916ca00] concealing 72 DC, 72 AC, 72 MV errors in P frame
[h264 @ 0x7f910916d600] error while decoding MB 115 67, bytestream -6
[h264 @ 0x7f910916d600] concealing 54 DC, 54 AC, 54 MV errors in P frame
[aac @ 0x7f910b032e00] Number of bands (46) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (51) exceeds limit (40).0/0
[h264 @ 0x7f910919aa00] error while decoding MB 118 67, bytestream -10
[h264 @ 0x7f910919aa00] concealing 51 DC, 51 AC, 51 MV errors in P frame
[aac @ 0x7f910b032e00] Number of bands (60) exceeds limit (40).0/0
[h264 @ 0x7f9109154600] error while decoding MB 117 67, bytestream -12
[h264 @ 0x7f9109154600] concealing 52 DC, 52 AC, 52 MV errors in P frame
[aac @ 0x7f910b032e00] Number of bands (56) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (45) exceeds limit (40).0/0
[aac @ 0x7f910b032e00] Number of bands (43) exceeds limit (40).

@RobbieElias
Copy link

If I set the audio sample rate to 44.1 kHz, the A/V sync issues are fixed. So there's an issue with converting the sample rate I guess.

@ThibaultBee
Copy link
Owner Author

At least, timestamp issue is resolved. I merged #13.
They are no sample rate conversion in StreamPack. The only thing that could be wrong is the way AAC ADTS is built. I will check what could be wrong with the audio sample rate and I might open another issue.
Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants