[Libav-user] RTMP output issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] RTMP output issue

william keeling

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?

 

 



_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: RTMP output issue

avcoder


On Tue, May 5, 2020 at 10:42 PM william keeling <[hidden email]> 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/<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?

 

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: RTMP output issue

william keeling
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 <[hidden email]> on behalf of Jack Waller <[hidden email]>
Sent: Wednesday, May 6, 2020 12:53 AM
To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <[hidden email]>
Subject: Re: [Libav-user] RTMP output issue
 


On Tue, May 5, 2020 at 10:42 PM william keeling <[hidden email]> 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/<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?

 

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".