[英]Transport SEI With Ffmpeg
I need to transport some data from drone through the help of Ffmpeg.The data includes frame data and some other parameters such as the timing roll/pitch/height/direction of the drone,and when I get the image of the frame,the corresponding parameters should be also pulled out,So I dicede to send these parameters as SEI. 我需要通过Ffmpeg来从无人机上传输一些数据。这些数据包括帧数据和其他一些参数,例如无人机的定时滚动/俯仰/高度/方向,以及当我获得帧图像时,相应的参数也应该被拉出,所以我切丁将这些参数作为SEI发送。 Then the questions coming,after sending sps pps,I send my own SEI packet,eg:
然后问题来了,在发送sps pps之后,我发送了自己的SEI数据包,例如:
if(pkt->size>10&&pkt->data[0] ==0
&&pkt->data[1] ==0
&&pkt->data[2] ==0
&&pkt->data[3] ==1
&&(pkt->data[4] == 103 || pkt->data[4] == 104)){
i++;
}
AVPacket *newPacket = nullptr;
// 0 0 0 1 6 8*16
if(i == 2){
i = 0;
newPacket = (AVPacket *)av_malloc(sizeof(AVPacket));
av_init_packet(newPacket);
newPacket->data = new uint8_t[8];
newPacket->data[0] = 0;
newPacket->data[1] = 0;
newPacket->data[2] = 0;
newPacket->data[3] = 1;
newPacket->data[4] = 6;
newPacket->data[5] = 123;
newPacket->data[6] = 134;
newPacket->data[7] = 128;
newPacket->size = 8;
}
av_write_frame(*it , pkt);
av_free_packet(pkt);
if(newPacket){
av_write_frame(*it , newPacket);
av_free_packet(newPacket);
}
But,At the receiving terminate,I only find the API:av_read_frame.The API just decode every complete frame from AVFormatContext.My SEI go nothing! 但是,在接收终止时,我只找到API:av_read_frame。API只是从AVFormatContext解码每个完整的帧。我的SEI毫无用处! Besides,I also trying to put my parameters in side_data or metadate of AVFrame,but after rtp tansporting,received AVFrame's side_data and metadata is 0x00 again.
此外,我还尝试将参数放入AVFrame的side_data或metadate中,但是在rtp tansporting之后,收到的AVFrame的side_data和元数据再次为0x00。 Could someone give me some train of thought?
有人可以给我一些思路吗?
At the receiving terminal, did you check if the AVPackets you obtained using av_read_frame() has your SEI message on their data? 在接收终端,您是否检查过使用av_read_frame()获得的AVPackets的数据上是否包含SEI消息? My approach to save SEI for each frame was similiar to yours except the encoding part.
除编码部分外,我为每一帧保存SEI的方法与您的相似。 My steps are:
我的步骤是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.