[Libav-user] RTMP output issue
william keeling
WilliamKeeling at hotmail.com
Tue May 5 17:42:11 EEST 2020
I have an issue that has me stumped. I have written a program than creates a flash video container (H.264 video and AAC audio streams) and writes it to a URL. If the URL is a file it is and playable and uploadable with no issues. But if the URL is a RTMP then it is stream but with buffering waits. But if the URL is pipe:1 passed to ffmpeg -i - -acodec copy -vcodec copy -f flv rtmp://a.rtmp.youtube.com/live2/<key> works just fine.
Here is the setup code:
int status=0;
// setup format context and io context
// tried with and without avformat_network_init();
// avformat_network_init();
if ((status = avio_open(&io_ctx, filename, AVIO_FLAG_WRITE)))
{
fprintf(stderr, "Could not open output file '%s' (error '%s')\n", filename, av_err2str(status));
return -1;
}
avformat_alloc_output_context2(&flv_frmtctx, NULL, "flv", NULL);
if (!flv_frmtctx)
{
fprintf(stderr, "Could not allocate output format context\n");
return -1;
}
flv_frmtctx->pb = io_ctx;
if (!(flv_frmtctx->url = av_strdup(filename)))
{
fprintf(stderr, "Could not copy url.\n");
return -1;
}
The I understand the FFMPEG command is just a passthru with just copy of both streams and no changes to either stream or container but it streams just fine.
So any ideas what I am doing wrong or missing in my code that is being done by FFMPEG?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200505/734a2da0/attachment.html>
More information about the Libav-user
mailing list