官方原帖

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=45368&sid=b81f6551e478f0f6e172aa40e31ee179

安装 crtmpserver服务

sudo aptitude install crtmpserver

添加 crtmpserver日志文件

sudo mkdir /var/log/crtmpserver

配置crtmpserver服务环境

sudo nano /etc/crtmpserver/applications/flvplayback.lua

修改以下几行 保存退出

validateHandshake=false,
keyframeSeek=false,
seekGranularity=0.1
clientSideBuffer=30

重启  crtmpserver 服务

sudo /etc/init.d/crtmpserver restart

安装编译 ffmpeg ,系统的ffmpeg自带的不支持H264编码的flash 流,需要下载支持的ffmpeg编译,这个部分编译时间比较长,也是重要的一个步骤。

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

我编译好的包 http://urlxf.qq.com/?j6feUrQ ,下载解压到 可以省很多时间

sudo make install

实现摄像头数据转实现RTMP,官方时间用-1有错误提示,下面更正了

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

树莓派安装web(nginx)服务器

http://yujianxuechuan.blog.163.com/blog/static/2174560072013511103620861/

视频输出

下载jwplayer

sudo ln -s /usr/share/nginx/www  /var

cd /var/www

wget http://account.longtailvideo.com/static/download/jwplayer-6.5.zip

或者

wget https://www.dropbox.com/s/bfgr7146u3g7kf7/jwplayer-6.5.zip

解压
sudo unzip jwplayer-6.5.zip -d /var/www

sudo mkdir /var/www/720p

sudo nano /var/www/720p/index.php

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OV5647 Webcam Live 720p (1280 x 720 progressive scan)</title>
</head> <body> <!-- Code for WebCam START -->
<div id="video-jwplayer_wrapper" style="position: relative; display: block; width: 1280px; height: 720px;margin:auto ">
<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: 1280
, height: 720
, player: {
modes: {
linear: {
controls:{
stream:{
manage:false
, enabled: false
}
}
}
}
}
, shows: {
streamTimer: {
enabled: true
, tickRate: 100
}
}
});
</script> <!-- Code for WebCam END --> <br>
</body>
</html>
当前CPU温度:
<?php
$temp = intval(file_get_contents("/sys/class/thermal/thermal_zone0/temp")); // read the file as a string[file_get_contents()], and convert to an int [intval()]so we can do math functions with it
$color = "#060"; // default colour
if($temp >= 60000) { $color = "#F00"; } //set to red if over 60 degrees (is in milliDegrees)
elseif($temp >= 50000) { $color = "#FC0"; } // set to yellow if over 50 degrees
echo "<span style=\"color:".$color.";\">".($temp/1000)."&deg;C / ".(($temp/1000)+271.15)."K</span>";
?>
<br />
当前CPU主频:
<?php
$freq = intval(file_get_contents("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"));
echo ($freq/1000)."MHz"; // covert to MHz from kHz
?>
<br />
运行时间:
<?php
// Grab uptime output
$uptime_array = explode(" ", exec("cat /proc/uptime"));
$seconds = round($uptime_array[0], 0);
$minutes = $seconds / 60;
$hours = $minutes / 60;
$days = floor($hours / 24);
$hours = floor($hours - ($days * 24));
$minutes = floor($minutes - ($days * 24 * 60) - ($hours * 60));
$seconds = floor($seconds - ($days * 24 * 60 * 60) - ($hours * 60 * 60) - ($minutes * 60));
$uptime_array = array($days, $hours, $minutes, $seconds);
$uptime = ($days . " days " . $hours . " hours " . $minutes . " minutes" );
echo $uptime; ?>
<br />
系统时间:
<?php
// Get the Time
$time = (exec("date +'%d %b %Y - %T %Z'"));
echo $time; ?>
<br /> <!-- Network-Data: -->
获取网络数据:
<?php
// Get Network-Data
$RX = (exec("ifconfig wlan0 | grep 'RX bytes'| cut -d: -f2 | cut -d' ' -f1"));
$TX = (exec("ifconfig wlan0 | grep 'TX bytes'| cut -d: -f3 | cut -d' ' -f1"));
echo $RX; $TX; ?>
<br />
<br>
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$hostaddress = gethostbyaddr($ip);
$browser = $_SERVER['HTTP_USER_AGENT'];
$referred = $_SERVER['HTTP_REFERER']; // a quirky spelling mistake that stuck in php print "<strong>IP地址:</strong><br />\n";
print "$ip<br /><br />\n";
print "<strong>主机地址:</strong><br />\n";
print "$hostaddress<br /><br />\n";
print "<strong>浏览器信息:</strong>:<br />\n";
print "$browser<br /><br />\n";
print "<strong>Where you came from, if you clicked on a link to get here</strong>:<br />\n";
if ($referred == "") {
print "Page was directly requested";
}
else {
print "$referred";
}
?>
<br />

