I'm building a program (I want to use libavformat not ffmpeg executable) to stream live video to Icecast server and it looks like FFmpeg should be able to do it. I can write the live video to a file (which is not really simple to begin with :) ) but I can't find simple code / example to how to use avformat/avio to write to Icecast (network) mount point. Any pointers to example code would be appreciated.
Actually it was easy. You just open the output URL as this where "xxx:yyy" is the user and the password for the mount :
const char *outputfile = "icecast://xxx:[email protected]:8000/xyz.mkv";
out_format = av_guess_format(NULL, outputfile, NULL);
You might need to set the content type:
av_dict_set(&out_options, "content_type", "video/x-matroska", 0);
Then you just open the URL:
avio_open2(&out_fctx->pb, outputfile, AVIO_FLAG_WRITE, NULL, &out_options) < 0);
It's tested and working.