[Libav-user] RTMP output issue

william keeling williamkeeling at hotmail.com
Wed May 6 16:57:27 EEST 2020


all URLs are output; my program (rcam <URL>) uses pi cameras and I2S microphones to create FLV container:

this creates a working local file:
/userland/build/bin/rcam file:test.flv

this works but results in a stream that is constantly buffering:
/userland/build/bin/rcam rtmp://a.rtmp.youtube.com/live2/<streamkey>

and this works without issue:
/userland/build/bin/rcam pipe:1 | ffmpeg -i - -acodec copy -vcodec copy -f flv rtmp://a.rtmp.youtube.com/live2/<streamkey>

The code below is the format context setup from rcam.

I hope this answers your questions



________________________________
From: Libav-user <libav-user-bounces at ffmpeg.org> on behalf of Jack Waller <ffmpeg at gmail.com>
Sent: Wednesday, May 6, 2020 12:53 AM
To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user at ffmpeg.org>
Subject: Re: [Libav-user] RTMP output issue



On Tue, May 5, 2020 at 10:42 PM william keeling <WilliamKeeling at hotmail.com<mailto:WilliamKeeling at hotmail.com>> wrote:

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/<http://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?


Please show the full example ffmpeg options to reproduce your issue,

You mentioned many URLs in your question. Which URL is input url,, and which URL is output url?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200506/a53ded97/attachment.html>


More information about the Libav-user mailing list