保存退出

Ctrl+O
Enter
Ctrl+X

# start the streaming process 720p at bitrate of cca 448.6kbits/s
-------------------------------------------------------------------------------------------------------------------------------------------------------------
raspivid -t -0 -w 1280 -h 768 -fps 25 -b 500000 -o - | ffmpeg -i - -vcodec copy -an -f flv -metadata streamName=myStream tcp://0.0.0.0:6666

-------------------------------------------------------------------------------------------------------------------------------------------------------------
# start the streaming process 720p at bitrate of cca 1671.0kbits/s
-------------------------------------------------------------------------------------------------------------------------------------------------------------
raspivid -t -0 -w 1280 -h 720 -fps 25 -b 2000000 -o - | ffmpeg -i - -vcodec copy -an -f flv -metadata streamName=myStream tcp://0.0.0.0:6666

it should look like this:
pi@RPi ~ $ raspivid -t -0 -w 1920 -h 1080 -fps 25 -b 2000000 -o - | ffmpeg -i - -vcodec copy -an -f flv -metadata streamName=myStream tcp://0.0.0.0:6666
ffmpeg version N-54897-g7dc7761 Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 23 2013 14:58:53 with gcc 4.6 (Debian 4.6.3-14+rpi1)
configuration:
libavutil 52. 40.100 / 52. 40.100
libavcodec 55. 19.100 / 55. 19.100
libavformat 55. 12.102 / 55. 12.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 81.102 / 3. 81.102
libswscale 2. 4.100 / 2. 4.100
libswresample 0. 17.103 / 0. 17.103
Input #0, h264, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 1920x1080, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Output #0, flv, to 'tcp://0.0.0.0:6666':
Metadata:
streamName : myStream
encoder : Lavf55.12.102
Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 1920x1080, q=2-31, 25 fps, 1k tbn, 1200k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
frame=103030 fps= 25 q=-1.0 size= 840608kB time=01:08:41.16 bitrate=1671.0kbits/s

