gpt4 book ai didi

c++ - 需要知道如何通过读取 H265 视频向 vlc 发送 Rtp 数据包

转载 作者:行者123 更新时间:2023-12-04 23:19:40 25 4
gpt4 key购买 nike

我正在尝试将 rtp 数据包发送到 vlc 以播放 h265 mp4 文件我从 ffmpeg 源代码导出数据包格式

      uint8_t nal_type = (buf[0] >> 1) & 0x3F;
/*
* create the HEVC payload header and transmit the buffer as fragmentation units (FU)
*
* 0 1
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |F| Type | LayerId | TID |
* +-------------+-----------------+
*
* F = 0
* Type = 49 (fragmentation unit (FU))
* LayerId = 0
* TID = 1
*/
s->buf[0] = 49 << 1;
s->buf[1] = 1;

/*
* create the FU header
*
* 0 1 2 3 4 5 6 7
* +-+-+-+-+-+-+-+-+
* |S|E| FuType |
* +---------------+
*
* S = variable
* E = variable
* FuType = NAL unit type
*/
s->buf[2] = nal_type;
/* set the S bit: mark as start fragment */
s->buf[2] |= 1 << 7;
但我得到的只是像下面这样的乱码
enter image description here
我所看到的只是一张仍然乱码的图像。我在代码中添加了一些 header 用于时间戳和其他内容,我正在从 5 位置打包 buf,不包括起始代码

最佳答案

s->buf[0] = 49 << 1;
写入整个字节。根据您的描述,您只需要编写这 3 位。我希望这能奏效:
s->buf[0] &= ~14; // 14 is 1110b. unset those bits
s->buf[0] |= 49 << 1; // 'or' in your value
您需要对第二个和第三个字节进行相同的修复。

关于c++ - 需要知道如何通过读取 H265 视频向 vlc 发送 Rtp 数据包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69209427/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com