安装配置Red5 Server 1.0 RC1 (一)中提到过一个Publisher 工具,非常好用。但是Red5官方一直没更新,只能使用flv和nellymoser编码。而现在大多使用H.264和Speex了。
近期为了方便调试,修改了下源码,可以在https://github.com/illuspas/Red5-Publisher找到。
直接使用Flash builder 4.6导入项目即可。
也可以直接下载release.zip使用
直接打开:http://www.nodemedia.cn/uploads/files/Red5-Publisher.swf
作者: aliang
使用FFmpeg连接rtmp时发送自定义AMF DATA
在使用flash cs/builder开发rtmp视频应用时,我们时常会在nc.connect的时候再传递一个对象作为连接信息发送给服务端。用于验证,确认连接用户,获取用户信息等等操作。
当我们使用ffmpeg来开发android,ios,pc版的rtmp应用时,已经为我们提供了非常方便的传参来实现。
先来看源代码:定位到libavformat/rtmpproto.c文件 继续阅读“使用FFmpeg连接rtmp时发送自定义AMF DATA”
Android,IOS平台上x264编码实时视频参数设置与优化
移动设备上的H.264实时视频编码,需要考虑到cpu占用与带宽这2个限制因素,使用X264软编码,开启neon指令集优化,即使是在arm处理器下,依然可以通过优化配置达到满意的性能.
以下测试环境 一段352×288@15fps的视频,模拟摄像头采集到的数据。ipod touch4 和昨天编译出的X264:
Touch-future:~ root# ./x264 -o video_1.h264 video_1.y4m –profile baseline –preset ultrafast –fps 15
baseline
ultrafast
encoded 467 frames, 48.17 fps, 865.45 kb/s 3368054(压缩后的文件大小,单位字节) 继续阅读“Android,IOS平台上x264编码实时视频参数设置与优化”
开启neon编译iOS版X264
我的测试环境 Xcode 4.6 iPod Touch 4
1 2 |
Touch-future:~ root# uname -a Darwin Touch-future 11.0.0 Darwin Kernel Version 11.0.0: Sun Apr 8 21:51:26 PDT 2012; root:xnu-1878.11.10~1/RELEASE_ARM_S5L8930X iPod4,1 arm N81AP Darwin |
设置环境变量
1 2 3 4 |
export CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc export AS='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' export CFLAGS='-arch armv7' export LDFLAGS='-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system/ -arch armv7' |
配置
1 |
./configure --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/ --host=arm-apple-darwin --enable-static --enable-strip --disable-avs --chroma-format=420 --enable-pic --disable-opencl |
使用C++进行Android NDK开发,引入FFmpeg头文件的注意事项
第一个问题:
1 2 3 4 |
error: undefined reference to 'av_register_all()' error: undefined reference to 'avcodec_register_all()' error: undefined reference to 'avformat_network_init()' ^^^^^^^^^^ |
这类错误,解决方法: 继续阅读“使用C++进行Android NDK开发,引入FFmpeg头文件的注意事项”
Android环境 多核CPU x264编码性能测试
根据上一篇交叉编译支持多线程的Android版X264库
编译出了armv7 neon指令优化并开启多线程的x264执行程序
结果怎么样呢
测试环境:
MT6589, 联发科的4核处理器,比红米手机 MT6589T在CPU频率上低一点,这款是1.2GHz的 继续阅读“Android环境 多核CPU x264编码性能测试”
交叉编译支持多线程的Android版X264库
第一步,制作独立交叉编译链,我使用ndkr9制作的, 使用API 9平台,gcc4.6
进入ndk目录,执行
1 |
$ ./build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=/home/aliang/arm-linux-androideabi |
第二部,修改x264的configure 继续阅读“交叉编译支持多线程的Android版X264库”
FFmpeg 生成.h264文件
今天编译了raspberry pi 的一个例子hello_video
可以解码.h264文件输出到显示器
使用ffmpeg生成这种无容器的 raw H.264格式
1 |
ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.h264 |
就是将mp4这类 length prefixed mode 转为 start code prefixed mode
另外,pi的硬解码性能确实不错,播放1080P的视频非常流畅,GPU加速,几乎不占CPU
Android基于OpenSL ES,Speex,RTMP的Voip客户端实现
之前有个基于java和jni共同实现的版本,juv需要授权,语音数据在java层和jni层不停互转。
这个版本,完全在jni层实现,java只处理方法调用和事件回调。
OpenSL ES,从API 9开始支持的技术,通过这个标准,Android已经完全可以在native层采集和播放音频。 继续阅读“Android基于OpenSL ES,Speex,RTMP的Voip客户端实现”
编译windows版nginx-rtmp-module
准备工作
要在 Microsoft Win32??平台上编译Nginx你需要:
- Microsoft Visual C compiler. Microsoft Visual Studio??8 and 10 are known to work.(用来编译)
- MSYS.(执行配置脚本)
- Perl, if you want to build OpenSSL??and nginx with SSL support. For example?ActivePerl?or?Strawberry Perl.(注意这里不能使用MSYS的perl)
- Mercurial?client.(通过HG下载最新源码)
- PCRE,?zlib?and?OpenSSL?libraries sources.(PCRE用来重写url,zlib支持页面压缩,这里编译rtmp模块,必须编译出openssl)
- win32版nginx-rtmp-module模块源代码
编译步骤
在开始之前,你需要将Perl,Mercurial,MSYS bin目录加入PATH环境变量,也就是打开cmd,输入perl,hg,bash不会提示找不到命令.运行vcvarsall.bat或者叫Visual Studio命令提示(2010). 继续阅读“编译windows版nginx-rtmp-module”