User avatar
recantha2
Posts: 287
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
Contact: Website Facebook Twitter

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Sat Jun 01, 2013 11:39 am

Excellent! It works now :-) Recompilation of ffmpeg is a must if you want to do it this way!
Thank you!
Now just have to figure out how to forward rtmp through my firewall :-)
--
Michael Horne - @recantha
Raspberry Pi blog - http://www.recantha.co.uk/blog

Cambridge Raspberry Jam
Website: http://camjam.me
Facebook: https://www.facebook.com/cambridgeraspberryjam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam

yusuk
Posts: 5
Joined: Sat May 25, 2013 11:40 am

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Sat Jun 01, 2013 12:04 pm

Wow!! this is soooooo great. It's working perfectly.
And the performance is fantastic.
Thank you.

chrisbonnert
Posts: 1
Joined: Sat Jun 01, 2013 5:28 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Sat Jun 01, 2013 5:37 pm

Thanks rayui, for a very useful post.
I have installed your streaming software successfully and am happily beaming movies around my LAN.
I have a Raspberry Pi (512Mb) version, with an Edimax Wifi dongle and am running the Wheezy release with Apache 2 webserver.

I had to change two things on the raspivid command:
1) -1 changed to 9999999
2) needed to add -hf to do a horizontal flip of the image.

The next step I would like info on is how to broadcast outside my LAN to the internet ;-)
Regards, Chris.

solardesigner
Posts: 1
Joined: Sat Jun 01, 2013 7:06 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Sat Jun 01, 2013 7:22 pm

chrisbonnert wrote:Thanks rayui, for a very useful post.
I have installed your streaming software successfully and am happily beaming movies around my LAN.
I have a Raspberry Pi (512Mb) version, with an Edimax Wifi dongle and am running the Wheezy release with Apache 2 webserver.

I had to change two things on the raspivid command:
1) -1 changed to 9999999
2) needed to add -hf to do a horizontal flip of the image.

The next step I would like info on is how to broadcast outside my LAN to the internet ;-)
Regards, Chris.
All you have to do to have a boadcast on the internet is to forward ports 80 (http) and 1935 (crtmpserver) from your raspberrypi to the outside world. Configuration itself needs to be made on your NAT device (router).

yusuk
Posts: 5
Joined: Sat May 25, 2013 11:40 am

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Sun Jun 02, 2013 12:58 am

Is there a way to view the streaming via Android(Jellybean)?
I downloaded Adobe flash player at http://forum.xda-developers.com/showthr ... 0480%C2%A0 and checked other flash contents works fine.
But this streaming can't be played on Android.
Can we play this streaming on Android Phone?

bouncymat
Posts: 38
Joined: Thu Feb 28, 2013 8:24 am

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Sun Jun 02, 2013 10:35 pm

thankyou,
got this working (good instructions)

i'm getting about 6 seconds delay (wifi to wifi) using the settings as described. Does that sound about right or could i do better?

rayui
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
Contact: Website

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Sun Jun 02, 2013 11:26 pm

Hi bouncymat.
I think you can do better than 6 seconds. Like I say, I'm getting about 1s. Netcat to dekstop over wifi seems to be a lot faster than ffmpeg/rtmp over wifi, so I'm going to try running some performance tests to see where the lag is occurring. I'm hoping the lag is occurring in the frame capture and order process of the swf application as opposed to the ffmpeg packeting process. on the Pi. Maybe you could try raising the RT priority of ffmpeg or try out different flash players, e.g. flowplayer for now.

B0SC0
Posts: 22
Joined: Tue Jun 04, 2013 3:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Tue Jun 04, 2013 3:54 pm

Need some help,please.
I am getting this error.
What am I doing wrong?

pi@V1 /var/log/crtmpserver $ raspivid -t -9999999 -w 960 -h 540 -fps 25 -b 500000 -vf -o - | ffmpeg -i - -vcodec copy -an -f flv -metadata streamName=myStream tcp://0.0.0.0:6666
ffmpeg version N-53814-gb4d4ef5 Copyright (c) 2000-2013 the FFmpeg developers
built on Jun 4 2013 01:03:26 with gcc 4.6 (Debian 4.6.3-14+rpi1)
configuration:
libavutil 52. 34.100 / 52. 34.100
libavcodec 55. 15.100 / 55. 15.100
libavformat 55. 8.102 / 55. 8.102
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 74.101 / 3. 74.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
pipe:: Invalid data found when processing input

rayui
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
Contact: Website

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Tue Jun 04, 2013 5:11 pm

