On Mon, Feb 7, 2011 at 3:38 PM, Howard Chu <span dir="ltr"><<a href="mailto:hyc@highlandsun.com">hyc@highlandsun.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">Andrew McClure wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi. We are developing an RTMP application and are having trouble getting it to<br>
interoperate with the librtmp (as used in FFmpeg).<br>
<br>
<br>
Our application acts like a proxy. In our test configuration, we have a port<br>
1936 which accepts RTMP publishing, and a different port 1935 which accepts<br>
RTMP playing. Packets received from the publisher connected to port 1936 are<br>
forwarded to the player connected on port 1935 (with some minimal munging). We<br>
have two simple flash applets (written in Flex, using the standard<br>
Video/Camera/NetConnection objects) which connect to these ports; one streams<br>
video from a webcam, the other plays the video thus streamed.<br>
<br>
<br>
When we try to play video originating in Flex, forwarded through our proxy and<br>
played back in Flex, it works. The video appears on the screen.<br>
<br>
<br>
However then we try something different. We compiled a version of ffmpeg (svn<br>
r26326) with librtmp (from rtmpdump svn r555). (If there is a better way to<br>
test publish with librtmp than this, I would be curious to know.) We try using<br>
ffmpeg to publish to our port 1936:<br>
<br>
<br>
./ffmpeg -loglevel debug -i ~/Downloads/20051210-w50s.flv -re -ac 1 -acodec<br>
copy -vcodec flv -f copy rtmp://localhost:1936/<br>
<br>
<br>
And then play back the video by connecting the Flex applet to port 1935. We<br>
are having a problem where we are able to handshake, understand ffmpeg's<br>
publish commands and forward the packets through to the Flex applet as<br>
appropriate... *but* the Flex applet does not display video or audio. We get a<br>
black windowpane and silence.<br>
<br>
<br>
When we forward the ffmpeg streams, we appear to be doing (or failing to do)<br>
something to the RTMP packets such that the Flex player no longer understands<br>
the RTMP stream. But of course this problem only occurs with streams generated<br>
through ffmpeg. So it appears this is due to some slight difference between<br>
the RTMP protocol as implemented by ffmpeg and Flex-- we are compatible with<br>
the Flex publisher's notion of RTMP but not ffmpeg's. What I am trying to<br>
figure out:<br>
<br>
<br>
- What might this difference in RTMP implementation be, which is causing<br>
ffmpeg to apparently not be compatible with our RTMP proxy?<br>
<br>
<br>
- Is there a way to get ffmpeg (or another librtmp tool) to act like a<br>
"server", such that our Flex video object could connect directly to ffmpeg,<br>
issue a play request, and start receiving a video? I ask this in case the<br>
problem is not in fact that we are damaging ffmpeg's stream, but rather that<br>
ffmpeg just is not generating data Flex knows how to work with in the first<br>
place. (I find this "ffserver" tool, however this does not look like what I am<br>
looking for; the docs seem to imply it does RTP/RTSP only, and the html doc<br>
also says "It can also stream from files, though that is currently broken.")<br>
<br>
<br>
One possible source of concern is that when the player connects on 1935, it<br>
does not see the beginning of the stream-- it comes in after the stream has<br>
been waiting a few seconds. However once connected we do wait until we see a<br>
keyframe to begin streaming, and we forward a cached copy of the metadata<br>
packet at that time.<br>
<br>
<br>
We also did try forcing ffmpeg to publish in codecs I know Flex understands,<br>
but it does not help:<br>
<br>
<br>
./ffmpeg -loglevel debug -i ~/Downloads/20051210-w50s.flv -re -ac 1 -acodec<br>
nellymoser -vcodec flv -f flv rtmp://localhost:1936/<br>
<br>
<br>
Do you have any suggestions? What are the requirements our application must<br>
follow to interoperate with ffmpeg/librtmp? To our understanding we are<br>
compatible with the published RTMP spec but the spec is ambiguous on many points.<br>
<br>
<br>
Note, I was unsure the most appropriate place to ask these questions so I also<br>
sent this post to the ffmpeg-user list. Thanks.<br>
</blockquote>
<br></div></div>
The last time I checked, ffserver worked fine for serving FLV files over http. (There were a few bugs in that before but I fixed them several months ago. It's of course entirely possible that someone else has re-broken it again since then...)<br>
<br>
I've only been using H.264/AAC FLV files, they worked fine the last time I tried publishing, but again, that all depends on your clients.<br>
</blockquote></div><br><div><meta charset="utf-8">Thanks, that's worth exploring, but again my goal here is only to debug compatibility issues between different RTMP protocol implementations-- we do not in the long term plan to use ffserver. So if we were serving ffserver->flex via http, we would be bypassing RTMP paths and thus not exercising the parts of ffmpeg/librtmp we are interested in...</div>