Streaming Raspberry Pi Camera H264 into HTML over RTMP


199 posts   Page 1 of 8   1, 2, 3, 4, 5 ... 8
by rayui » Wed May 29, 2013 12:40 am
SPD Raspberry Pi Camera setup instructions for Raspbian Wheezy

Requirements: Raspbian Wheezy with hard float enabled. I assume you have avahi, wifi, and have updated to the latest firmware and enabled the camera. You also have a web server configured on the pi.

Install crtmpserver
Code: Select all
sudo aptitude install crtmpserver

Add the crtmpserver log directory
Code: Select all
sudo mkdir /var/log/crtmpserver

Change these values in /etc/crtmpserver/applications/flvplayback.lua
Code: Select all
validateHandshake=false,
keyframeSeek=false,
seekGranularity=0.1
clientSideBuffer=30

Restart crtmpserver
Code: Select all
sudo /etc/init.d/crtmpserver restart

Install ffmpeg from source. This step is very important. It won't work with the Raspbian version of ffmpeg because the Debian version of libavcodec doesn't contain the H264 libraries needed for the flash streaming protocol.
Code: Select all
sudo aptitude remove ffmpeg
cd /usr/src
sudo mkdir ffmpeg
sudo chown `whoami`:users ffmpeg
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure
make
sudo make install

Stream from raspberry pi camera to crtmpserver and wrap the raw video in flv metadata
Code: Select all
raspivid -t -1 -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

Check the crtmpserver logs. You should see the incoming connection from ffmpeg show up like this:
Code: Select all
<MAP name="" isArray="false">
    <STR name="ip">0.0.0.0</STR>
    <UINT16 name="port">6666</UINT16>
    <STR name="protocol">inboundLiveFlv</STR>
    <STR name="sslCert"></STR>
    <STR name="sslKey"></STR>
    <BOOL name="waitForMetadata">true</BOOL>
</MAP>

Download jwplayer from http://www.longtailvideo.com/, unzip it and place the jwplayer folder in a directory of your web server. I got jwplayer version 3359, YMMV. Then, place the following in an html file in the same directory of your web server:
Code: Select all
<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>

You're done! Visit your html page and after a moment's buffering you should see video.

NOTES
I found I can have a consistent 25 fps at a bitrate of 500000 over a USB Netgear 8192CU Wi-Fi dongle with a delay of about 1s at best.
Other types of h264 stream players, e.g. flowplayer, are available.
Last edited by rayui on Thu May 30, 2013 2:56 pm, edited 5 times in total.
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
by recantha2 » Wed May 29, 2013 8:31 am
This doesn't work for me - the stream playback never starts.
I'm getting this from the stream start script:
Seems stream 0 codec frame rate differs from container frame rate: 2400000.00 (2400000/1) -> 25.00 (25/1)
Input #0, h264, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264 (High), yuv420p, 960x540, 25 fps, 25 tbr, 1200k tbn, 2400k tbc
Output #0, flv, to 'tcp://0.0.0.0:6666':
Metadata:
streamName : myStream
encoder : Lavf53.21.1
Stream #0.0: Video: libx264, yuv420p, 960x540, q=2-31, 1k tbn, 1200k tbc
Stream mapping:
Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
frame= 3722 fps= 25 q=-1.0 size= 7663kB time=10000000000.00 bitrate= 0.0kbits/s


But jwplayer just sits there whirring.

Any ideas?
--
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
User avatar
Posts: 235
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
by rayui » Wed May 29, 2013 8:44 am
That output looks weird because you have a bitrate of 0 but your output stream size is greater than 0. I also notice ffmpeg is complaining about frame rates. You can adjust the frame rates with -fps for raspivid and -r for ffmpeg.

raspivid -t -1 -w 960 -h 540 -fps 25 -b 500000 -vf -o - | ffmpeg -i - -vcodec copy -an -r 25 -f flv -metadata streamName=myStream tcp://0.0.0.0:6666

