[FFmpeg-user] SEGV when using VMAF filter.
Kevin Wheatley
kevin.j.wheatley at gmail.com
Mon Apr 30 17:33:15 EEST 2018
Hi,
I've just built a version of ffmpeg n4.0
from ace829cb45cff530b8a0aed6adf18f329d7a98f6 linked against libvmaf
ba5356cb41cf3b19ca0bb108bd8e86e9da402f94.
I notice when running commands similar to the examples in the FFmpeg
documentation:
ffmpeg -i test2.mov -i test3.mov -lavfi libvmaf -f null -
I get a segment fault:
(gdb) bt
#0 0x0000003eb4e08213 in pthread_join () from /lib64/libpthread.so.0
#1 0x000000000041a8cb in uninit () at libavfilter/vf_libvmaf.c:320
#2 0x00000000004c62f3 in avfilter_free () at libavfilter/avfilter.c:771
#3 0x00000000004c121c in avfilter_graph_free () at
libavfilter/avfiltergraph.c:126
#4 0x000000000049cd9c in init_complex_filtergraph ()
#5 0x0000000000499193 in ffmpeg_parse_options () at fftools/ffmpeg_opt.c:2046
#6 0x000000000048e078 in main () at fftools/ffmpeg.c:4788
looking at the code it looks like it is attempting to pthread_join()
before the vmaf_thread, has actually been created. This is backed up
by a quick and dirty hack, (if I check the variable is not NULL), I
can successfully run the filter with no problems, I'm not familiar
with the requirements for setting up filters in the code so I can't
say much more than that.
I note that a similar report was made
https://trac.ffmpeg.org/ticket/6865 but that was closed.
I'm happy to provide a patch if somebody could comment on the
appropriate method/pattern of behavior for creating and releasing
resources during the filte rgraph initialisation steps.
Thanks
Kevin
P.S. my quick hack.
diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
index 42c6b66..e3eb182 100644
--- a/libavfilter/vf_libvmaf.c
+++ b/libavfilter/vf_libvmaf.c
@@ -317,7 +317,8 @@ static av_cold void uninit(AVFilterContext *ctx)
pthread_cond_signal(&s->cond);
pthread_mutex_unlock(&s->lock);
- pthread_join(s->vmaf_thread, NULL);
+ if (s->vmaf_thread)
+ pthread_join(s->vmaf_thread, NULL);
av_frame_free(&s->gref);
av_frame_free(&s->gmain);
More information about the ffmpeg-user
mailing list