Page 1 of 1

AMR (ffmpeg's) Broken stream over RTP!!!

Posted: 17 Feb 2006 19:48
by tipok
When I stream in RTP my content for mobile through real or darwin streaming server (yet) phone I use H263 + amr_nb
It's only one way to force handy to show VLC's streams


But with video - it's no problem
Audio - is hissing and whistling (amr_nb) or
it silent with amr_wb codec!!!

When I playing this streams by VLC - it segfault's without an explanation of the reasons!!!
Such happens even when I stream from VLC ----- to ------> VLC.

my computers - is Athlon 64 and Pentium 4, but problem - on both!

I stream by this string

vlc http://192.168.0.2:9001 --http-reconnect\
--sout '#transcode{vcodec="H263",width=176,height=144,vb="37.8",fps="15",acodec="samr",
ab="12.2",samplerate="8000",channels="1"}:rtp{dst="239.0.1.6",port-audio="22002",
port-video="22000",ttl="6",sdp="rtsp://192.168.0.6:8000/test1.sdp"}'\



I can make dump of stream of Helix Mobile Producer with this parameters (it works fine, but no so good like VLC :) )


And I'm - not one, who complain of this problem! :cry: :cry: :cry:

AMR RTSP FFMPEG OK?

Posted: 20 Feb 2006 16:12
by Steit
Hai,

I tried the same but noticed that if I write the stream to disk I get a file with good audio so I think the rtp stream-out is broken and ffmpeg is fine.

Kind regards,

Steit Slings

Posted: 20 Feb 2006 17:31
by tipok
Yes It's 100% broken RTP packetizer for this codecs (Both for amr_wb and amr_nb)!

This problem is some here:
rtp - - Will work only with ts muxer
- This written in source code: https://trac.videolan.org/vlc/file/trun ... tput/udp.c
If i'm not wrong, so amr streams in TS - i don't know this exactly.
Or maybe it's ES, raw???

My experiment:
  • 1. I start my vlc with this parameters:
    vlc http://192.168.0.2:9001 --http-reconnect --novideo\
    --sout '#transcode{acodec="samr",
    ab="12.2",samplerate="8000",channels="1"}:rtp{dst="239.0.1.6",port-audio="22002",ttl="6",sdp="file:///home/tipok/test_audio.sdp"}'


    2. Then on Windows-machine I open my SDP and listen to this hiss and whist on Quick Time (or Real Player - no matter).

    3. I start ethereal and adjusted it to get my multicast packet's.
The result is:

All RTP (UDP) Packets have 32 bytes of data (without IP, port, and some additional information) I know thah Helix Mobile Producer have 303 bytes of data!

I think i know where is problem (really) But I can't do it myself.
Here is information, what can help us:


AMR RTP packet structure
http://www.ietf.org/internet-drafts/dra ... bis-02.txt

Bugged file (at the end)
https://trac.videolan.org/vlc/file/trun ... _out/rtp.c


Some needed info
http://www.3gpp.org/ftp/Specs/latest/Re ... 01-500.zip

Now we need programmer's help.

Posted: 23 Feb 2006 10:22
by Guest
It is my understanding that AMR is not and will not be supported.

The only way to gain support would be to compile it and ffmpeg yourself.

Posted: 23 Feb 2006 10:38
by tipok
Yes, you have to compile ffmpeg with AMR support, if you want to create 3gp files, but you can't stream this codec by any transport protocol (Only RTP supported, but his broken)

Posted: 21 Mar 2006 18:15
by tipok
Fixed by Alex Antropoff

http://permalink.gmane.org/gmane.comp.v ... evel/21411

You need to change only 3 strings!!!! :D :D :D

Code: Select all

--- vlc-svn-20060315.orig/modules/stream_out/rtp.c 2006-03-15 01:56:47.000000000 +0200 +++ vlc-svn-20060315/modules/stream_out/rtp.c 2006-03-17 01:23:28.000000000 +0200 <at> <at> -2335,12 +2335,12 <at> <at> (in->i_pts > 0 ? in->i_pts : in->i_dts) ); /* Payload header */ out->p_buffer[12] = 0xF0; /* CMR */ - out->p_buffer[13] = 0x00; /* ToC */ /* FIXME: frame type */ + out->p_buffer[13] = p_data[0]&0x7C; /* ToC */ /* FIXME: frame type */ /* FIXME: are we fed multiple frames ? */ - memcpy( &out->p_buffer[14], p_data, i_payload ); + memcpy( &out->p_buffer[14], p_data+1, i_payload-1 ); - out->i_buffer = 14 + i_payload; + out->i_buffer = 14 + i_payload-1; out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_length = in->i_length / i_count;

Posted: 04 Apr 2006 18:04
by Guest
Hello all,

I'm still having problems streaming AMR, Alex's fix does work when generating AMR with the transcode module, but not when streaming directly a 3GP file.

The following works:

Code: Select all

vlc movie.3gp --sout '#transcode{acodec="samr",ab="12.2",samplerate="8000",channels="1"}:rtp{dst=...,sdp=...}'
But this doesn't (garbled sound with QT, segfault with vlc):

Code: Select all

vlc movie.3gp --sout '#rtp{dst=...,sdp=...}'
movie.3gp being a H263/AMR mp4 file produced with ffmpeg or other 3GP tools (MPEG4IP, Helix Producer, etc...)

Posted: 04 Apr 2006 18:13
by tipok
Some bugs in mp4 demuxer for 3gp files.
I have this problem too.


Try to play some other format (for example MPEG2TS) in VLC's input.

Posted: 04 Apr 2006 18:24
by Guest
I'll give it a try, thanks a lot for the tip.