资源简介
rtmpdump实现flv视频推流demo程序
代码片段和文件信息
#include
#include
#include
#include
#ifndef WIN32
#include
#endif
#include “librtmp/rtmp_sys.h“
#include “librtmp/log.h“
#define HTON16(x) ((x>>8&0xff)|(x<<8&0xff00))
#define HTON24(x) ((x>>16&0xff)|(x<<16&0xff0000)|(x&0xff00))
#define HTON32(x) ((x>>24&0xff)|(x>>8&0xff00)|\
(x<<8&0xff0000)|(x<<24&0xff000000))
#define HTONTIME(x) ((x>>16&0xff)|(x<<16&0xff0000)|(x&0xff00)|(x&0xff000000))
#define RTMP_SERVER_URL “rtmp://172.16.1.65:1935/test1/myStream“
#define LOCAL_FILE “test.flv“
/*read 1 byte*/
int ReadU8(uint32_t *u8FILE*fp){
if(fread(u811fp)!=1)
return 0;
return 1;
}
/*read 2 byte*/
int ReadU16(uint32_t *u16FILE*fp){
if(fread(u1621fp)!=1)
return 0;
*u16=HTON16(*u16);
return 1;
}
/*read 3 byte*/
int ReadU24(uint32_t *u24FILE*fp){
if(fread(u2431fp)!=1)
return 0;
*u24=HTON24(*u24);
return 1;
}
/*read 4 byte*/
int ReadU32(uint32_t *u32FILE*fp){
if(fread(u3241fp)!=1)
return 0;
*u32=HTON32(*u32);
return 1;
}
/*read 1 byteand loopback 1 byte at once*/
int PeekU8(uint32_t *u8FILE*fp){
if(fread(u811fp)!=1)
return 0;
fseek(fp-1SEEK_CUR);
return 1;
}
/*read 4 byte and convert to time format*/
int ReadTime(uint32_t *utimeFILE*fp){
if(fread(utime41fp)!=1)
return 0;
*utime=HTONTIME(*utime);
return 1;
}
int InitSockets()
{
/*
WORD version;
WSADATA wsaData;
version=MAKEWORD(22);
return (WSAStartup(version &wsaData) == 0);
*/
return 1;
}
void CleanupSockets()
{
// WSACleanup();
return;
}
//Publish using RTMP_SendPacket()
int publish_using_packet(){
RTMP *rtmp=NULL;
RTMPPacket *packet=NULL;
uint32_t start_time=0;
uint32_t now_time=0;
uint32_t add_time_times=0;
//the timestamp of the previous frame
long pre_frame_time=0;
long lasttime=0;
//int bNextIsKey=1;
uint32_t preTagsize=0;
//packet attributes
uint32_t type=0;
uint32_t datalength=0;
uint32_t timestamp=0;
uint32_t streamid=0;
FILE*fp=NULL;
fp=fopen(LOCAL_FILE“rb“);
if (!fp){
RTMP_LogPrintf(“Open File Error.\n“);
CleanupSockets();
return -1;
}
/* set log level */
//RTMP_LogLevel loglvl=RTMP_LOGDEBUG;
//RTMP_LogSetLevel(loglvl);
if (!InitSockets()){
RTMP
- 上一篇:H3C网络学院 路由交换第一卷下册高清版
- 下一篇:人头检测样本
相关资源
- Rtmp流生成MP4文件源码
- 超低延迟RTSP/RTMP/HTTP播放器实测小于
- 将rtmp流保存成MP4或者flv格式视频参考
- 浏览器 m3u8&flv格式播放器 封装
- 安卓 rtmp推流+录屏+远程控制
- flv -flv.js 测试 demo
- rtmp流媒体播放
- easystream
- RTMP推流RTSP视频
- Qt基于librtmp推送H.264
- H265(ffmpeg_and_nginx-rtmp).7z
- Easydarwin的RTSP和RTMP视频流媒体服务的
- flv解析h264
- h5stream安装程序与API中文手册-rtmprts
- 国标28181转rtsp/rtmp/webrtc/hls/flv
- OBS+NGINX 实现rtmp直播推流.zip
- 直播系统开发 基于Nginx与Nginx-rtmp-mo
- 直播系统开发:基于Nginx与Nginx-rtmp-
- QT + ffmpeg 播放 rtsprtmpudp视频流
- 网友做的一个FLV文件查看工具
- rtmp协议抓包分析
- 前端在线播放flv视频
- linux环境rtmp推流
- apache支持MP4flv模块mod_flvx.so和mod_h264
- rtmp_scuess.rar
- rtmpdump实现rtmp视频拉流存储的demo程序
- 使用nginx与nginx-rtmp-module搭建流媒体服
- rtmp 协议规范 中文版
- video-js rtmp播放 swf文件低延迟自编译文
- eWebEditor7.0破解版,实现粘贴图片自
评论
共有 条评论