rtmpdump 2.0 for Android

Search This thread

moose_nz

Member
Jul 17, 2005
15
0
Well I was planning on streaming out via RTSP to the local mediaplayer so that should pass the SDP through that protocal?

Output -> RTSP
Input -> (for now) video file on phone
 

moose_nz

Member
Jul 17, 2005
15
0
Actually I have managed to compile ffmpeg (and ffserver) and run them on the phone without issues.

My problem now is that I can't seem to get the Android media player to play the RTSP stream from ffserver. Any tricks on doing this?

I simply want to play from a local file (I have confirmed the phone can play the local file without issues).
 

mrono

Senior Member
Jun 4, 2009
1,573
4
I'm sorry but i'm just dead in the water on getting this working, it could be that whenever I try it's 2am lol. I don't suppose there's any way you could hold my hand a little bit and tell me exactly what files to use and where to put them and what to do with them. Also how to get h,u,l,u, to work
 

erikslagter

Member
Jun 27, 2010
5
0
Running ffserver on the phone is for various reasons something I'd like avoid or at least postpone at the moment (don't you need to be root to install programs?)

As Howard already got streaming to his G1 working (with only a ffserver on the host), I'd like to get that working. Actually I'm already trying for a few days, but can't get it working. Please give a little help.

I am using the ffserver svn version of today (r23819). The phone retrieves info using "DESCRIBE" and after that decides it cannot play the stream.

I have assumed all relevant patches Howard suggested are now in svn tree. The last patch "rtpenc_h264.c.patch" I've applied additionally, as suggested by Howard. BTW this patch is really not in svn (yet), although Luca says so.

Also I still get these warnings: "Sun Jun 27 12:37:19 2010 [NULL @ 0x1463f70]AAC with no global headers is currently not supported." so I guess there are more patches that have not made it to current svn. I am using the ffserver config file as suggested, with two times "AVOptionVideo flags +global_header" as suggested (audio and video section).
 

erikslagter

Member
Jun 27, 2010
5
0
This patch has not been applied to svn, so I applied it manually, but it doesn't solve the global headers error.

url://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-May/088678.html
 

erikslagter

Member
Jun 27, 2010
5
0
I was thinking... the real problem (imho) is that the media framework of android requires (for http transfer) the moov atom to be at the start, while ffmpeg places it at the end (or fills it in when the input is done, I am not sure). Suppose ffmpeg could be patched (just theory) to create a moov atom that's been filled just enough to satisfy android, could that be a solution? Http is so much simpler than rtp/rtsp and also tcp... If it could be feasible I might have a look, I know for sure the ffmpeg developers themselves aren't going to be implementing this, but maybe with a nice patch ;-)
 

highlandsun

Inactive Recognized Developer
Sep 15, 2009
949
272
Los Angeles
highlandsun.com
I haven't tested a fresh SVN build in a while, so possibly some other things have broken along the way. Will do a new build shortly and see what I get.

I really haven't looked enough at the MP4 format spec to know what needs to go into the moov atom. I assumed it was a frame index, and if that's the case then you obviously can't generate it on the fly because you don't know what the frames are yet. If it's something simpler, it may be possible but I just haven't looked yet.

By the way, it's quite a common problem and there are tons of emails about it all over. This thread, for example

http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2009-October/022631.html
 
Last edited:

erikslagter

Member
Jun 27, 2010
5
0
From what I can find about the moov atom, it indeed hold metadata necessary for seeking. But streaming does not always need seeking ;-) In theory a dummy moov atom could be sent, but I already learnt that the android multimedia api is very picky, so it probably won't play it that way.

