ffmpeg rtmp sender

5,751 views
Skip to first unread message

simonb

unread,
Jan 26, 2011, 10:16:07 AM1/26/11
to C++ RTMP Server
I am trying to send a live stream and see it come back again. Using
ffmpeg I use this command...

ffmpeg -i "some_video.vob" -re -vcodec libx264 -vpre default -vpre
baseline -b 500000 -s 320x180 -strict experimental -g 25 -me_method
zero -acodec aac -ab 96000 -ar 48000 -ac 2 -b 500K -f flv
rtmp://127.0.0.1/live/test

rtmpd reports...
Stream 1 of type NR with name `` unregistered from application
`flvplayback`
Stream 2 of type INR with name `test` registered to application
`flvplayback`
short name: test; long name: test

I then try and play the stream using this command...
vlc rtmp://127.0.0.1/live/test

But it can't find the stream.

I have the same story using flv and mpegts uplinks. ffmpeg seems to
connect OK but I can never find the URL to point VLC to to see it.

The live ffmpeg example in the wiki seems to use UDP. Now ffmpeg
supports rtmp streaming would it be possible to have an rtmp example
in the wiki? Also most of the examples I could find so far in the
mailing list and wiki only show how to uplink to the server. Matching
client side examples would be useful to show what to point the client
(viewer) at.

Thanks & regards,

C++ RTMP Server

unread,
Jan 26, 2011, 11:16:21 AM1/26/11
to c-rtmp...@googlegroups.com

On Jan 26, 2011, at 5:16 PM, simonb wrote:

> I am trying to send a live stream and see it come back again. Using
> ffmpeg I use this command...
>
> ffmpeg -i "some_video.vob" -re -vcodec libx264 -vpre default -vpre
> baseline -b 500000 -s 320x180 -strict experimental -g 25 -me_method
> zero -acodec aac -ab 96000 -ar 48000 -ac 2 -b 500K -f flv
> rtmp://127.0.0.1/live/test

Of course is not working. You try to transfer flv over RTMP. You either pick up "-f flv tcp://localhost:6665"
or
-b 500K rtmp://127.0.0.1/live/test

you can't mix -f flv with rtmp://

Cheers,
Andrei

P.S.
Didn't tested it yet, but I'm pretty sure about it

>
> rtmpd reports...
> Stream 1 of type NR with name `` unregistered from application
> `flvplayback`
> Stream 2 of type INR with name `test` registered to application
> `flvplayback`
> short name: test; long name: test
>
> I then try and play the stream using this command...
> vlc rtmp://127.0.0.1/live/test
>
> But it can't find the stream.
>
> I have the same story using flv and mpegts uplinks. ffmpeg seems to
> connect OK but I can never find the URL to point VLC to to see it.
>
> The live ffmpeg example in the wiki seems to use UDP. Now ffmpeg
> supports rtmp streaming would it be possible to have an rtmp example
> in the wiki? Also most of the examples I could find so far in the
> mailing list and wiki only show how to uplink to the server. Matching
> client side examples would be useful to show what to point the client
> (viewer) at.
>
> Thanks & regards,
>

> You received this message because you are subscribed to "C++ RTMP Server" mailing list.
> To post to this group, send email to c-rtmp...@googlegroups.com
> To unsubscribe from this group, send email to
> c-rtmp-serve...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/c-rtmp-server?hl=en

------
Eugen-Andrei Gavriloaie
Web: http://www.rtmpd.com

Josh Allmann

unread,
Jan 26, 2011, 4:22:17 PM1/26/11
to c-rtmp...@googlegroups.com
Hi,

On 26 January 2011 07:16, simonb <sblan...@gmail.com> wrote:
> I am trying to send a live stream and see it come back again. Using
> ffmpeg I use this command...
>
> ffmpeg -i "some_video.vob" -re -vcodec libx264 -vpre default -vpre
> baseline -b 500000 -s 320x180 -strict experimental -g 25 -me_method
> zero -acodec aac -ab 96000 -ar 48000 -ac 2 -b 500K -f flv
> rtmp://127.0.0.1/live/test
>

