Message ID | 94be3c7e-2816-be52-659a-88441cec4be9@vivanet.hu |
---|---|
State | Accepted |
Headers | show |
ping 2018.02.25. 17:07 keltezéssel, Bodecs Bela írta: > Dear All, > > this patch makes it possible to dinamically close the current segment > and step to the next one by introducing command handling capabilities > into the filter. This new feature is very usefull when working with > real-time sources or live streams as source. Combinig usage with zmqsend > tool you can interactively end the current segment and step to next one. > > it is very usefull in case of event streaming when sending an intro > then a > live section and then an outro and you want to start and stop the live > event manually. > > example: > > ffmpeg -re -i very_long_intro.mp4 -i <event_source> -re -i > very_long_outro.mp4 > -filter_complex '[0:v][0:a] [1:v][1:a] [2:v][2:a] > concat=n=3:v=1:a=1 [v] [a]; > [v] > zmq=b=tcp\\:\\/\\/127.0.0.1\\:5555 [v_out]' > -map '[v_out]' -map '[a]' <output> > > When you you want to start the live event, issue in another window: > echo "Parsed_concat_0 next" | zmqsend -b tcp://127.0.0.1:5555 > > When you want to end the live session: > echo "Parsed_concat_0 next" | zmqsend -b tcp://127.0.0.1:5555 > > > Please review this patch. Thank you in advance. > > Bela Bodecs > > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 在 2018年2月28日,下午4:10,Bodecs Bela <bodecsb@vivanet.hu> 写道: > > ping LGTM > > > 2018.02.25. 17:07 keltezéssel, Bodecs Bela írta: >> Dear All, >> >> this patch makes it possible to dinamically close the current segment >> and step to the next one by introducing command handling capabilities >> into the filter. This new feature is very usefull when working with >> real-time sources or live streams as source. Combinig usage with zmqsend >> tool you can interactively end the current segment and step to next one. >> >> it is very usefull in case of event streaming when sending an intro then a >> live section and then an outro and you want to start and stop the live event manually. >> >> example: >> >> ffmpeg -re -i very_long_intro.mp4 -i <event_source> -re -i very_long_outro.mp4 >> -filter_complex '[0:v][0:a] [1:v][1:a] [2:v][2:a] concat=n=3:v=1:a=1 [v] [a]; >> [v] zmq=b=tcp\\:\\/\\/127.0.0.1\\:5555 [v_out]' >> -map '[v_out]' -map '[a]' <output> >> >> When you you want to start the live event, issue in another window: >> echo "Parsed_concat_0 next" | zmqsend -b tcp://127.0.0.1:5555 >> >> When you want to end the live session: >> echo "Parsed_concat_0 next" | zmqsend -b tcp://127.0.0.1:5555 >> >> >> Please review this patch. Thank you in advance. >> >> 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
Liu Steven (2018-02-28):
> LGTM
LGTM too, pushed.
Regards,
diff --git a/doc/filters.texi b/doc/filters.texi index 6ad2db2..40023da 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -15862,6 +15862,15 @@ do not have exactly the same duration in the first file. @end itemize +@subsection Commands + +This filter supports the following commands: +@table @option +@item next +Close the current segment and step to the next one +@end table + + @section drawgraph, adrawgraph Draw a graph using input video or audio metadata. diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c index 56e4179..25b3752 100644 --- a/libavfilter/avf_concat.c +++ b/libavfilter/avf_concat.c @@ -411,6 +411,21 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&cat->in); } + +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, + char *res, int res_len, int flags) +{ + int ret = AVERROR(ENOSYS); + + if (!strcmp(cmd, "next")) { + av_log(ctx, AV_LOG_VERBOSE, "Command received: next\n"); + return flush_segment(ctx); + } + + return ret; +} + + AVFilter ff_avf_concat = { .name = "concat", .description = NULL_IF_CONFIG_SMALL("Concatenate audio and video streams."), @@ -422,4 +437,5 @@ AVFilter ff_avf_concat = { .outputs = NULL, .priv_class = &concat_class, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS, + .process_command = process_command, };