On 7/21/20, Paul B Mahol <one...@gmail.com> wrote: > On 7/14/20, Rahul Lodha <rahullod...@gmail.com> wrote: >> I wrote a code to mix two audio streams which is working. However, >> somehow `avfilter_graph_parse2` is not preserving the pad names >> >> For example, below is a filter spec >> >> ``` >> filter_spec = >> "abuffer=time_base=1/48000:sample_rate=48000:sample_fmt=fltp:channel_layout=0x3[a0] >> ; >> abuffer=time_base=1/48000:sample_rate=48000:sample_fmt=fltp:channel_layout=0x3 >> [a1]; >> [a0] [a1] amix=inputs=2, abuffersink"; >> ``` >> Below is the code to parse and dump graph >> >> ``` >> if ((ret = avfilter_graph_parse2(filter_graph, filter_spec, &inputs, >> &outputs)) < 0) { >> av_log(NULL, AV_LOG_ERROR, "avfilter_graph_parse_ptr >> failed: %d\n", ret); >> } >> >> if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0) { >> av_log(NULL, AV_LOG_ERROR, "avfilter_graph_config >> failed\n"); >> } >> >> char *g = avfilter_graph_dump(filter_graph, NULL); >> if(g) { >> av_log(NULL, AV_LOG_ERROR, "Graph: %s\n", g); >> av_free(g); >> } >> >> ``` >> and below is the graph dump. >> >> ``` >> Graph: +------------------+ >> | Parsed_abuffer_0 |default--[48000Hz fltp:stereo]--Parsed_amix_2:input0 >> | (abuffer) | >> +------------------+ >> >> +------------------+ >> | Parsed_abuffer_1 |default--[48000Hz fltp:stereo]--Parsed_amix_2:input1 >> | (abuffer) | >> +------------------+ >> >> +---------------+ >> Parsed_abuffer_0:default--[48000Hz fltp:stereo]--input0| Parsed_amix_2 >> |default--[48000Hz fltp:stereo]--Parsed_abuffersink_3:default >> Parsed_abuffer_1:default--[48000Hz fltp:stereo]--input1| (amix) | >> +---------------+ >> >> >> +----------------------+ >> Parsed_amix_2:default--[48000Hz fltp:stereo]--default| >> Parsed_abuffersink_3 >> | >> | (abuffersink) >> | >> >> +----------------------+ >> >> >> >> ``` >> >> As you can see, all the pad names a0, a1, etc gone and they are >> replaced by `default`, Parsed_abuffersink_3 etc. >> >> Is there any way to preserve names? > > Such pad names are never preserved. > Could they be preserved? Certainly yes. Patch welcome.
Also you can use "amix@amix_pad_name=options" when setting up filter graph to set pad names. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".