On Jan 04 15:52:47, [email protected] wrote:
> On 2023/01/04 16:22, Jan Stary wrote:
> > Hi,
> >
> > > My old pcengines box died and I had a rpi4 around that I spun up to
> > > replace
> > > it with as my network router/play machine.
> > >
> > > The rpi4 is working fantastic except for one thing:
> > >
> > > I have a webcam that I'm capturing images using fswebcam and those scripts
> > > all work perfectly.
> > >
> > > I try to make a video of the captured images (timelapse) using ffmpeg, but
> > > any invocation of ffmpeg I try dumps a core. I have tried on different
> > > sets
> > > of image files so I don't think it's the data coming in.
> > >
> > > A super simple invocation:
> > > ffmpeg -y -pattern_type glob -i "image*.jpeg" all.mp4
> > >
> > > After 40-50 frames results in:
> > > Thread 2 received signal SIGSEGV, Segmentation fault.
> > > [Switching to thread 203094]
> > > 0x0000001527489808 in mbtree_propagate_list_neon () from
> > > /usr/local/lib/libx264.so.24.0
> > >
> > > 0x0000001527489808 in mbtree_propagate_list_neon () from
> > > /usr/local/lib/libx264.so.24.0
> > >
> > > (gdb) bt
> > > #0 0x0000001527489808 in mbtree_propagate_list_neon () from
> > > /usr/local/lib/libx264.so.24.0
> ...
> > > Is anyone successfully running ffmpeg on rpi4?
> >
> > I can confirm that ffmpeg dumps core for me on RPI4 running current/arm64.
> > Even with just three jpegs, i.e. three frames,
> >
> > ffmpeg -y -pattern_type glob -i "*.jpg" all.mp4
> >
> > just sits there for ages and eventualy segfaults like this:
> >
> > Script started on Wed Jan 4 16:12:12 2023
> > ffmpeg version 4.4.3 Copyright (c) 2000-2022 the FFmpeg developers
> > built with OpenBSD clang version 13.0.0
> > configuration: --enable-shared --arch=aarch64 --cc=cc --disable-debug
> > --disable-indev=jack --disable-outdev=sdl2 --enable-avresample
> > --enable-fontconfig --enable-frei0r --enable-gpl --enable-ladspa
> > --enable-libaom --enable-libass --enable-libdav1d --enable-libfreetype
> > --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-libopus
> > --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis
> > --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxml2
> > --enable-libxvid --enable-libzimg --enable-nonfree --enable-openssl
> > --enable-libvidstab --extra-cflags='-I/usr/local/include
> > -I/usr/X11R6/include' --extra-libs='-L/usr/local/lib -L/usr/X11R6/lib'
> > --extra-ldsoflags= --mandir=/usr/local/man --objcc=/usr/bin/false
> > --optflags='-O2 -pipe -Wno-redundant-decls'
> ...
> > Duration: 00:00:00.12, start: 0.000000, bitrate: N/A
> > Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc,
> > bt470bg/unknown/unknown), 2560x1920, 25 fps, 25 tbr, 25 tbn, 25 tbc
> > Stream mapping:
> > Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
> > Press [q] to stop, [?] for help
> > 1;36m[libx264 @ 0x1491c75800] 0musing cpu capabilities: ARMv8 NEON
> > 1;36m[libx264 @ 0x1491c75800] 0mprofile High, level 5.0, 4:2:0, 8-bit
> > 1;36m[libx264 @ 0x1491c75800] 0m264 - core 164 - H.264/MPEG-4 AVC codec -
> > Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1
> > ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
> > mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
> > fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1
> > sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
> > constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
> > weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40
> > intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
> > qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
> > Output #0, mp4, to 'all.mp4':
> > Metadata:
> > encoder : Lavf58.76.100
> > Stream #0:0: Video: h264 (avc1 / 0x31637661), yuvj420p(pc,
> > bt470bg/unknown/unknown, progressive), 2560x1920, q=2-31, 25 fps, 12800 tbn
> > Metadata:
> > encoder : Lavc58.134.100 libx264
> > Side data:
> > cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
> > frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A
> > speed=
> > frame= 3 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A
> > speed=
> > Segmentation fault (core dumped)
> >
> >
> > Reading symbols from 32m/usr/local/bin/ffmpegm...
> > (No debugging symbols found in 32m/usr/local/bin/ffmpegm)
> > [New process 403534]
> > [New process 166640]
> > [New process 477908]
> > [New process 114936]
> > [New process 366281]
> > [New process 313181]
> > [New process 410521]
> > [New process 459975]
> > [New process 267908]
> > [New process 458273]
> > [New process 590791]
> > [New process 209987]
> > Core was generated by `ffmpeg'.
> > Program terminated with signal SIGSEGV, Segmentation fault.
> > m--Type <RET> for more, q to quit, c to continue without paging--
> > #0 34m0x000000141f3fa9ccm in 33mx264_8_cabac_encode_decision_asmm ()m
> > m from 32m/usr/local/lib/libx264.so.24.0m
> > [Current thread is 1 (process 403534)]
> > (gdb)
> > (gdb) bt
> > #0 34m0x000000141f3fa9ccm in 33mx264_8_cabac_encode_decision_asmm ()m
> > m from 32m/usr/local/lib/libx264.so.24.0m
> > #1 34m0x000000141f34e6e4m in 33mx264_8_macroblock_write_cabacm ()m
> > m from 32m/usr/local/lib/libx264.so.24.0m
> > #2 34m0x000000141f36191cm in 33mslices_writem () from
> > 32m/usr/local/lib/libx264.so.24.0m
> ...
>
> So it's crashing in libx264 asm mbtree (macroblock_tree) code.
>
> There was a fix in this area recently. Which version of x264 do you have?
The segfault happens with x264-20221028
as currently provided in the packages.
> If it's before x264-20221028 then try updating first. I don't think
> there's worth looking further until that is confirmed.
>
> If that doesn't help, there's a good chance that building x264 with
> --disable-asm will work around the problem, but will be slow.
I can confirm that with --disable-asm the problem disappears:
the above ffmpeg line produces a mp4 file (tested with 100 jpegs/frames);
during that, ffmpeg eats much more cpu than previously (spending
about 5 seconds on every frame) but does not segfault.
Jan
Index: Makefile
===================================================================
RCS file: /cvs/ports/multimedia/x264/Makefile,v
retrieving revision 1.63
diff -u -p -r1.63 Makefile
--- Makefile 23 Dec 2022 13:54:24 -0000 1.63
+++ Makefile 6 Jan 2023 11:46:47 -0000
@@ -1,6 +1,7 @@
COMMENT= free H.264/MPEG-4 AVC encoder
DISTNAME= x264-20221028
+REVISION= 0
GH_ACCOUNT= mirror
GH_PROJECT= x264
GH_COMMIT= 416e3eb2b52abb0a67e57599aba4f8be3003b36d
@@ -42,7 +43,7 @@ CONFIGURE_ARGS+=--prefix=${PREFIX} \
.if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" || \
- ${MACHINE_ARCH} == "powerpc"
+ ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "aarch64"
CONFIGURE_ARGS+=--disable-asm
.endif