Try adding -metadata streamName="test" to your ffmpeg command line.

> rtmpd reports...
> Stream 1 of type NR with name `` unregistered from application
> `flvplayback`
> Stream 2 of type INR with name `test` registered to application
> `flvplayback`
> short name: test; long name: test
>
> I then try and play the stream using this command...
> vlc rtmp://127.0.0.1/live/test
>
> But it can't find the stream.
>
> I have the same story using flv and mpegts uplinks. ffmpeg seems to
> connect OK but I can never find the URL to point VLC to to see it.
>
> The live ffmpeg example in the wiki seems to use UDP. Now ffmpeg
> supports rtmp streaming would it be possible to have an rtmp example
> in the wiki? Also most of the examples I could find so far in the
> mailing list and wiki only show how to uplink to the server. Matching
> client side examples would be useful to show what to point the client
> (viewer) at.
>
> Thanks & regards,
>

simonb

unread,
Jan 27, 2011, 7:56:10 AM1/27/11
to C++ RTMP Server
With -f flv I can connect to rtmpd OK but can't find the URL to view
with.

I tried ffmpeg without the "-f flv" and it barfs with,

"Unable to find a suitable output format for 'rtmp://localhost/live/
test'"

I tried "-f raw" and get,
"Requested output format 'raw' is not a suitable output format"

All the documentation for using ffmpeg to send to FMS, Wowza or Red5
seems to require the flv format.
http://www.ffmpeg.org/ffmpeg-doc.html#SEC43
http://wiki.xuggle.com/Live_Encoding_Tutorial


I did have more luck with tcp://localhost:6665 though. If I catch the
127.0.0.1_xxx.flv name from the rtmpd output then I can pick it up
with
ffplay rtmp://localhost/live/127.0.0.1_xxx.flv.

For some reason ffplay works and VLC doesn't, though VLC has worked
with Wowza and erlyvideo.

I tried changing the name using "-metadata streamName="test but it
seems to be ignored. I can still only connect to the 127.0.0.1_xxx.flv
name. The output I get from ffmpeg looks like it has added the
metadata...

"Output #0, flv, to 'tcp://localhost:6665':
Metadata:
streamName : test
encoder : Lavf52.64.2"

Regards,
>  smime.p7s
> 5KViewDownload

simonb

unread,
Jan 28, 2011, 7:04:53 AM1/28/11
to C++ RTMP Server
OK. I just had some success.

To send I use...
ffmpeg -i myvideo.mp4 -re -vcodec copy -acodec copy -f flv
rtmp://localhost/live/livestream

To receive I use...
rtmpdump -r rtmp://localhost/live/livestream -q -o - -v | ffplay -
or...
rtmpdump -r rtmp://localhost/live/livestream -q -o - -v | vlc
stream:///dev/stdin

In theory using ffplay or vlc directly should work but it doesn't.

It does, however, work with Flowplayer which is the most important
result for me :-)

jimi

unread,
Jan 30, 2011, 2:14:36 AM1/30/11
to C++ RTMP Server
Even I seem to be facing the same problem. I tried the Steps mentioned
in the Article on Wiki. However i am Unable to View the Stream on
jwplayer or haxe

With the Steps Mentioned Below did it work with FlowPlayer??
Could you please shed some insight on playing with FlowPlayer??

jimi

unread,
Jan 30, 2011, 10:50:50 AM1/30/11
to C++ RTMP Server
Simon,
The Options(ffmpeg line) you mentioned below Do not Work For Me.
Anything else you configured??

Cheers,
Shashi Kiran G M

On Jan 28, 5:04 pm, simonb <sblandf...@gmail.com> wrote:

simonb

unread,
Jan 31, 2011, 11:05:51 AM1/31/11
to C++ RTMP Server
Hi Shashi,