IMHO the ideal solution would be that mpeg transport streams would get supported. Apparently the android devs have no interest in incorporating such support in the android core, but I assume it wouldn't really be that hard to create a new player app or modify an existing one to incorporate a mpegts demuxer. Shame I don't have a clue about android apps :-(

Thanks for investigating.
 

highlandsun

Inactive Recognized Developer
Sep 15, 2009
949
272
Los Angeles
highlandsun.com
Here's the complete ffserver.conf for the Android phone:

Code:
Port 8090
RTSPPort 554
BindAddress 127.0.0.1
MaxHTTPConnections 10
MaxClients 2
MaxBandwidth 10000
CustomLog -

<Stream 1>
Format rtp
File "http://my.server.name:8090/1.flv?date=2000-01-01T00:00:00"
</Stream>

<Stream stat.html>
Format status

ACL allow localhost
</Stream>

(make sure you replace "my.server.name" with the hostname or IP address of your actual PC, and make sure that this is a public IP address if you want it to be accessible from the cellphone network.)

and the ffserver.conf for the real server:

Code:
Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 1000
MaxClients 200
MaxBandwidth 10000
CustomLog -

<Feed f.ffm>
# ffmpeg http://localhost:8090/f.ffm
File /tmp/f.ffm
FileMaxSize 2000M
</Feed>

<Stream 1.flv>
Format flv
Feed f.ffm

NoLoop

VideoCodec libx264
VideoFrameRate 24
VideoBitRate 400
VideoSize 480x272
AVPresetVideo default
AVPresetVideo baseline
AVOptionVideo flags +global_header

AudioCodec libfaac
AudioBitRate 64
AudioChannels 2
AudioSampleRate 44100
AVOptionAudio flags +global_header

</Stream>

<Stream stat.html>
Format status

ACL allow localhost
</Stream>

Start the main server's ffserver first, then start the ffserver on the Android phone.

I've also attached an updated h,u,l,u script here. Run it on the main server. If you really don't want to run a copy of ffserver on your phone, you can just use RTP/RTSP on your main server, but in my experience you get a lot of packet loss that way and the stream isn't really watchable. I guess it all depends on how many network hops are between your server and your phone; if both machines are on the same LAN (using wifi) it ought to work fine.
 

Attachments

  • hpub.zip
    4.8 KB · Views: 63
Last edited:

highlandsun

Inactive Recognized Developer
Sep 15, 2009
949
272
Los Angeles
highlandsun.com
Here's another variant on a theme. I've changed the publish script into a CGI script.

There are two files here, the CGI and a simple HTML form for driving it. Copy a URL from h,u,l,u to the form, submit it, and it will fire off the publisher and return an RTSP link to rtsp://127.0.0.1/1. Click the link and the media player will start playing the video. Of course you must already have the two ffserver's running with the above configs...
 

Attachments

  • hpub2.zip
    5.3 KB · Views: 54

highlandsun

Inactive Recognized Developer
Sep 15, 2009
949
272
Los Angeles
highlandsun.com
Running ffserver on the phone is for various reasons something I'd like avoid or at least postpone at the moment (don't you need to be root to install programs?)

As Howard already got streaming to his G1 working (with only a ffserver on the host), I'd like to get that working. Actually I'm already trying for a few days, but can't get it working. Please give a little help.

I am using the ffserver svn version of today (r23819). The phone retrieves info using "DESCRIBE" and after that decides it cannot play the stream.

I have assumed all relevant patches Howard suggested are now in svn tree. The last patch "rtpenc_h264.c.patch" I've applied additionally, as suggested by Howard. BTW this patch is really not in svn (yet), although Luca says so.

Also I still get these warnings: "Sun Jun 27 12:37:19 2010 [NULL @ 0x1463f70]AAC with no global headers is currently not supported." so I guess there are more patches that have not made it to current svn. I am using the ffserver config file as suggested, with two times "AVOptionVideo flags +global_header" as suggested (audio and video section).

Yes you need to have root access. I didn't think that would be an issue for anybody reading this forum.

It's looking to me like T-mobile is blocking RTP traffic, I can only get a good playback using HTTP and/or wifi.

Edit: my mistake. RTP traffic works fine if your RTSP server is listening on the standard port, 554. I had been using 5454 in my tests before, and had configured my local firewall explicitly to pass that thru...
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Just for grins I've compiled the latest rtmpdump source using the Android 1.5 SDK. I guess it's not much use yet since we still don't have good playback of FLV files, but maybe someone here will find a good use for it.

    The source code is from http://rtmpdump.mplayerhq.hu/ This is from the 2.0 C code, not the 1.x C++ code, so it's smaller and faster...
    1
    rtmpdump-2.1.zip

    This is a fresh build of rtmpdump 2.1. Read the README for details. It contains 4 programs:

    rtmpdump - the client
    rtmpsrv - a stub server, used mainly for displaying what other clients are doing
    rtmpsuck - a transparent proxy, used to intercept a client stream and save it to disk while relaying to the client
    streams - an HTTP gateway, serves RTMP streams via HTTP