The thing is, though, ffmpeg shouldn't need to know the frame rate, we only want to wrap the stream frames it in the flv container as opposed to transcoding it, so I'm not sure why this is happening for you. Can you post the command you used?
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
by recantha2 » Wed May 29, 2013 12:08 pm
I did a full apt-get update/upgrade first.

If I use -t -1, I get:
pipe:: Invalid data found when processing input

So, I've changed the -1 to 9999999:
raspivid -t 9999999 -w 960 -h 540 -fps 25 -b 500000 -vf -o - | ffmpeg -i - -vcodec copy -an -r 25 -f flv -metadata streamName=myStream tcp://0.0.0.0:6666

And that's when I get the output I posted before.
--
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
User avatar
Posts: 235
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
by rayui » Wed May 29, 2013 12:12 pm
I think I saw a post about the -t option has been reverted to only take unsigned ints for some reason, so stick with 999999999 if -1 is giving errors. Do you see the connection appear in the crtmpserver logs at all? Can you check if you have libavcodec installed?

- EDIT -

Also, try the following command. It should produce a .flv file that you can play with mplayer or vlc. If that part is okay, we know it's a problem connecting to the rtmp server.

raspivid -t 5000 -w 960 -h 540 -fps 25 -b 500000 -vf -o - | ffmpeg -i - -vcodec copy -an -r 25 -f flv test.flv
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
by recantha2 » Wed May 29, 2013 12:24 pm
Actually... it looks like since the last upgrade things like VLC streaming have stopped working... Great...
--
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
User avatar
Posts: 235
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
by rayui » Wed May 29, 2013 12:40 pm
Oh, you shouldn't need any of the VLC stuff. If it's of any use, I ran the rpi-update on Sunday 26th.
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
by recantha2 » Wed May 29, 2013 1:52 pm
Oh, that was just a by-the-way - I've got vlc working again now on a different port.

