Re: [FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

2018-04-09 Thread Bodecs Bela



2018.04.08. 23:57 keltezéssel, Michael Niedermayer írta:

On Sun, Apr 08, 2018 at 05:27:56PM +0200, Bodecs Bela wrote:


2018.04.06. 0:39 keltezéssel, Michael Niedermayer írta:

On Fri, Mar 30, 2018 at 02:47:25PM +0200, Bodecs Bela wrote:

Hi All,

regularly, on different forums and mailing lists a requirement popups for a
feature to automatically failover switching between main input and a
secondary input in case of main input unavailability.

The base motivation: let's say you have a unreliable live stream source and
you
want to transcode its video and audio streams in realtime but you
want to survive the ocasions when the source is unavailable. So use a
secondary live source but the transition should occur seamlessly without
breaking/re-starting the transcoding processs.

Some days ago there was a discussion on devel-irc about this topic and we
concluded that this feature is not feasible inside ffmpeg without "hacking",
but a separate client app could do this.

So I created this example app to handle two separate input sources and
switching realtime between them. I am not sure wheter it should be inside
the tools subdir.

The detailed description is available in the header section of the source
file.

I will appretiate your suggestions about it.

Thank you in advance.

best,

Bela Bodecs


  configure|2
  doc/examples/Makefile|1
  doc/examples/Makefile.example|1
  doc/examples/alternative_input.c | 1233 
+++

You may want to add yourself to MAINTAINERS, so it is not unmaintained

ok
I have checked the MAINAINERS file but curretly there is no Examples 
section, I have created it.

I think this is complex enough that it needs a maintainer


May I take your response as you agree to inlcude this as an example app?

iam fine with either






[...]


+static int open_single_input(int input_index)
+{
+int ret, i;
+AVInputFormat *input_format = NULL;
+AVDictionary * input_options = NULL;
+AVFormatContext * input_fmt_ctx = NULL;
+
+if (app_ctx.input_format_names[input_index]) {
+if (!(input_format = 
av_find_input_format(app_ctx.input_format_names[input_index]))) {
+timed_log(AV_LOG_ERROR, "Input #%d Unknown input format: '%s'\n", 
input_index,
+  app_ctx.input_format_names[input_index]);
+return EINVAL;
+}
+}
+
+av_dict_set(_options, "rw_timeout", "200", 0);
+av_dict_set(_options, "timeout", "2000", 0);
+if ((app_ctx.input_fmt_ctx[input_index] = avformat_alloc_context()) < 0)
+return AVERROR(ENOMEM);

i guess this was intended to be "!= NULL"

yes, I will fix it

also you are mixing EINVAL with AVERROR(ENOMEM) these arent compatible.
Either all should be AVERROR or none

ok, should I will modify EIVAL all of them to AVERROR(EINVAL)?

yes

thx

[...]



Here is an updated version.

bb


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


From 7f23ad48dac2901b4eb1e7b40a90d716d5d54733 Mon Sep 17 00:00:00 2001
From: Bela Bodecs 
Date: Fri, 30 Mar 2018 14:30:25 +0200
Subject: [PATCH] [RFC]doc/examples: alternative input handler

API utility for automatic failover switching between main input and
secondary input in case of input unavailability.
Motivation: let's say you have a unreliable live stream source and you
want totranscode its first video and audio stream in realtime but you
want to survive the ocasions when the source is unavailable. So use a
secondary live source but the transition should occur seamlessly without
breaking/re-starting the transcoding processs.


Signed-off-by: Bela Bodecs 
---
 MAINTAINERS  |2 +-
 configure|2 +
 doc/examples/Makefile|1 +
 doc/examples/Makefile.example|1 +
 doc/examples/alternative_input.c | 1340 ++
 5 files changed, 1345 insertions(+), 1 deletion(-)
 create mode 100644 doc/examples/alternative_input.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 3c54ad6..f411d56 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -45,7 +45,7 @@ presets Robert Swain
 metadata subsystem  Aurelien Jacobs
 release management  Michael Niedermayer
 API tests   Ludmila Glinskih
-
+examplesBéla Bödecs
 
 Communication
 =
diff --git a/configure b/configure
index 0c5ed07..5585c60 100755
--- a/configure
+++ b/configure
@@ -1529,6 +1529,7 @@ EXAMPLE_LIST="
 transcoding_example
 vaapi_encode_example
 vaapi_transcode_example
+alternative_input_example
 "
 
 EXTERNAL_AUTODETECT_LIBRARY_LIST="
@@ -3337,6 +3338,7 @@ transcode_aac_example_deps="avcodec avformat swresample"
 transcoding_example_deps="avfilter 

Re: [FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

2018-04-08 Thread Michael Niedermayer
On Sun, Apr 08, 2018 at 05:27:56PM +0200, Bodecs Bela wrote:
> 
> 
> 2018.04.06. 0:39 keltezéssel, Michael Niedermayer írta:
> >On Fri, Mar 30, 2018 at 02:47:25PM +0200, Bodecs Bela wrote:
> >>Hi All,
> >>
> >>regularly, on different forums and mailing lists a requirement popups for a
> >>feature to automatically failover switching between main input and a
> >>secondary input in case of main input unavailability.
> >>
> >>The base motivation: let's say you have a unreliable live stream source and
> >>you
> >>want to transcode its video and audio streams in realtime but you
> >>want to survive the ocasions when the source is unavailable. So use a
> >>secondary live source but the transition should occur seamlessly without
> >>breaking/re-starting the transcoding processs.
> >>
> >>Some days ago there was a discussion on devel-irc about this topic and we
> >>concluded that this feature is not feasible inside ffmpeg without "hacking",
> >>but a separate client app could do this.
> >>
> >>So I created this example app to handle two separate input sources and
> >>switching realtime between them. I am not sure wheter it should be inside
> >>the tools subdir.
> >>
> >>The detailed description is available in the header section of the source
> >>file.
> >>
> >>I will appretiate your suggestions about it.
> >>
> >>Thank you in advance.
> >>
> >>best,
> >>
> >>Bela Bodecs
> >>
> >>
> >>  configure|2
> >>  doc/examples/Makefile|1
> >>  doc/examples/Makefile.example|1
> >>  doc/examples/alternative_input.c | 1233 
> >> +++
> >You may want to add yourself to MAINTAINERS, so it is not unmaintained
> ok
> >I think this is complex enough that it needs a maintainer
> >
> 
> May I take your response as you agree to inlcude this as an example app?

iam fine with either


> 
> 
> 
> >[...]
> >
> >>+static int open_single_input(int input_index)
> >>+{
> >>+int ret, i;
> >>+AVInputFormat *input_format = NULL;
> >>+AVDictionary * input_options = NULL;
> >>+AVFormatContext * input_fmt_ctx = NULL;
> >>+
> >>+if (app_ctx.input_format_names[input_index]) {
> >>+if (!(input_format = 
> >>av_find_input_format(app_ctx.input_format_names[input_index]))) {
> >>+timed_log(AV_LOG_ERROR, "Input #%d Unknown input format: 
> >>'%s'\n", input_index,
> >>+  app_ctx.input_format_names[input_index]);
> >>+return EINVAL;
> >>+}
> >>+}
> >>+
> >>+av_dict_set(_options, "rw_timeout", "200", 0);
> >>+av_dict_set(_options, "timeout", "2000", 0);
> >>+if ((app_ctx.input_fmt_ctx[input_index] = avformat_alloc_context()) < 
> >>0)
> >>+return AVERROR(ENOMEM);
> >i guess this was intended to be "!= NULL"
> yes, I will fix it

> >
> >also you are mixing EINVAL with AVERROR(ENOMEM) these arent compatible.
> >Either all should be AVERROR or none
> ok, should I will modify EIVAL all of them to AVERROR(EINVAL)?

yes

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

2018-04-08 Thread Bodecs Bela



2018.04.06. 0:39 keltezéssel, Michael Niedermayer írta:

On Fri, Mar 30, 2018 at 02:47:25PM +0200, Bodecs Bela wrote:

Hi All,

regularly, on different forums and mailing lists a requirement popups for a
feature to automatically failover switching between main input and a
secondary input in case of main input unavailability.

The base motivation: let's say you have a unreliable live stream source and
you
want to transcode its video and audio streams in realtime but you
want to survive the ocasions when the source is unavailable. So use a
secondary live source but the transition should occur seamlessly without
breaking/re-starting the transcoding processs.

Some days ago there was a discussion on devel-irc about this topic and we
concluded that this feature is not feasible inside ffmpeg without "hacking",
but a separate client app could do this.

So I created this example app to handle two separate input sources and
switching realtime between them. I am not sure wheter it should be inside
the tools subdir.

The detailed description is available in the header section of the source
file.

I will appretiate your suggestions about it.

Thank you in advance.

best,

Bela Bodecs


  configure|2
  doc/examples/Makefile|1
  doc/examples/Makefile.example|1
  doc/examples/alternative_input.c | 1233 
+++

You may want to add yourself to MAINTAINERS, so it is not unmaintained

ok

I think this is complex enough that it needs a maintainer



May I take your response as you agree to inlcude this as an example app?




[...]


+static int open_single_input(int input_index)
+{
+int ret, i;
+AVInputFormat *input_format = NULL;
+AVDictionary * input_options = NULL;
+AVFormatContext * input_fmt_ctx = NULL;
+
+if (app_ctx.input_format_names[input_index]) {
+if (!(input_format = 
av_find_input_format(app_ctx.input_format_names[input_index]))) {
+timed_log(AV_LOG_ERROR, "Input #%d Unknown input format: '%s'\n", 
input_index,
+  app_ctx.input_format_names[input_index]);
+return EINVAL;
+}
+}
+
+av_dict_set(_options, "rw_timeout", "200", 0);
+av_dict_set(_options, "timeout", "2000", 0);
+if ((app_ctx.input_fmt_ctx[input_index] = avformat_alloc_context()) < 0)
+return AVERROR(ENOMEM);

i guess this was intended to be "!= NULL"

yes, I will fix it


also you are mixing EINVAL with AVERROR(ENOMEM) these arent compatible.
Either all should be AVERROR or none

ok, should I will modify EIVAL all of them to AVERROR(EINVAL)?



thx

[...]



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

thank you,

bb

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

2018-04-06 Thread Bodecs Bela



2018.04.06. 1:34 keltezéssel, wm4 írta:

On Fri, 30 Mar 2018 14:47:25 +0200
Bodecs Bela  wrote:


Hi All,

regularly, on different forums and mailing lists a requirement popups
for a feature to automatically failover switching between main input and a
secondary input in case of main input unavailability.

The base motivation: let's say you have a unreliable live stream source
and you
want to transcode its video and audio streams in realtime but you
want to survive the ocasions when the source is unavailable. So use a
secondary live source but the transition should occur seamlessly without
breaking/re-starting the transcoding processs.

Some days ago there was a discussion on devel-irc about this topic and
we concluded that this feature is not feasible inside ffmpeg without
"hacking", but a separate client app could do this.

So I created this example app to handle two separate input sources and
switching realtime between them. I am not sure wheter it should be
inside the tools subdir.

The detailed description is available in the header section of the
source file.

I will appretiate your suggestions about it.

Thank you in advance.

best,

Bela Bodecs



Does this really quality as example? It's way too complex and seems to
be about a specific use case in place of ffmpeg.c, rather than
demonstrating API use in an educational way (what code examples are
supposed to do).

If someone wants to merge this, at least add it as top level program,
and not under the examples directory.

Thank you for your feedback.
Because on irc some said that other program can do this live switching, 
I only wanted to demonstrate that this feature is feasible based on ffmpeg.
As I wrote I am also not sure wheter it should be inside the tools 
subdir or as an example or something else.
Frankly, I do not know what formal requirements I  should include into 
the code to be qualified as a separate tool.


bb


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

2018-04-05 Thread wm4
On Fri, 30 Mar 2018 14:47:25 +0200
Bodecs Bela  wrote:

> Hi All,
> 
> regularly, on different forums and mailing lists a requirement popups 
> for a feature to automatically failover switching between main input and a
> secondary input in case of main input unavailability.
> 
> The base motivation: let's say you have a unreliable live stream source 
> and you
> want to transcode its video and audio streams in realtime but you
> want to survive the ocasions when the source is unavailable. So use a
> secondary live source but the transition should occur seamlessly without
> breaking/re-starting the transcoding processs.
> 
> Some days ago there was a discussion on devel-irc about this topic and 
> we concluded that this feature is not feasible inside ffmpeg without 
> "hacking", but a separate client app could do this.
> 
> So I created this example app to handle two separate input sources and 
> switching realtime between them. I am not sure wheter it should be 
> inside the tools subdir.
> 
> The detailed description is available in the header section of the 
> source file.
> 
> I will appretiate your suggestions about it.
> 
> Thank you in advance.
> 
> best,
> 
> Bela Bodecs
> 
> 

Does this really quality as example? It's way too complex and seems to
be about a specific use case in place of ffmpeg.c, rather than
demonstrating API use in an educational way (what code examples are
supposed to do).

If someone wants to merge this, at least add it as top level program,
and not under the examples directory.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

2018-04-05 Thread Michael Niedermayer
On Fri, Mar 30, 2018 at 02:47:25PM +0200, Bodecs Bela wrote:
> Hi All,
> 
> regularly, on different forums and mailing lists a requirement popups for a
> feature to automatically failover switching between main input and a
> secondary input in case of main input unavailability.
> 
> The base motivation: let's say you have a unreliable live stream source and
> you
> want to transcode its video and audio streams in realtime but you
> want to survive the ocasions when the source is unavailable. So use a
> secondary live source but the transition should occur seamlessly without
> breaking/re-starting the transcoding processs.
> 
> Some days ago there was a discussion on devel-irc about this topic and we
> concluded that this feature is not feasible inside ffmpeg without "hacking",
> but a separate client app could do this.
> 
> So I created this example app to handle two separate input sources and
> switching realtime between them. I am not sure wheter it should be inside
> the tools subdir.
> 
> The detailed description is available in the header section of the source
> file.
> 
> I will appretiate your suggestions about it.
> 
> Thank you in advance.
> 
> best,
> 
> Bela Bodecs
> 
> 

>  configure|2 
>  doc/examples/Makefile|1 
>  doc/examples/Makefile.example|1 
>  doc/examples/alternative_input.c | 1233 
> +++

You may want to add yourself to MAINTAINERS, so it is not unmaintained
I think this is complex enough that it needs a maintainer


[...]

> +static int open_single_input(int input_index)
> +{
> +int ret, i;
> +AVInputFormat *input_format = NULL;
> +AVDictionary * input_options = NULL;
> +AVFormatContext * input_fmt_ctx = NULL;
> +
> +if (app_ctx.input_format_names[input_index]) {
> +if (!(input_format = 
> av_find_input_format(app_ctx.input_format_names[input_index]))) {
> +timed_log(AV_LOG_ERROR, "Input #%d Unknown input format: 
> '%s'\n", input_index,
> +  app_ctx.input_format_names[input_index]);
> +return EINVAL;
> +}
> +}
> +
> +av_dict_set(_options, "rw_timeout", "200", 0);
> +av_dict_set(_options, "timeout", "2000", 0);

> +if ((app_ctx.input_fmt_ctx[input_index] = avformat_alloc_context()) < 0)
> +return AVERROR(ENOMEM);

i guess this was intended to be "!= NULL"

also you are mixing EINVAL with AVERROR(ENOMEM) these arent compatible. 
Either all should be AVERROR or none

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

2018-04-05 Thread Bodecs Bela

ping


2018.03.30. 14:47 keltezéssel, Bodecs Bela írta:

Hi All,

regularly, on different forums and mailing lists a requirement popups 
for a feature to automatically failover switching between main input 
and a

secondary input in case of main input unavailability.

The base motivation: let's say you have a unreliable live stream 
source and you

want to transcode its video and audio streams in realtime but you
want to survive the ocasions when the source is unavailable. So use a
secondary live source but the transition should occur seamlessly without
breaking/re-starting the transcoding processs.

Some days ago there was a discussion on devel-irc about this topic and 
we concluded that this feature is not feasible inside ffmpeg without 
"hacking", but a separate client app could do this.


So I created this example app to handle two separate input sources and 
switching realtime between them. I am not sure wheter it should be 
inside the tools subdir.


The detailed description is available in the header section of the 
source file.


I will appretiate your suggestions about it.

Thank you in advance.

best,

Bela Bodecs




___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel