V2EX Zoozy
Zoozy

Zoozy

V2EX 第 5250 号会员,加入于 2011-01-14 22:26:48 +08:00
NULL
根据 Zoozy 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
Zoozy 最近回复了
2023-04-14 12:10:34 +08:00
回复了 wodong 创建的主题 程序员 大疆 PSDK 获取视频流技术求助
在这个函数中,您需要使用 RTMP 协议将 H264 编码的裸流数据推送到 RTMP 服务器上,以便在视频播放器中显示。

以下是可能的实现方式:

```c++
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <sstream>

#include "librtmp/rtmp.h"

#define RTMP_HEAD_SIZE (sizeof(RTMPPacket)+RTMP_MAX_HEADER_SIZE)

static void LiveviewConvertH264ToRgbCallback(E_DjiLiveViewCameraPosition position, const uint8_t* buf, uint32_t bufLen) {

static RTMP *rtmp = NULL;
static char *url = "rtmp://your-rtpm-server-url.com/live/stream";
static int fps = 30;
static int width = 1280;
static int height = 720;

if (!rtmp) {
rtmp = RTMP_Alloc();
RTMP_Init(rtmp);
rtmp->Link.timeout = 5; // Timeout in seconds
RTMP_SetupURL(rtmp, url);
RTMP_EnableWrite(rtmp);
RTMP_SetBufferMS(rtmp, 3600*1000); // Set the buffer size to 1 hour
if (!RTMP_Connect(rtmp, NULL) || !RTMP_ConnectStream(rtmp, 0)) {
RTMP_Free(rtmp);
rtmp = NULL;
std::cerr << "Failed to connect to RTMP server" << std::endl;
return;
}
}

// Create and initialize RTMP packet
RTMPPacket packet = {0};
RTMPPacket_Alloc(&packet, bufLen + RTMP_HEAD_SIZE);

packet.m_packetType = RTMP_PACKET_TYPE_VIDEO;
packet.m_nChannel = 0x04;

// Fill in the packet headers
char *data_ptr = packet.m_body;
data_ptr[0] = 0x17; // Video codec id: 7 (AVC)
data_ptr[1] = 0x01; // AVCPacketType: 1 (NALU without length field)
*((uint32_t *)(data_ptr + 2)) = 0x01000000; // Composition time offset: 0
std::memcpy(data_ptr + 6, buf, bufLen);

packet.m_nTimeStamp = RTMP_GetTime() - RTMP_GetStartTime(rtmp);
packet.m_nBodySize = bufLen + 5;

if (!RTMP_SendPacket(rtmp, &packet, TRUE)) {
std::cerr << "Failed to send packet to RTMP server" << std::endl;
}

// Free memory used by packet
RTMPPacket_Free(&packet);
}
```
在此实现中,我们使用 librtmp 库来完成 RTMP 协议的推流。在函数中的第一个参数 position 未被使用,因为它不需要对这个问题产生任何影响。

该代码假定你已经熟练掌握了 RTMP 协议和使用方法,并且服务器配置正确。

by gpt
"hms://redirect_url"
curl ip.sb
已经两个小时了 售后 VIP 群没人理 服气
2017-06-13 13:04:22 +08:00
回复了 koor 创建的主题 全球工单系统 京东自营 48 小时还没收到,什么情况!!
@ArthurKing 请原谅我。。笑出声。。。。
如果可以的话能说说 toB 怎么盈利的吗?
2016-05-08 01:49:59 +08:00
回复了 nonfu 创建的主题 PHP Laravel 推出 Mac 版极简主义开发环境 Valet
valet n. 贴身男仆;用车的人;伺候客人停车
啧啧啧~
关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5383 人在线   最高记录 6679       Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 12ms UTC 07:45 PVG 15:45 LAX 00:45 JFK 03:45
Do have faith in what you're doing.
ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86