[rtmpdump] RTMP Audio / Video detection + HTTP Header

Adam Malcontenti-Wilson adman.com at gmail.com
Mon Feb 1 13:21:16 CET 2010

I agree about not reliably being able to tell, however some servers
send metadata before the stream such as audiocodecid, audiodatarate,
videocodecid and videodatarate. From what I've seen on the audio-only
streams, the videocodecid & videodatarate aren't set but the others
are, which could infer that it is an audio stream, no? However, as it
is not 100% reliable if implemented it would need a switch to be able
to switch it off when it's wrong.

On 31 January 2010 19:17, Howard Chu <hyc at highlandsun.com> wrote:
> Adam Malcontenti-Wilson wrote:
>> Hi everyone,
>> I can't be certain but it appears that the streams.c file/application assumes
>> that the content is audio+video (0x05) when writing the FLV header, rather
>> than checking the RTMP object type. Is it possible to do such a check to
>> produce a "Audio" FLV response (0x04) when connecting to an audio-only RTMP
>> stream (or could someone tell me how to code it to)?
> I guess this problem is because most of this code was just copy/pasted from the rtmpdump.c source. In rtmpdump it always writes an audio+video header first, and then seeks back to the beginning to overwrite it with the correct value after the stream is completely downloaded. You can't just set the type based on the first few packets because audio/video streams tend to use a mix of audio and video packets. There's no way to really know the correct header type until you've gotten to the end.
> At least, that's what I understand of it so far. If anyone knows of a reliable way to determine this up front, speak up...

Adam Malcontenti-Wilson

More information about the rtmpdump mailing list