If you want to use an url protocol to output your encoded media (e.g. tcp://hostname:port) follow these instructions:
- open your favourite media format as you would open it with a file:
AVOutputformat *aof = guess_format ("avi", NULL, NULL);
- Use url_open () instead of url_fopen () and pass it an URLContext pointer and your url :
url_open (url_context, "tcp://hostname:port", URL_WRONLY);
- Use url_open_dyn_buf on ByteIOContext of your AVFormatContext
url_open_dyn_buf (&format_context -> pb)
- Write your header:
av_write_header( ... )
- Send it to your url:
guchar *pb_buffer; int len = url_close_dyn_buf(format_context -> pb, (unsigned char **)(&pb_buffer)); url_write (url_context, (guchar *)pb_buffer, len);
Do the same with av_write_frame:
- Use url_open_dyn_buf() on ByteIOContext of your AVFormatContext
url_open_dyn_buf (&format_context -> pb)
- write your header:
av_write_frame( ... )
- Send it to your url:
guchar *pb_buffer; int len = url_close_dyn_buf(format_context -> pb, (unsigned char **)(&pb_buffer)); url_write (url_context, (guchar *)pb_buffer, len);