Try this:
raspivid -t -9999999 -w 960 -h 540 -fps 25 -b 500000 -vf -o -

It will probably be failing. Is the camera seated correctly?

B0SC0
Posts: 22
Joined: Tue Jun 04, 2013 3:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Tue Jun 04, 2013 6:09 pm

Reseat both ends of camera cable, reboot

pi@V1 ~ $ raspivid -t -9999999 -w 960 -h 540 -fps 25 -b 500000 -vf -o -
'd�+@�p&�pi@V1 ~ $

Before and after the d and after the p (in the above line) the screen actually shows squares with 0001, 001F, and 0012 inside them,respectably.

B0SC0
Posts: 22
Joined: Tue Jun 04, 2013 3:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Tue Jun 04, 2013 6:37 pm

Forgot to mention:
I have wifi , apache2 installed.
Haven't actually used apache2 other than seeing the html file "It works" on my pc.
Avahi, as per your instructions but nothing else.

B0SC0
Posts: 22
Joined: Tue Jun 04, 2013 3:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Tue Jun 04, 2013 6:42 pm

raspistill -o image.jpg

works, so camera is working fine

User avatar
recantha2
Posts: 287
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
Contact: Website Facebook Twitter

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Tue Jun 04, 2013 7:41 pm

You've got your time parameter wrong.
You've got a minus sign before the 999999
change it to -t 9999999
--
Michael Horne - @recantha
Raspberry Pi blog - http://www.recantha.co.uk/blog

Cambridge Raspberry Jam
Website: http://camjam.me
Facebook: https://www.facebook.com/cambridgeraspberryjam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam

B0SC0
Posts: 22
Joined: Tue Jun 04, 2013 3:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Tue Jun 04, 2013 8:26 pm

That was it!

It's those simple little things that will get you :oops: :oops: :oops:

Thank you

B0SC0
Posts: 22
Joined: Tue Jun 04, 2013 3:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Tue Jun 04, 2013 11:51 pm

Okay,almost there.

I start the camera on the pi and see the video on the pi's monitor.

On my pc, I type my pi's ip address.

All I am seeing is the index.html file below;

"It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet."

Why am I not seeing video from my pc?

jwplayer folder is located at:

/etc/apache2/jwplayer

html file located at /etc/apache2/myvideostream.html


I have my html file which I named myvideostream.html

<html>
<head>
<title>Raspbi Camera RTMP stream test</title>
</head>
<body>
<div id="video-jwplayer_wrapper" style="position: relative; display: block; width: 960px; height: 540px;">
<object type="application/x-shockwave-flash" data="/jwplayer/jwplayer.flash.swf" width="100%" height="100%" bgcolor="#000000" id="video-jwplayer" name="video-jwplayer" tabindex="0">
<param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="seamlesstabbing" value="true">
<param name="wmode" value="opaque">
</object>
<div id="video-jwplayer_aspect" style="display: none;"></div>
<div id="video-jwplayer_jwpsrv" style="position: absolute; top: 0px; z-index: 10;"></div>
</div>

<script src="/jwplayer/jwplayer.js"></script>

<script type="text/javascript">
jwplayer('video-jwplayer').setup({
flashplayer:"/jwplayer/jwplayer.flash.swf"
, file:"rtmp://" + window.location.hostname + "/flvplayback/flv:myStream.flv"
, autoStart: true
, rtmp:{
bufferlength:0.1
}
, deliveryType: "streaming"
, width: 960
, height: 540
, player: {
modes: {
linear: {
controls:{
stream:{
manage:false
, enabled: false
}
}
}
}
}
, shows: {
streamTimer: {
enabled: true
, tickRate: 100
}
}
});
</script>
</body>
</html>

User avatar
jacksonliam
Posts: 181
Joined: Tue Feb 07, 2012 10:09 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Wed Jun 05, 2013 7:53 am

Pretty sure apache expects html files to be in /var/www
so put the html file and jwplayer folder in there :)

Then youll have to access from ipaddress:port/videostream.html
or whatever you named that html file.

User avatar
theoriginalxbrav
Posts: 41
Joined: Sun May 12, 2013 7:16 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Wed Jun 05, 2013 4:11 pm

This works amazing, thanks!

I've been streaming 25fps over the net all night. The only issue seems to be that JW Player falls behind on the livestream after prolonged periods of time. Refreshing the page catches it up.

With how amazing this works, you can have an advanced IP camera for ~$60. That's crazy.
Projects:
Raspberry Pi Weather Camera and weeWX: http://reboot.us.com/local-weather/
Daily Timelapses: https://www.youtube.com/playlist?list=PLi1er5S-VzV8d2t21zT0U_aBInl1_Ojkf

B0SC0
Posts: 22
Joined: Tue Jun 04, 2013 3:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Wed Jun 05, 2013 5:57 pm

start video on the pi.
from pc running firefox enter:
http://myipaddress:1935/myvideostream.html
just sits there churning but no video.
Is port 1935 okay to use?

rbn
Posts: 143
Joined: Tue Dec 27, 2011 8:32 pm
Location: Near Peterborough
Contact: Website

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Wed Jun 05, 2013 7:13 pm

Thanks a lot for this. After a bit of fiddling got it working fine with nginx as the webserver.
Have to look at a cross-complier setup next time. Took a long time to compile ffmpeg!

rbn
Posts: 143
Joined: Tue Dec 27, 2011 8:32 pm
Location: Near Peterborough
Contact: Website

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Wed Jun 05, 2013 8:03 pm

Saw someone else asking about modifying this for ios devices eg iphone. Anyone care to have a go? Don't feel up to working out the changes, but I understand that ffmpeg and the latest jwplayer can be set up to give html5 compatible output suitable for these devices. The current example uses flash which is a no-no here.

RogerRamJet
Posts: 9
Joined: Fri Sep 28, 2012 6:59 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Wed Jun 05, 2013 9:09 pm

For other people who are trying this and have problems. This is just my experience.

git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

I had an error here with git
Had to do this first

Code: Select all

sudo apt-get install git-core
When I performed the make & it took ages. I set it going at 9:10pm, 12:30 I went to bed and between then and 3:45am when I woke due to cats crying and mucking about it had finished!!!

The following has to be running on the pi before video is seen on your website. Note : 9999999 not -1
raspivid -t 9999999 -w 960 -h 540 -fps 25 -b 500000 -vf -o - | ffmpeg -i - -vcodec copy -an -f flv -metadata streamName=myStream tcp://0.0.0.0:6666

When I copied jwplayer from my computer to my pi I placed it in my www directory but I left it as jwplayer-3359. Should just be jwplayer and also when I unzipped it on my laptop the folder was jwplayer-3359\jwplayer\*.* One two many jwplayer!!!

rayui - Thank you very much for the effort and time you have put in. I hope you don't mind adding these comments. I was a little disappointed when Raspberry Pi had not done anything for a webcam or at least I think that is the case but they have done amazing things by bringing us the camera in the first place. I am not knocking them. The community out there will bring the webcam just like you have done. There will be continual refinement of the webcam process no doubt.
I am more than happy with the results and can't wait to get it strapped to my tilt and pan mechanism on my pi rover . Even the wife was impressed lol.
Last edited by RogerRamJet on Thu Jun 06, 2013 10:01 pm, edited 1 time in total.

B0SC0
Posts: 22
Joined: Tue Jun 04, 2013 3:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Wed Jun 05, 2013 9:19 pm

B0SC0 wrote:start video on the pi.
from pc running firefox enter:
http://myipaddress:1935/myvideostream.html
just sits there churning but no video.
Is port 1935 okay to use?

I have tried other ports with no luck.

Any suggestions?

paulfxh
Posts: 28
Joined: Sun Mar 11, 2012 8:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Wed Jun 05, 2013 10:44 pm

Don't use any port.
Just type "myipaddress/myvideostream" in the browser address bar.
You can add the "http://" and ".html" if you want, but they're not necessary.
Note that, as jacksonliam pointed out, your .html file and the jwplayer folder must be in your /var/www/ directory.

B0SC0
Posts: 22
Joined: Tue Jun 04, 2013 3:46 pm

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Thu Jun 06, 2013 12:32 am

paulfxh wrote:Don't use any port.
Just type "myipaddress/myvideostream" in the browser address bar.
You can add the "http://" and ".html" if you want, but they're not necessary.
Note that, as jacksonliam pointed out, your .html file and the jwplayer folder must be in your /var/www/ directory.

Working now, using only "myipaddress/myvideostream" after a reboot.

Thanks to all for their help. :D

dostei
Posts: 5
Joined: Thu Jun 06, 2013 8:56 am

Re: Streaming Raspberry Pi Camera H264 into HTML over RTMP

Thu Jun 06, 2013 9:33 am

hi together i have a problem with trying the manual:

when i use the command ( ffmpeg from source):
./configure

nothing happend. the cursor makes a new line but nothing happend.
i have done all steps before but it doesn``t work .

Return to “Camera board”