<div dir="ltr">I am trying to use ffmpeg libav, and have been doing a lot of experiment last 1 month. 
I have not been able to get through. Is it really difficult to use FFmpeg?<br>
<br>
My requirement is simple as below.<br>
Can you please guide me if ffmpeg is suitable one or I have implement<br>
on my own (using codec libs available).<br>
<br>
1. I have a webm file (having VP8 and OPUS frames)<br>
2. I will read the encoded data and send it to remote guy<br>
3. The remote guy will read the encoded data from socket<br>
4. The remote guy will write it to a file (can we avoid decoding).<br>
5. Then remote guy should be able to pay the file using ffplay or any player.<br>
<br>
<br>
<br>
Now I will take a specific example.<br>
1. Say I have a file small.webm, containing VP8  and OPUS frames.<br>
<br>
2. I am reading only audio frames (OPUS) using av_read_frame api (Then<br>
checks stream index and filters audio frames only)<br>
<br>
3. So now I have data buffer (encoded) as packet.data and encoded data<br>
buffer size as packet.size (Please correct me if wrong)<br>
<br>
4. Here is my first doubt, everytime audio packet size is not same,<br>
why the difference. Sometimes packet size is as low as 54 bytes and<br>
sometimes it is 420 bytes. For OPUS will frame size vary from time to<br>
time?<br>
<br>
5. Next say somehow extract a single frame (really do not know how to<br>
extract a single frame) from packet and send it to remote guy.<br>
<br>
6. Now remote guy need to write the buffer to a file. To write the<br>
file we can use av_interleaved_write_frame or av_write_frame api. Both<br>
of them takes AVPacket as argument. Now I can have a AVPacket, set its<br>
data and size member. Then I can call av_write_frame api. But that<br>
does not work. Reason may be one should set other members in packet<br>
like ts, dts, pts etc. But I do not have such informations to set.<br>
<br>
<br>
Can somebody help me to learn if FFmpeg is the right choice, or should<br>
I write a custom logic like parse a opus file and get frame by frame.</div>