[FFmpeg-user] RTMP stream URL truncation

Dan Harrison nixscripter at gmail.com
Sun Jul 7 20:47:00 CEST 2013

Hello, list.

I'm trying to use FFmpeg to save an RTMP stream from the internet (i.e. a
server I don't control). It claims it cannot find the stream. When I look
at verbose output, however, the problem is clear:

$ ffmpeg -loglevel verbose -i "rtmp://foo.net/cfx/st/mp4:BAR_BAZ/file.mp4"
HandleInvoke, received result for method call
SendPlay, seekTime=0, stopTime=0, sending play: mp4:file


Notice that "file.mp4" got its suffix dropped, even though it was part of
the stream's name. As a result, the server replies it cannot find the

(object begin)
Property: <Name:              level, STRING:    error>
Property: <Name:               code, STRING:
Property: <Name:        description, STRING:    Failed to play file; stream
not found.>
Property: <Name:            details, STRING:    file>
Property: <Name:           clientid, STRING:    xlaQOJIn>
(object end)

I'm guessing that FFmpeg used the librtmp library the same way rtmpdump
does, because it does the same thing (verbose output not shown is identical
to the above):

$ rtmpdump -r "rtmp://foo.net/cfx/st/mp4:BAR_BAZ/file.mp4" -o out.mp4
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
ERROR: Closing connection: NetStream.Play.StreamNotFound

And yet, when I use mplayer or mencoder -- which also uses librtmp -- it
decides not to drop the suffix, and works correctly:

$ mplayer -msglevel all=6 "rtmp://foo.net/cfx/st/mp4:BAR_BAZ/file.mp4"
[rtmp @ 0x7f33ea814060]Handshaking...
[rtmp @ 0x7f33ea814060]Type answer 3
[rtmp @ 0x7f33ea814060]Server version
[rtmp @ 0x7f33ea814060]Proto = rtmp, path = /cfx/st/mp4:BAR_BAZ/file.mp4,
app = cfx/st, fname = mp4:BAR_BAZ/file.mp4
[rtmp @ 0x7f33ea814060]Server bandwidth = 1310720
[rtmp @ 0x7f33ea814060]Client bandwidth = 2500000
[rtmp @ 0x7f33ea814060]Creating stream...
[rtmp @ 0x7f33ea814060]Sending play command for 'mp4:BAR_BAZ/file.mp4'
[rtmp @ 0x7f33ea814060]New incoming chunk size = 4096
STREAM: [ffmpeg] rtmp://foo.net/cfx/st/mp4:BAR_BAZ/file.mp4

In fact, as you can see, mplayer uses libavcodec to decode the stream! So I
know the code all works once this little problem gets solved.

How do I get FFmpeg to tack my suffix back on?
Dan Harrison

More information about the ffmpeg-user mailing list