http://192.168.0.2/720p is where you can view your camera
for outside (internet), you need to open port 1935 and 80 to your RPi
if you have two or more cameras, only one can be accessed from internet :(

------------------------------------------------------------------------------------------------------------------------------------------------------------
# for some stats install Webalizer for Raspberry Pi
------------------------------------------------------------------------------------------------------------------------------------------------------------
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=22519

sudo apt-get install webalizer

------------------------------------------------------------------------------------------------------------------------------------------------------------
# back up /etc/webalizer/webalizer.conf file
------------------------------------------------------------------------------------------------------------------------------------------------------------
sudo cp /etc/webalizer/webalizer.conf /etc/webalizer/webalizer.conf.bakORIGINAL

------------------------------------------------------------------------------------------------------------------------------------------------------------
# edit /etc/webalizer/webalizer.conf to read the correct logfile
------------------------------------------------------------------------------------------------------------------------------------------------------------
sudo nano /etc/webalizer/webalizer.conf
#######################################
/var/log/lighttpd/access.log

#LogFile /var/log/apache/access.log.1
LogFile /var/log/lighttpd/access.log
#######################################

sudo webalizer /var/log/lighttpd/access.log
or
sudo webalizer -c /etc/webalizer/webalizer.conf

http://192.168.0.2/webalizer

树莓派摄像头模块转成H264编码通过RTMP实现Html输出的更多相关文章

  1. 采集音频和摄像头视频并实时H264编码及AAC编码[转]

    0. 前言 我在前两篇文章中写了DirectShow捕获音视频然后生成avi,再进行264编码的方法.那种方法有一些局限性,不适合实时性质的应用,如:视频会议.视频聊天.视频监控等.本文所使用的技术, ...

  2. 采集音频和摄像头视频并实时H264编码及AAC编码

    转自:http://www.cnblogs.com/haibindev/archive/2011/11/10/2244442.html 0. 前言 我在前两篇文章中写了DirectShow捕获音视频然 ...

  3. 【嵌入式开发】树莓派+官方摄像头模块+VLC串流实时输出网络视频流

    sudo apt-get update sudo apt-get install vlc sudo raspivid -o - -t 0 -w 640 -h 360 -fps 25|cvlc -vvv ...

  4. H264编码 封装成MP4格式 视频流 RTP封包

    H264编码 封装成MP4格式 视频流 RTP封包         分类:             多媒体编程              2013-02-20 21:31     3067人阅读    ...

  5. Python实现树莓派摄像头持续录像并传送到主机

    关于树莓派,想必从事嵌入式开发的开发者都有听过,树莓派原名为Raspberry Pi,也就是它的英文读法,树莓派诞生于英国,由"Raspberry Pi 基金会"这个慈善组织注册开 ...

  6. Raspberry Pi 摄像头模块入门

    目录 一.摄像头模块安装 二.使用命令控制摄像头 三.使用Python程序控制摄像头 四.基于vlc的Raspberry Pi摄像头实时监控 参考资料 Raspberry Pi提供了摄像头模块的接口, ...

  7. JavaCV FFmpeg H264编码

    上次成功通过FFmpeg采集摄像头的YUV数据,这次针对上一次的程序进行了改造,使用H264编码采集后的数据. (传送门) JavaCV FFmpeg采集摄像头YUV数据 采集摄像头数据是一个解码过程 ...

  8. iOS音频AAC视频H264编码 推流最佳方案

    iOS音频AAC视频H264编码 推流最佳方案 项目都是个人的调研与实验,可能很多不好或者不对的地方请多包涵. 1    功能概况 *  实现音视频的数据的采集 *  实现音视频数据的编码,视频编码成 ...

  9. H264 编码详解

    H264 编码详解(收集转载) (1)       x264_param_default( x264_param_t *param ) 作用: 对编码器进行参数设定 cqm:量化表相关信息 csp: ...

随机推荐

  1. Hadoop集群搭建安装过程(二)(图文详解---尽情点击!!!)

    Hadoop集群搭建安装过程(二)(配置SSH免密登录)(图文详解---尽情点击!!!) 一.配置ssh无密码访问 ®生成公钥密钥对 1.在每个节点上分别执行: ssh-keygen -t rsa(一 ...

  2. 模块:js实现一个倒计时功能

    1.给显示内容加样式 <style> #p1{font-size: large; color: red;} </style> 2.客户端页面 <div id=" ...

  3. Dubbo 与 ImmutableList冲突解决

    在Java web实际开发中,常常用到微服务来进行架构分离,今天遇到一特奇怪的问题,Dububo 调用了接口三次,provider端而且没有抛出Exception.consumer却端抛出调用失败的异 ...

  4. 基于MVC4+EasyUI的Web开发框架经验总结

    http://www.cnblogs.com/wuhuacong/p/4093778.html 在很多Web系统中,一般都可能提供一些图标的选择,方便配置按钮,菜单等界面元素的图 标,从而是Web系统 ...

  5. 详细解说Java Spring的JavaConfig注解 【抄】

    抄自: http://www.techweb.com.cn/network/system/2016-01-05/2252188.shtml @RestController spring4为了更方便的支 ...

  6. cellmap for iphone

    说明:Cellmap的Iphone版本已经上架APP Store. 如需下载,可以登陆app store,然后搜索cellmap进行下载. 或者直接登陆以下地址下载: https://itunes.a ...

  7. IE9 使用document.getElementsByName("abc") 不能获取到名称相同SPAN元素

    <div name="abc"></div> <input name="abc" type="text" /& ...

  8. Redis 64 steps

    a memo for redis 64 operations start server in console: 1. D:\>cd redis64 2. D:\redis64>redis- ...

  9. Web 前端开发学习之路(入门篇)

    字数1374 阅读4622 评论0 喜欢49 以前学习过一段时间的web前端开发,整理了一些我看过的/我认为比较好的学习资料(网站.书籍).不要问我为啥没有进阶版,我只是一条产品汪而已,求轻喷.== ...

  10. Android 贝塞尔曲线库

    最近做的一个小项目需要绘制一些折线图,AChartEngine其实里面包含很多图,虽然是开源的,但毕竟不是自己写的,而且项目稍有点庞大,有些东西修改起来还是得花点时间的,所以最后打算自己写一个,参考了 ...