Still no luck with the other way though :-(
--
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
User avatar
Posts: 235
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
by rayui » Wed May 29, 2013 1:56 pm
Can you post the crtmpserver log?
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
by recantha2 » Wed May 29, 2013 2:06 pm
here goes:
Code: Select all
PID: 4033; TIMESTAMP: 1369836240
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:203:Initialize:Initialize I/O handlers manager: epoll
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:206:Initialize:Configure modules
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:84:LoadLibrary:Module /usr/lib/crtmpserver/applications/applestreamingclient/libapplestreamingclient.so loaded
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:84:LoadLibrary:Module /usr/lib/crtmpserver/applications/appselector/libappselector.so loaded
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:84:LoadLibrary:Module /usr/lib/crtmpserver/applications/flvplayback/libflvplayback.so loaded
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:84:LoadLibrary:Module /usr/lib/crtmpserver/applications/proxypublish/libproxypublish.so loaded
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:84:LoadLibrary:Module /usr/lib/crtmpserver/applications/stresstest/libstresstest.so loaded
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:212:Initialize:Plug in the default protocol factory
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:219:Initialize:Configure factories
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:225:Initialize:Configure acceptors
1369836240:4:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/iohandlermanager.cpp:100:RegisterIOHandler:Handlers count changed: 0->1 IOHT_ACCEPTOR
1369836240:4:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/iohandlermanager.cpp:100:RegisterIOHandler:Handlers count changed: 1->2 IOHT_ACCEPTOR
1369836240:4:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/iohandlermanager.cpp:100:RegisterIOHandler:Handlers count changed: 2->3 IOHT_ACCEPTOR
1369836240:4:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/iohandlermanager.cpp:100:RegisterIOHandler:Handlers count changed: 3->4 IOHT_ACCEPTOR
1369836240:4:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/iohandlermanager.cpp:100:RegisterIOHandler:Handlers count changed: 4->5 IOHT_ACCEPTOR
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:231:Initialize:Configure instances
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:237:Initialize:Start I/O handlers manager: epoll
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:240:Initialize:Configure applications
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:177:ConfigApplication:Application applestreamingclient instantiated
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:177:ConfigApplication:Application appselector instantiated
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:177:ConfigApplication:Application flvplayback instantiated
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:177:ConfigApplication:Application proxypublish instantiated
1369836240:4:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/iohandlermanager.cpp:100:RegisterIOHandler:Handlers count changed: 5->6 IOHT_TIMER
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/configuration/module.cpp:177:ConfigApplication:Application stresstest instantiated
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:246:Initialize:Install the quit signal
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:257:Run:
+-----------------------------------------------------------------------------+
|                                                                     Services|
+---+---------------+-----+-------------------------+-------------------------+
| c |      ip       | port|   protocol stack name   |     application name    |
+---+---------------+-----+-------------------------+-------------------------+
|tcp|        0.0.0.0| 1935|              inboundRtmp|              appselector|
+---+---------------+-----+-------------------------+-------------------------+
|tcp|        0.0.0.0| 8080|             inboundRtmpt|              appselector|
+---+---------------+-----+-------------------------+-------------------------+
|tcp|        0.0.0.0| 6666|           inboundLiveFlv|              flvplayback|
+---+---------------+-----+-------------------------+-------------------------+
|tcp|        0.0.0.0| 9999|             inboundTcpTs|              flvplayback|
+---+---------------+-----+-------------------------+-------------------------+
|tcp|        0.0.0.0| 6665|           inboundLiveFlv|             proxypublish|
+---+---------------+-----+-------------------------+-------------------------+
1369836240:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/crtmpserver/src/crtmpserver.cpp:258:Run:GO! GO! GO! (4033)
1369836271:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/tcpacceptor.cpp:154:Accept:Client connected: 127.0.0.1:35869 -> 0.0.0.0:6666
1369836271:6:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/protocols/liveflv/inboundliveflvprotocol.cpp:46:Initialize:parameters:
<MAP name="" isArray="false">
    <STR name="ip">0.0.0.0</STR>
    <UINT16 name="port">6666</UINT16>
    <STR name="protocol">inboundLiveFlv</STR>
    <STR name="sslCert"></STR>
    <STR name="sslKey"></STR>
    <BOOL name="waitForMetadata">true</BOOL>
</MAP>
1369836271:6:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/protocols/liveflv/inboundliveflvprotocol.cpp:51:Initialize:_waitForMetadata: 1
1369836271:4:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/iohandlermanager.cpp:100:RegisterIOHandler:Handlers count changed: 6->7 IOHT_TCP_CARRIER
1369836271:6:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/protocols/liveflv/baseliveflvappprotocolhandler.cpp:45:RegisterProtocol:protocol CTCP(10) <-> TCP(2) <-> [ILFL(3)] registered to app flvplayback
1369836271:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/application/baseclientapplication.cpp:227:SignalStreamRegistered:Stream INLFLV(1) with name `myStream` registered to application `flvplayback` from protocol ILFL(3)
1369836271:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/protocols/liveflv/inboundliveflvprotocol.cpp:184:SignalInputData:Stream metadata:
<MAP name="" isArray="true">
    <MAP name="__index__value__0" isArray="true">
        <DOUBLE name="duration">0.000</DOUBLE>
        <STR name="encoder">Lavf53.21.1</STR>
        <DOUBLE name="filesize">0.000</DOUBLE>
        <DOUBLE name="framerate">1200000.000</DOUBLE>
        <DOUBLE name="height">540.000</DOUBLE>
        <STR name="streamName">myStream</STR>
        <DOUBLE name="videocodecid">7.000</DOUBLE>
        <DOUBLE name="videodatarate">0.000</DOUBLE>
        <DOUBLE name="width">960.000</DOUBLE>
    </MAP>
</MAP>
1369836271:6:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/protocols/liveflv/innetliveflvstream.cpp:246:InitializeVideoCapabilities:Cached the h264 video codec initialization: 36
1369836283:0:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/protocols/liveflv/inboundliveflvprotocol.cpp:102:SignalInputData:Frame too large: 4170874
1369836283:0:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/tcpcarrier.cpp:88:OnEvent:Unable to signal data available
1369836283:4:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/netio/epoll/iohandlermanager.cpp:109:UnRegisterIOHandler:Handlers count changed: 7->6 IOHT_TCP_CARRIER
1369836283:6:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/protocols/protocolmanager.cpp:44:EnqueueForDelete:Enqueue for delete for protocol [ILFL(3)]
1369836283:3:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/application/baseclientapplication.cpp:238:SignalStreamUnRegistered:Stream INLFLV(1) with name `myStream` unregistered from application `flvplayback` from protocol ILFL(3)
1369836283:6:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/protocols/liveflv/baseliveflvappprotocolhandler.cpp:58:UnRegisterProtocol:protocol [ILFL(3)] unregistered from app flvplayback
1369836283:6:/build/crtmpserver-W2XmBu/crtmpserver-1.0~dfsg/thelib/src/application/baseclientapplication.cpp:216:UnRegisterProtocol:Protocol [ILFL(3)] unregistered from application: flvplayback
--
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
User avatar
Posts: 235
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
by rayui » Wed May 29, 2013 6:09 pm
Okay, that clearly tells me that crtmspserver is starting up correctly and is receiving the stream but that it has a data rate of zero. We know raspivid works correctly, so the problem must be with ffmpeg. My guess is that you had already previously installed ffmpeg on your system and did not uninstall it prior to reinstalling from source, or that you did not reinstall from source and used the existing version. Can you confirm that?
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
by recantha2 » Wed May 29, 2013 6:45 pm
Ah. Yes, that is true, I did use ffmpeg that I'd previously installed. Mind you, the same thing happens if I use avconv and that's supposed to be more up-to-date. I shall try a fresh install of ffmpeg first.
--
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
User avatar
Posts: 235
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
by recantha2 » Wed May 29, 2013 8:51 pm
My goodness that's a long compilation...
--
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
User avatar
Posts: 235
Joined: Wed Nov 14, 2012 9:34 am
Location: Potton, Bedfordshire
by jacksonliam » Wed May 29, 2013 9:36 pm
What's the cpu use streaming to one client?
User avatar
Posts: 171
Joined: Tue Feb 07, 2012 10:09 pm
by bfmorgan » Wed May 29, 2013 10:00 pm
I'm new to this, sorry for the question.

When I run make after getting the git files, it says:

Makefile:2: config.mak: No such file or directory
Makefile:48: /common.mak: No such file or directory
Makefile:91: /libavutil/Makefile: No such file or directory
Makefile:91: /library.mak: No such file or directory
Makefile:168: /doc/Makefile: No such file or directory
Makefile:169: /tests/Makefile: No such file or directory
make: ** No rule to make target ~/tests/Makefile' . Stop.

I'm executing the make command from the /usr/src/ffmpeg directory

Any thoughts for the noob?
Posts: 1
Joined: Wed May 29, 2013 4:54 pm
by dhid » Wed May 29, 2013 10:50 pm
I've followed this method and have exactly the same problem as recantha2 - bitrate shown as 0K - and as I also already had ffmpeg installed I've tried compiling ffmpeg from source as shown above:

cd /usr/src
sudo mkdir ffmpeg
sudo chown pi:users ffmpeg
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
make
sudo make install


However when I get to "make" I get the following:

pi@raspberrypi /usr/src/ffmpeg $ make
Makefile:2: config.mak: No such file or directory
Makefile:48: /common.mak: No such file or directory
Makefile:91: /libavutil/Makefile: No such file or directory
Makefile:91: /library.mak: No such file or directory
Makefile:168: /doc/Makefile: No such file or directory
Makefile:169: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'. Stop.

I'm afraid I know very little about compiling from source in Linux but I'm guessing that it's something to do with the path to the source files given in Makefile? Although "congfig.mak" doesn't appear to exist but is shown as an include in Makefile.
I've tried "sudo make" but no difference.
Any ideas?
Posts: 13
Joined: Wed Feb 06, 2013 3:23 pm
Location: UK
by mrlinux2u » Wed May 29, 2013 11:10 pm
try running

./configure

then

make &

sudo make install, should fix the problem

cheers

mrlinux2u
Posts: 187
Joined: Sat Sep 24, 2011 8:38 pm
by mikec79 » Thu May 30, 2013 12:06 am
I had to troubleshoot it a bit, but it works for me.

You might want to check your web server and make sure you are not getting any errors for the jwplayer. I was getting a 404 on swf file. I ended up removing "lib" from line 21 in the html to "/jwplayer/jwplayer.flash.swf"
Posts: 18
Joined: Thu Oct 18, 2012 12:27 am
by dhid » Thu May 30, 2013 12:12 am
@mrlinux2u

Ahh brilliant - that fixed it!
Cheers!
Posts: 13
Joined: Wed Feb 06, 2013 3:23 pm
Location: UK
by mikec79 » Thu May 30, 2013 12:15 am
jacksonliam wrote:What's the cpu use streaming to one client?


top - 20:13:37 up 1:09, 1 user, load average: 0.01, 0.07, 0.06
Tasks: 72 total, 1 running, 71 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.0 us, 3.4 sy, 0.0 ni, 93.3 id, 0.0 wa, 0.0 hi, 0.3 si, 0.0 st
KiB Mem: 383752 total, 91228 used, 292524 free, 11676 buffers
KiB Swap: 102396 total, 0 used, 102396 free, 43692 cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2274 pi 20 0 20248 4824 2928 S 2.0 1.3 0:03.66 ffmpeg
2242 root 20 0 9720 3656 2672 S 1.6 1.0 0:03.07 crtmpserver
2294 pi 20 0 4672 1408 1024 R 1.3 0.4 0:00.87 top
2273 pi 20 0 59876 1092 764 S 1.0 0.3 0:01.63 raspivid
28
Posts: 18
Joined: Thu Oct 18, 2012 12:27 am
by rayui » Thu May 30, 2013 8:13 am
@recantha - You need ffmpeg compiled from source not for its newness but because Debian's is crippled without H264. The actual source code from github contains H264, which is why we use that.

Everyone else, thanks for trying it out! I've updated the instructions with your information for the benefit of future explorers. Thanks!
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
by znanev » Thu May 30, 2013 2:27 pm
Great work, @rayui!

I was streaming with VLC until this morning when I decided to try your method.

Everything works great. I had some troubles starting crtmpserver - it seems that it expects /var/log/crtmpserver to be present, so after creating this directory I managed to start it successfully.

I also wanted my stream to be accessible from outside the home network. So forwarding TCP port 1935 to the Raspberry Pi seems to do the trick.

My next goal is to find a way to view the stream from RasPi camera on an Android device.
Posts: 6
Joined: Fri Oct 19, 2012 3:22 pm
by rayui » Thu May 30, 2013 2:58 pm
Thanks @znanev! Really nice to hear this is working for people. I've added your suggestion about creating the log directory to the instructions.
Posts: 13
Joined: Wed Oct 10, 2012 5:07 pm
Location: London
by texy » Sat Jun 01, 2013 7:25 am
This is working a treat - many thanks.
As I downloaded and copied jwplayer via my windows laptop, I had to chmod some files on the pi, otherwise the browser would show a black screen, apart from that I had no problems.
Compiling ffmpeg take some time ;-)

Any way of this method being used in IOS devices?

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555
Forum Moderator
Forum Moderator
Posts: 4365
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by towolf » Sat Jun 01, 2013 8:28 am
> Any way of this method being used in IOS devices?

ffmpeg is capable of shuffling video to multiple outputs. So you could combine the RTMP streaming to flash with segmented HLS for iOS all from one ffmpeg process that reads stdin from raspicam.
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm