Re: [Cin] [Libav-user] Dynamic_input filters and avfilter_pad_get_type
On Sat, May 10, 2025 at 9:05 AM Paul B Mahol <[email protected]> wrote:
On Fri, May 9, 2025 at 11:38 PM Andrew Randrianasulu <[email protected]> wrote:
I was looking at why our application (cinelerra-gg) crashed at trying to use libplacebo
I found that libplacebo defines itself
https://ffmpeg.org/doxygen/7.0/vf__libplacebo_8c.html
as
.flags = AVFILTER_FLAG_HWDEVICE | AVFILTER_FLAG_DYNAMIC_INPUTS,
so only output pad is defined, as far as I can see:
static const AVFilterPad libplacebo_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = &libplacebo_config_output, }, };
then when our code calls
avfilter_pad_get_type()
You need to call it only after filtergraph have been configured, not before because in such cases number of output pads may be 0 before configuration. In any case you need to check current number of input pads and output pads for each filter before trying to access them.
Thanks. Attached patch makes this crash go away, just 32-bit cingg can't cope with 4k frames filtering en-masse :) Andrea, can you test attached patch + this opts file put alongside test 4k HDR video decodable by hardware?
it promptly crashes.
BC_Signals::dump_stack cin() [0x8b2c9e2] linux-gate.so.1(__kernel_rt_sigreturn+0) [0xf7fb8590] cin(avfilter_pad_get_type+0x14) [0x99266a4] cin(_ZN13FFVideoStream13create_filterEPKc+0xbc) [0x865669c] cin(_ZN6FFMPEG12open_decoderEv+0x80f) [0x865732f] cin(_ZN10FileFFMPEG9check_sigEP5Asset+0x81) [0x8670071] cin(_ZN4File5probeEv+0x376) [0x867cd86] cin(_ZN4File9open_fileEP11PreferencesP5Assetii+0x378) [0x867d628] cin(_ZN7MWindow14load_filenamesEP9ArrayListIPcEiii+0x250) [0x87301f0] cin(_ZN17CommandLineThread3runEv+0x53) [0x86e2cd3] cin(_ZN6Thread10entrypointEPv+0x41) [0x8b70c11] /lib/libpthread.so.0(+0x7328) [0xf7df9328] /lib/libc.so.6(clone+0x66) [0xf0373f06]
We still hope to get libplacebo's tonemapping + vulkan hevc decoding going, so any pointers how to talk to those dynamic_input filters will be useful. Even swscale is dynamic_input in ffmpeg 7.1+, so I (we) really hope to keep it working, too.
Code:
https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=blob;f=cinelerra...
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
сб, 10 мая 2025 г., 11:14 Andrew Randrianasulu <[email protected]>:
On Sat, May 10, 2025 at 9:05 AM Paul B Mahol <[email protected]> wrote:
On Fri, May 9, 2025 at 11:38 PM Andrew Randrianasulu <
[email protected]> wrote:
I was looking at why our application (cinelerra-gg) crashed at trying
to use libplacebo
I found that libplacebo defines itself
https://ffmpeg.org/doxygen/7.0/vf__libplacebo_8c.html
as
.flags = AVFILTER_FLAG_HWDEVICE | AVFILTER_FLAG_DYNAMIC_INPUTS,
so only output pad is defined, as far as I can see:
static const AVFilterPad libplacebo_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = &libplacebo_config_output, }, };
then when our code calls
avfilter_pad_get_type()
You need to call it only after filtergraph have been configured, not before because in such cases number of output pads may be 0 before configuration. In any case you need to check current number of input pads and output pads for each filter before trying to access them.
Thanks. Attached patch makes this crash go away, just 32-bit cingg can't cope with 4k frames filtering en-masse :)
Andrea, can you test attached patch + this opts file put alongside test 4k HDR video decodable by hardware?
Aw, tried to reduce resolution to very barest minimum allowed by hevc encoder (228*128!) and while libplacebo works (sloowly!) with software decoder, it does not produce good frames with Vulkan hw decoder (even if I seen in nvtop hw decoder really runs sometimes at close to 100%). So, something confuses libplacebo greatly if used like this. I also tried *_vulkan filters on input, hoping they will also pick up hw vulkan decoding device but apparently no?
it promptly crashes.
BC_Signals::dump_stack cin() [0x8b2c9e2] linux-gate.so.1(__kernel_rt_sigreturn+0) [0xf7fb8590] cin(avfilter_pad_get_type+0x14) [0x99266a4] cin(_ZN13FFVideoStream13create_filterEPKc+0xbc) [0x865669c] cin(_ZN6FFMPEG12open_decoderEv+0x80f) [0x865732f] cin(_ZN10FileFFMPEG9check_sigEP5Asset+0x81) [0x8670071] cin(_ZN4File5probeEv+0x376) [0x867cd86] cin(_ZN4File9open_fileEP11PreferencesP5Assetii+0x378) [0x867d628] cin(_ZN7MWindow14load_filenamesEP9ArrayListIPcEiii+0x250) [0x87301f0] cin(_ZN17CommandLineThread3runEv+0x53) [0x86e2cd3] cin(_ZN6Thread10entrypointEPv+0x41) [0x8b70c11] /lib/libpthread.so.0(+0x7328) [0xf7df9328] /lib/libc.so.6(clone+0x66) [0xf0373f06]
We still hope to get libplacebo's tonemapping + vulkan hevc decoding
going, so any pointers how to talk to those dynamic_input filters will be useful. Even swscale is dynamic_input in ffmpeg 7.1+, so I (we) really hope to keep it working, too.
Code:
https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=blob;f=cinelerra...
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
Andrea, can you test attached patch + this opts file put alongside test 4k HDR video decodable by hardware?
I compiled with the patch and put the opts in .../bin/ffmpeg. I don't think I know what and how to test. I loaded the iPhone13_tonemapping_checker_rev2.mp4 file you had provided. The playback performance is good (even in reverse, with only a few freezes). However, the video card does not activate and the CPU (not particularly busy) does everything. The behavior is the same even removing the opts. Suggestions? PS: the same is true with the lines for zscale that you asked to put in the manual. Do I have to do an opts on it? How do I text it? I also don't quite understand how the line you report works.
сб, 10 мая 2025 г., 16:20 Andrea paz <[email protected]>:
Andrea, can you test attached patch + this opts file put alongside test 4k HDR video decodable by hardware?
I compiled with the patch and put the opts in .../bin/ffmpeg. I don't think I know what and how to test. I loaded the iPhone13_tonemapping_checker_rev2.mp4 file you had provided. The playback performance is good (even in reverse, with only a few freezes). However, the video card does not activate and the CPU (not particularly busy) does everything. The behavior is the same even removing the opts. Suggestions?
PS: the same is true with the lines for zscale that you asked to put in the manual. Do I have to do an opts on it? How do I text it? I also don't quite understand how the line you report works.
you create file with .opts extension in same folder where your main_media_file.mov located. You name it main_media_file.opts You put test lines there. You might need RADV_PERFTEST=video_decode set before you launch cin. I usually just launch cin path_to_test_media/main_media_file.mov It should pick up .opts file from there. I did not try to put those lines in global decode.opts you also need to set cin to Vulkan decoding (should be already in git).
On Sat, May 10, 2025 at 11:14 AM Andrew Randrianasulu <[email protected]> wrote:
On Sat, May 10, 2025 at 9:05 AM Paul B Mahol <[email protected]> wrote:
On Fri, May 9, 2025 at 11:38 PM Andrew Randrianasulu <[email protected]> wrote:
I was looking at why our application (cinelerra-gg) crashed at trying to use libplacebo
I found that libplacebo defines itself
https://ffmpeg.org/doxygen/7.0/vf__libplacebo_8c.html
as
.flags = AVFILTER_FLAG_HWDEVICE | AVFILTER_FLAG_DYNAMIC_INPUTS,
so only output pad is defined, as far as I can see:
static const AVFilterPad libplacebo_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = &libplacebo_config_output, }, };
then when our code calls
avfilter_pad_get_type()
You need to call it only after filtergraph have been configured, not before because in such cases number of output pads may be 0 before configuration. In any case you need to check current number of input pads and output pads for each filter before trying to access them.
Thanks. Attached patch makes this crash go away, just 32-bit cingg can't cope with 4k frames filtering en-masse :)
Sadly wtch ffmpeg.git patch does not work anymore. I tried to use int nb_pads = avfilter_filter_pad_count(filter,0); but this one apparently crashes when I try zscale :( while may be zscale was just not compiled in? I'll retry with some more env. options. On the plus side ffmpeg.git + radv + h264 video = it mostly works. Some vids still crash us ...
Andrea, can you test attached patch + this opts file put alongside test 4k HDR video decodable by hardware?
it promptly crashes.
BC_Signals::dump_stack cin() [0x8b2c9e2] linux-gate.so.1(__kernel_rt_sigreturn+0) [0xf7fb8590] cin(avfilter_pad_get_type+0x14) [0x99266a4] cin(_ZN13FFVideoStream13create_filterEPKc+0xbc) [0x865669c] cin(_ZN6FFMPEG12open_decoderEv+0x80f) [0x865732f] cin(_ZN10FileFFMPEG9check_sigEP5Asset+0x81) [0x8670071] cin(_ZN4File5probeEv+0x376) [0x867cd86] cin(_ZN4File9open_fileEP11PreferencesP5Assetii+0x378) [0x867d628] cin(_ZN7MWindow14load_filenamesEP9ArrayListIPcEiii+0x250) [0x87301f0] cin(_ZN17CommandLineThread3runEv+0x53) [0x86e2cd3] cin(_ZN6Thread10entrypointEPv+0x41) [0x8b70c11] /lib/libpthread.so.0(+0x7328) [0xf7df9328] /lib/libc.so.6(clone+0x66) [0xf0373f06]
We still hope to get libplacebo's tonemapping + vulkan hevc decoding going, so any pointers how to talk to those dynamic_input filters will be useful. Even swscale is dynamic_input in ffmpeg 7.1+, so I (we) really hope to keep it working, too.
Code:
https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=blob;f=cinelerra...
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
Dear Phyllis, I retested this patch on ffmpeg-7.0 based Cinelerra-gg and it works at least for libplacebo's tonemapper implementation. BUT for ffmpeg 8.0 patchset it already included, as far as I can see. I " just" need to update mpv with newest libplacebo (joys of self-compiling some software) and then rebuild Slackbuild way cingg with ffmpeg 8.0, they sneaked breaking changes for older libplacebo compilation .... . Can you install libplacebo-dev on you machine used for building new Appimage, and configure cingg to use it? From what I see libplacebo's upstream uses Meson build system, so it will be a bit rouch to properly integrate, esp. for older distros.... or so I think for now! I am not sure about zimg because this one uses really funny license. But libplacebo widely known and should work over good Vulkan driver (like radv for my RX550). ---------- Forwarded message --------- От: Andrew Randrianasulu <[email protected]> Date: сб, 10 мая 2025 г., 11:14 Subject: Re: [Libav-user] Dynamic_input filters and avfilter_pad_get_type To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <[email protected]> Cc: Cinelerra.GG <[email protected]>, Andrea paz < [email protected]> On Sat, May 10, 2025 at 9:05 AM Paul B Mahol <[email protected]> wrote:
On Fri, May 9, 2025 at 11:38 PM Andrew Randrianasulu <
[email protected]> wrote:
I was looking at why our application (cinelerra-gg) crashed at trying to
use libplacebo
I found that libplacebo defines itself
https://ffmpeg.org/doxygen/7.0/vf__libplacebo_8c.html
as
.flags = AVFILTER_FLAG_HWDEVICE | AVFILTER_FLAG_DYNAMIC_INPUTS,
so only output pad is defined, as far as I can see:
static const AVFilterPad libplacebo_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = &libplacebo_config_output, }, };
then when our code calls
avfilter_pad_get_type()
You need to call it only after filtergraph have been configured, not before because in such cases number of output pads may be 0 before configuration. In any case you need to check current number of input pads and output pads for each filter before trying to access them.
Thanks. Attached patch makes this crash go away, just 32-bit cingg can't cope with 4k frames filtering en-masse :) Andrea, can you test attached patch + this opts file put alongside test 4k HDR video decodable by hardware?
it promptly crashes.
BC_Signals::dump_stack cin() [0x8b2c9e2] linux-gate.so.1(__kernel_rt_sigreturn+0) [0xf7fb8590] cin(avfilter_pad_get_type+0x14) [0x99266a4] cin(_ZN13FFVideoStream13create_filterEPKc+0xbc) [0x865669c] cin(_ZN6FFMPEG12open_decoderEv+0x80f) [0x865732f] cin(_ZN10FileFFMPEG9check_sigEP5Asset+0x81) [0x8670071] cin(_ZN4File5probeEv+0x376) [0x867cd86] cin(_ZN4File9open_fileEP11PreferencesP5Assetii+0x378) [0x867d628] cin(_ZN7MWindow14load_filenamesEP9ArrayListIPcEiii+0x250) [0x87301f0] cin(_ZN17CommandLineThread3runEv+0x53) [0x86e2cd3] cin(_ZN6Thread10entrypointEPv+0x41) [0x8b70c11] /lib/libpthread.so.0(+0x7328) [0xf7df9328] /lib/libc.so.6(clone+0x66) [0xf0373f06]
We still hope to get libplacebo's tonemapping + vulkan hevc decoding
going, so any pointers how to talk to those dynamic_input filters will be useful. Even swscale is dynamic_input in ffmpeg 7.1+, so I (we) really hope to keep it working, too.
Code:
https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=blob;f=cinelerra...
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
Andrew, I will certainly try but I have to warn you ahead of time that Meson is a really big problem (as noted in the Manual). Another library that was in Meson was converted to the older standard because it was way too difficult to incorporate it into the CinGG build procedure with Meson. On Tue, Nov 18, 2025, 16:30 Andrew Randrianasulu <[email protected]> wrote:
Dear Phyllis, I retested this patch on ffmpeg-7.0 based Cinelerra-gg and it works at least for libplacebo's tonemapper implementation.
BUT for ffmpeg 8.0 patchset it already included, as far as I can see. I " just" need to update mpv with newest libplacebo (joys of self-compiling some software) and then rebuild Slackbuild way cingg with ffmpeg 8.0, they sneaked breaking changes for older libplacebo compilation .... .
Can you install libplacebo-dev on you machine used for building new Appimage, and configure cingg to use it? From what I see libplacebo's upstream uses Meson build system, so it will be a bit rouch to properly integrate, esp. for older distros.... or so I think for now!
I am not sure about zimg because this one uses really funny license. But libplacebo widely known and should work over good Vulkan driver (like radv for my RX550).
---------- Forwarded message --------- От: Andrew Randrianasulu <[email protected]> Date: сб, 10 мая 2025 г., 11:14 Subject: Re: [Libav-user] Dynamic_input filters and avfilter_pad_get_type To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <[email protected]> Cc: Cinelerra.GG <[email protected]>, Andrea paz < [email protected]>
On Sat, May 10, 2025 at 9:05 AM Paul B Mahol <[email protected]> wrote:
On Fri, May 9, 2025 at 11:38 PM Andrew Randrianasulu <
[email protected]> wrote:
I was looking at why our application (cinelerra-gg) crashed at trying
to use libplacebo
I found that libplacebo defines itself
https://ffmpeg.org/doxygen/7.0/vf__libplacebo_8c.html
as
.flags = AVFILTER_FLAG_HWDEVICE | AVFILTER_FLAG_DYNAMIC_INPUTS,
so only output pad is defined, as far as I can see:
static const AVFilterPad libplacebo_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = &libplacebo_config_output, }, };
then when our code calls
avfilter_pad_get_type()
You need to call it only after filtergraph have been configured, not before because in such cases number of output pads may be 0 before configuration. In any case you need to check current number of input pads and output pads for each filter before trying to access them.
Thanks. Attached patch makes this crash go away, just 32-bit cingg can't cope with 4k frames filtering en-masse :)
Andrea, can you test attached patch + this opts file put alongside test 4k HDR video decodable by hardware?
it promptly crashes.
BC_Signals::dump_stack cin() [0x8b2c9e2] linux-gate.so.1(__kernel_rt_sigreturn+0) [0xf7fb8590] cin(avfilter_pad_get_type+0x14) [0x99266a4] cin(_ZN13FFVideoStream13create_filterEPKc+0xbc) [0x865669c] cin(_ZN6FFMPEG12open_decoderEv+0x80f) [0x865732f] cin(_ZN10FileFFMPEG9check_sigEP5Asset+0x81) [0x8670071] cin(_ZN4File5probeEv+0x376) [0x867cd86] cin(_ZN4File9open_fileEP11PreferencesP5Assetii+0x378) [0x867d628] cin(_ZN7MWindow14load_filenamesEP9ArrayListIPcEiii+0x250) [0x87301f0] cin(_ZN17CommandLineThread3runEv+0x53) [0x86e2cd3] cin(_ZN6Thread10entrypointEPv+0x41) [0x8b70c11] /lib/libpthread.so.0(+0x7328) [0xf7df9328] /lib/libc.so.6(clone+0x66) [0xf0373f06]
We still hope to get libplacebo's tonemapping + vulkan hevc decoding
going, so any pointers how to talk to those dynamic_input filters will be useful. Even swscale is dynamic_input in ffmpeg 7.1+, so I (we) really hope to keep it working, too.
Code:
https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=blob;f=cinelerra...
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
participants (3)
-
Andrea paz -
Andrew Randrianasulu -
Phyllis Smith