What happens? Does ffmpeg not start? What error messages, if any, do
you get?

I am not using any transcoding in the example I gave. It assumes the
input file is already transcoded as required. Perhaps you need a more
elaborate ffmpeg command to encode the video first (just a guess) such
as the the one in my first email...

ffmpeg -i "some_video.vob" --re -vcodec libx264 -vpre default -b
500000 -s 320x180 -strict experimental -g 25 -me_method zero -acodec
aac -ab 96000 -ar 48000 -ac 2 -b 500K -f flv rtmp://localhost/live/livestream

Regards,
Simon

jimi

unread,
Jan 31, 2011, 12:27:07 PM1/31/11
to C++ RTMP Server
Hi Simon,
Thanks For the Prompt Reply...
I am Also Not Using Transoding. I am Issuing the Following Command
from Command Line

# ffmpeg -i hiss.flv -re -vcodec copy -acodec copy -f flv
rtmp://localhost/live/livestream

The Output is as Follows:


FFmpeg version git-ce20edb, Copyright (c) 2000-2011 the FFmpeg
developers
built on Jan 29 2011 20:22:23 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --
enable-postproc --enable-libfaac --enable-libmp3lame --enable-
libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --
enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --
enable-x11grab
libavutil 50. 36. 0 / 50. 36. 0
libavcore 0. 16. 1 / 0. 16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52. 94. 0 / 52. 94. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1. 74. 0 / 1. 74. 0
libswscale 0. 12. 0 / 0. 12. 0
libpostproc 51. 2. 0 / 51. 2. 0
[flv @ 0x988c4e0] Estimating duration from bitrate, this may be
inaccurate

Seems stream 0 codec frame rate differs from container frame rate:
60.00 (60/1) -> 29.97 (30000/1001)
Input #0, flv, from 'hiss.flv':
Metadata:
duration : 0
width : 600
height : 480
videodatarate : 781
framerate : 30
videocodecid : 7
audiodatarate : 125
audiosamplerate : 44100
audiosamplesize : 16
stereo : true
audiocodecid : 2
filesize : 0
Duration: 00:02:12.60, start: 0.000000, bitrate: 928 kb/s
Streaim #0.0: Video: h264, yuv420p, 600x480, 800 kb/s, 29.97 tbr,
1k tbn, 60 tbc
Stream #0.1: Audio: mp3, 44100 Hz, 2 channels, s16, 128 kb/s
TCP connection to localhost:1935 failed: Connection refused


I am Guessing it is Becuase of this Line in the Output

"Seems stream 0 codec frame rate differs from container frame rate:
60.00 (60/1) -> 29.97 (30000/1001)"


Should The Input File be an .mp4?? i Shall Try with AVI file and Use
transcoding approach. I shall get back to you with the Results.



Thanks and Cheers,

jimi

unread,
Jan 31, 2011, 12:38:39 PM1/31/11
to C++ RTMP Server
Hi Simon,
I tried The Following Command

ffmpeg -i "sample_aero.avi" -vcodec libx264 -vpre lossless_medium -b \
500000 -s 320x180 -strict experimental -g 60 -me_method zero -acodec \
aac -ab 96000 -ar 48000 -ac 2 -b 500K -f flv rtmp://localhost/live/livestream

But i get a Similar response...


FFmpeg version git-ce20edb, Copyright (c) 2000-2011 the FFmpeg
developers
built on Jan 29 2011 20:22:23 with gcc 4.4.5
configuration: --enable-gpl --enable-version3 --enable-nonfree --
enable-postproc --enable-libfaac --enable-libmp3lame --enable-
libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --
enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --
enable-x11grab
libavutil 50. 36. 0 / 50. 36. 0
libavcore 0. 16. 1 / 0. 16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52. 94. 0 / 52. 94. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1. 74. 0 / 1. 74. 0
libswscale 0. 12. 0 / 0. 12. 0
libpostproc 51. 2. 0 / 51. 2. 0
[mpeg4 @ 0xa354df0] Invalid and inefficient vfw-avi packed B frames
detected
[mpeg4 @ 0xa354df0] frame skip 8

