Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How do I get frameLength from packets from FFmpeg? (Read 7093 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

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


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.

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).

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).


 

Re: How do I get frameLength from packets from FFmpeg?

Reply #4
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



It is the state (available number of bits) in the bit reservoir divided by number of channels divided by 32. It is a useless field which decoders don't make a use of and neither do encoders put meaningful information. It is usually 0x7FF denoting VBR configuration, for which it is explicitly stated that it serves no use in the ISO/IEC 13818-7 specification.