Skip to main content

Topic: How do I get frameLength from packets from FFmpeg? (Read 3804 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • trungnq
  • [*]
How do I get frameLength from packets from FFmpeg?
Hi all,

I use ffmpeg to generate adts stream:

ffmpeg -re -i input.mp3 -acodec aac -strict experimental -ab 64k -f adts tcp://localhost:1234

I have a sequence of packets with different size (normally around 200bytes each). I can extract the adts header with 7 bytes by following this http://wiki.multimedia.cx/index.php?title=ADTS (by the way, do anybody know about the field calls "Buffer fullness" in ADTS header?).

To decode (using http://labs.official.fm/codecs/aac/) I need to know frameLength, but I don't know how to get this value from packets I receive from ffmpeg. As I understand, frame length is the number of samples in one frame. I don't know if it's correct or not (please correct me if I am wrong). The packets are varies in size, does it mean the frameLength is not fixed for ADTS packets?

Thanks a lot in advance!!

--Trung


  • trungnq
  • [*]
How do I get frameLength from packets from FFmpeg?
Reply #1
After googling around, I see the frameLength is always 1024 (samples in a frame). I am going to test the decoder, see if it works.

  • trungnq
  • [*]
How do I get frameLength from packets from FFmpeg?
Reply #2
Thing goes well with frameLength 1024

But one strange thing with ffmpeg is, sometimes it generates some big adts packet. Normally adts packet with 64kbs is around 200bytes per frame, but sometimes, I get 1000+bytes packet. This make the sound a bit weird (at least with my decoder). But in the adts header, the actual frame size is much smaller than 1000+bytes. So there are some redundant bytes (don't know what does it use for).

  • trungnq
  • [*]
How do I get frameLength from packets from FFmpeg?
Reply #3
It seems there is no problem when I use ffmpeg with -acodec libfaac.

Thing goes well with frameLength 1024

But one strange thing with ffmpeg is, sometimes it generates some big adts packet. Normally adts packet with 64kbs is around 200bytes per frame, but sometimes, I get 1000+bytes packet. This make the sound a bit weird (at least with my decoder). But in the adts header, the actual frame size is much smaller than 1000+bytes. So there are some redundant bytes (don't know what does it use for).