Seems stream 0 codec frame rate differs from container frame rate:
30000.00 (30000/1) -> 29.97 (30000/1001)
Input #0, avi, from 'sample_aero.avi':
Duration: 00:00:33.90, start: 0.000000, bitrate: 675 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 352x240 [PAR 1:1 DAR 22:15],
29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc
Stream #0.1: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/
s
TCP connection to localhost:1935 failed: Connection refused


I Beleive it is Something that has go to do with ffmpeg options.
Notice the Bitrate has Differed

"Seems stream 0 codec frame rate differs from container frame rate:
30000.00 (30000/1) -> 29.97 (30000/1001)"

I do not want to use a Flash Media Encoder. I want the run the Whole
Setup on a Linux Server. Please let me know of our Observations.
Appreciate your help....

Thanks and Regards,
Shashi Kiran G M


On Jan 31, 9:05 pm, simonb <sblandf...@gmail.com> wrote:

simonb

unread,
Feb 1, 2011, 6:47:46 AM2/1/11
to C++ RTMP Server
Hi Jimi,

FLV, AVI, MP4 etc are just container formats. As long as they contain
H264/VP6 and AAC/MP3 the result should be the same. I don't think the
framerate warning is responsible for the "TCP connection to localhost:
1935 failed: Connection refused" message.

It seems you are not connecting to the rtmpd server. Is it running? Is
there a firewall that is blocking even localhost-localhost
connections. Try installing nmap and typing "nmap -p 1935 localhost"
to see if the port is open.

Also check the debug output from rtmpd. That might give more clues.
With the default config there should be plenty of print-out whenever
anything connects to it.

Regards,
Simon

shashi kiran

unread,
Feb 1, 2011, 9:36:47 AM2/1/11
to c-rtmp...@googlegroups.com
Simon,
  Yes the rtmpd server is Running. I shall Check  whether the Firewall is Blocking localhost-localhost
  I Did check the rtmpd server console. Nothing Unusual it seemed.  I shall Have a Dekko once again.

Regards,
Shashi Kiran G M (JiMi)




jimi

unread,
Feb 1, 2011, 9:40:38 AM2/1/11
to C++ RTMP Server
Simon,
The rtmpd server was running. I shall check the Firewall blocking
scenario as u suggested as well as the console of the rtmpd server.
Last time checked the server did not throw anything unusual.

What is the OS that you are using??

Regards,
Shashi Kiran G M

simonb

unread,
Feb 4, 2011, 1:29:36 AM2/4/11
to C++ RTMP Server
Hi Shashi,

I'm using Ubuntu 10.10 desktop.

The rtmpd console should show at least some new output when you try to
connect.

Regards,
Simon

shashi kiran

unread,
Feb 4, 2011, 1:39:57 AM2/4/11
to c-rtmp...@googlegroups.com
Simon,
   I too am using Ubuntu 10.10. Just now Upgraded to 11.04 Alpha.  Nothing seemed Unusual in the rtmpd console. 
  Shall have a relook at the Output again.


Thanks and Regards,
Shahi Kiran G M





simonb

unread,
Feb 10, 2011, 4:04:28 AM2/10/11
to C++ RTMP Server
Hi Shashi,

Please explain "nothing unusual". Are you getting any output on the
console when you try and connect or does it not change?

Thanks,
Simon
> > c-rtmp-serve...@googlegroups.com<c-rtmp-server%2Bunsubscribe@goog legroups.com>

shashi kiran

unread,
Feb 10, 2011, 5:07:31 AM2/10/11
to c-rtmp...@googlegroups.com
Hi Simon,
   Sorry for the Delayed Response. Had some issues with my Laptop. Got it fixed. The Console Prints messages which seem fine. I shall Paste the output here.




Regards,
Shashi Kiran G M


Reply all
Reply to author
Forward
0 new messages