How to convert the AVPacket of ffmpeg to the webm stream with c++ code?

256 views Asked by At

I am confused how to convert the ffmpeg AVPacket to a living stream in order to I can play it with HTML5.

I have already got the AVPacket of ffmpeg with avcodec_encode_video2

AVPacket pkt_;    
ret = avcodec_encode_video2(c_, &pkt_, picture_, &got_frame);

And I also know how to dump the packet to webM file.

file_.write(reinterpret_cast<char *>(&(pkt_.size)), sizeof(int));
file_.write(reinterpret_cast<char *>(&timestamp), sizeof(uint64_t));
file_.write(reinterpret_cast<char *>(pkt_.data), pkt_.size);

But, How can I create a stream server with the packets for front-end playing?

0

There are 0 answers