Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Crash happens for specific videos size with animated image attached  #604

@mrkiwi

Description

@mrkiwi

Description
The crash occurs only for specific screen sizes and assets. For example, I'm trying to generated video with size 1026:1824 with animated image. The video size generating from backgroundTemp.jpg. So it's the base size. If size of this image 1026:1824 and gif added - crash happens. For other sizes all works good. I've tried different scenarios and commands, changed ffmpeg versions, checked logs - nothing helps. ndk-stack for the crash below returns only this line /data/app/~~Fp6jpZ6seWQUaCyJ6wRDMw==/com.test.ffmpeg-6Otc5YS0rGcT73jJVqxWUA==/base.apk!libavcodec.so
Also, I've tried to do this with non-gpl version - all works good, so I think the problem with the size and gpl encoder.
I've attached logs and commands that I use.

Expected behavior
No crash when trying to generate video.

Current behavior
Crash happens.

To Reproduce
Run this command

-y -i 'backgroundtemp.png' -i '20221015_102019.jpg' -stream_loop -1 -i '46c0853346d9ade05a71a6b97fe420db_giphy (1)-1653577938131-1.gif' -filter_complex [0]split=2[bg][fg];[bg]drawbox=c=black@1:replace=1:t=fill[bg];[bg][fg]overlay=format=auto[v0];[1:v]scale=2436:1826:flags=neighbor,rotate='0*PI/180:c=none:ow=0.0+2436.0:oh=0.0+1826.0'[t1];[v0][t1]overlay=x=-704.5:y=-1.25[v1];[2:v]scale=512:512:flags=neighbor,rotate='0*PI/180:c=none:ow=0.0+512.0:oh=0.0+512.0'[t1];[v1][t1]overlay=x=256.5:y=655.5[v2] -map [v2] -pix_fmt yuv420p -t 6.1 'tmp.mp4' 

Logs
Crash dump

10-19 12:49:29.919 25885 25885 F DEBUG   : Build fingerprint: 'samsung/beyond2lteeea/beyond2:12/SP1A.210812.016/G975FXXUFHVE1:user/release-keys'
10-19 12:49:29.919 25885 25885 F DEBUG   : Revision: '26'
10-19 12:49:29.919 25885 25885 F DEBUG   : ABI: 'arm64'
10-19 12:49:29.919 25885 25885 F DEBUG   : Processor: '4'
10-19 12:49:29.919 25885 25885 F DEBUG   : Timestamp: 2022-10-19 12:49:29.552629585-0500
10-19 12:49:29.919 25885 25885 F DEBUG   : Process uptime: 17s
10-19 12:49:29.919 25885 25885 F DEBUG   : Cmdline: com.test.ffmpeg
10-19 12:49:29.919 25885 25885 F DEBUG   : pid: 25566, tid: 25882, name: DefaultDispatch  >>> com.test.ffmpeg <<<
10-19 12:49:29.919 25885 25885 F DEBUG   : uid: 10441
10-19 12:49:29.919 25885 25885 F DEBUG   : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x72546ec000
10-19 12:49:29.919 25885 25885 F DEBUG   :     x0  00000074204a1ec0  x1  000000725467bc90  x2  0000007254682fe2  x3  0000007254698b82
10-19 12:49:29.919 25885 25885 F DEBUG   :     x4  00000072546ebff2  x5  0000007264b782dc  x6  00000000fffffff9  x7  0000000000000041
10-19 12:49:29.919 25885 25885 F DEBUG   :     x8  0000000000000071  x9  00000072546e8610  x10 0000000000000041  x11 000000729bb25ca8
10-19 12:49:29.919 25885 25885 F DEBUG   :     x12 000000725467f5f0  x13 0000000000000071  x14 0000000000007fff  x15 0000000000000041
10-19 12:49:29.919 25885 25885 F DEBUG   :     x16 0000000000000041  x17 0000000000000041  x18 0000007264088000  x19 0000000000000027
10-19 12:49:29.919 25885 25885 F DEBUG   :     x20 00000075b04a31a0  x21 0000000000001cb1  x22 0000000000000027  x23 00000075b04a90a0
10-19 12:49:29.919 25885 25885 F DEBUG   :     x24 0000007254607f00  x25 0000007254698af2  x26 0000000000000028  x27 000000725467bc00
10-19 12:49:29.919 25885 25885 F DEBUG   :     x28 00000074204a1e40  x29 0000007254695190
10-19 12:49:29.919 25885 25885 F DEBUG   :     lr  000000729ba9855c  sp  0000007264b78290  pc  000000729bb25cbc  pst 0000000080000000
10-19 12:49:29.919 25885 25885 F DEBUG   : backtrace:
10-19 12:49:29.920 25885 25885 F DEBUG   :       #00 pc 0000000000b11cbc  /data/app/~~Fp6jpZ6seWQUaCyJ6wRDMw==/com.test.ffmpeg-6Otc5YS0rGcT73jJVqxWUA==/base.apk!libavcodec.so

FFmpeg logs

10-19 12:49:28.461 25566 25648 D FFMpegRendererImpl: EXECUTING -y -i 'backgroundtemp.png' -i '20221015_102019.jpg' -stream_loop -1 -i '46c0853346d9ade05a71a6b97fe420db_giphy (1)-1653577938131-1.gif' -filter_complex [0]split=2[bg][fg];[bg]drawbox=c=black@1:replace=1:t=fill[bg];
10-19 12:49:28.461 25566 25648 D FFMpegRendererImpl: [bg][fg]overlay=format=auto[v0];[1:v]scale=2436:1826:flags=neighbor,rotate='0*PI/180:c=none:ow=0.0+2436.0:oh=0.0+1826.0'[t1];[v0][t1]overlay=x=-704.5:y=-1.25[v1];[2:v]scale=512:512:flags=neighbor,rotate='0*PI/180:c=none:ow=0.0+512.0:oh=0.0+512.0'[t1];[v1][t1]overlay=x=256.5:y=655.5[v2] -map [v2] -pix_fmt yuv420p -t 6.1 'tmp.mp4' 
10-19 12:49:28.462 25566 25845 I mobile-ffmpeg: ffmpeg version v4.4-dev-416
10-19 12:49:28.462 25566 25845 I mobile-ffmpeg:  Copyright (c) 2000-2020 the FFmpeg developers
10-19 12:49:28.462 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.462 25566 25845 I mobile-ffmpeg:   built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)
10-19 12:49:28.462 25566 25845 I mobile-ffmpeg:   configuration: --cross-prefix=aarch64-linux-android- --sysroot=/files/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android21-clang --cxx=aarch64-linux-android21-clang++ --extra-libs='-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/cpu-features/lib -lndk_compat' --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libshine --enable-libspeex --enable-libwavpack --enable-libkvazaar --enable-libx264 --enable-gpl --enable-libxvid --enable-gpl --enable-libx265 --enable-gpl --enable-libvidstab --enable-gpl --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame --disable-sdl2 --enable-libvo-amrwbenc --enable-zlib --enable-mediacodec
10-19 12:49:28.462 25566 25845 I mobile-ffmpeg:   libavutil      56. 55.100 / 56. 55.100
10-19 12:49:28.462 25566 25845 I mobile-ffmpeg:   libavcodec     58. 96.100 / 58. 96.100
10-19 12:49:28.463 25566 25845 I mobile-ffmpeg:   libavformat    58. 48.100 / 58. 48.100
10-19 12:49:28.463 25566 25845 I mobile-ffmpeg:   libavdevice    58. 11.101 / 58. 11.101
10-19 12:49:28.463 25566 25845 I mobile-ffmpeg:   libavfilter     7. 87.100 /  7. 87.100
10-19 12:49:28.463 25566 25845 I mobile-ffmpeg:   libswscale      5.  8.100 /  5.  8.100
10-19 12:49:28.463 25566 25845 I mobile-ffmpeg:   libswresample   3.  8.100 /  3.  8.100
10-19 12:49:28.469 25566 25845 I mobile-ffmpeg: Input #0, png_pipe, from 'backgroundtemp.png':
10-19 12:49:28.469 25566 25845 I mobile-ffmpeg:   Duration: 
10-19 12:49:28.469 25566 25845 I mobile-ffmpeg: N/A
10-19 12:49:28.469 25566 25845 I mobile-ffmpeg: , bitrate: 
10-19 12:49:28.469 25566 25845 I mobile-ffmpeg: N/A
10-19 12:49:28.469 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.469 25566 25845 I mobile-ffmpeg:     Stream #0:0
10-19 12:49:28.470 25566 25845 I mobile-ffmpeg: : Video: png, rgba(pc), 1026x1824
10-19 12:49:28.470 25566 25845 I mobile-ffmpeg: , 
10-19 12:49:28.470 25566 25845 I mobile-ffmpeg: 25 tbr, 
10-19 12:49:28.470 25566 25845 I mobile-ffmpeg: 25 tbn, 
10-19 12:49:28.470 25566 25845 I mobile-ffmpeg: 25 tbc
10-19 12:49:28.470 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.474 25566 25845 I mobile-ffmpeg: Input #1, image2, from '20221015_102019.jpg':
10-19 12:49:28.474 25566 25845 I mobile-ffmpeg:   Duration: 
10-19 12:49:28.474 25566 25845 I mobile-ffmpeg: 00:00:00.04
10-19 12:49:28.474 25566 25845 I mobile-ffmpeg: , start: 
10-19 12:49:28.474 25566 25845 I mobile-ffmpeg: 0.000000
10-19 12:49:28.474 25566 25845 I mobile-ffmpeg: , bitrate: 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 569530 kb/s
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg:     Stream #1:0
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: : Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 3648x2736
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: , 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 25 tbr, 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 25 tbn, 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 25 tbc
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: Input #2, gif, from '46c0853346d9ade05a71a6b97fe420db_giphy (1)-1653577938131-1.gif':
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg:   Duration: 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 00:00:02.10
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: , start: 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 0.000000
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: , bitrate: 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 507 kb/s
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg:     Stream #2:0
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: : Video: gif, bgra, 480x480
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: , 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 10 fps, 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 10 tbr, 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 100 tbn, 
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 100 tbc
10-19 12:49:28.475 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.476 25566 25845 I mobile-ffmpeg: Stream mapping:
10-19 12:49:28.476 25566 25845 I mobile-ffmpeg:   Stream #0:0 (png) -> split
10-19 12:49:28.476 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.476 25566 25845 I mobile-ffmpeg:   Stream #1:0 (mjpeg) -> scale
10-19 12:49:28.476 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.476 25566 25845 I mobile-ffmpeg:   Stream #2:0 (gif) -> scale
10-19 12:49:28.476 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.552 25566 25845 W mobile-ffmpeg: [graph 0 input from stream 0:0 @ 0x7430270510] sws_param option is deprecated and ignored
10-19 12:49:28.553 25566 25845 W mobile-ffmpeg: [graph 0 input from stream 1:0 @ 0x7430271950] sws_param option is deprecated and ignored
10-19 12:49:28.553 25566 25845 W mobile-ffmpeg: [graph 0 input from stream 2:0 @ 0x7430272850] sws_param option is deprecated and ignored
10-19 12:49:28.555 25566 25845 W mobile-ffmpeg: [swscaler @ 0x75a04bb280] deprecated pixel format used, make sure you did set range correctly
10-19 12:49:28.759 25566 25845 I mobile-ffmpeg: [libx264 @ 0x74a0369820] using cpu capabilities: ARMv8 NEON
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: [libx264 @ 0x74a0369820] profile High, level 4.0, 4:2:0, 8-bit
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: [libx264 @ 0x74a0369820] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - 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=12 lookahead_threads=2 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
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: Output #0, mp4, to 'tmp.mp4':
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg:   Metadata:
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg:     encoder         : 
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: Lavf58.48.100
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg:     Stream #0:0
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: : Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1026x1824, q=-1--1
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: , 
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: 25 fps, 
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: 12800 tbn, 
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: 25 tbc
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg:  (default)
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg:     Metadata:
10-19 12:49:28.764 25566 25845 I mobile-ffmpeg:       encoder         : 
10-19 12:49:28.765 25566 25845 I mobile-ffmpeg: Lavc58.96.100 libx264
10-19 12:49:28.765 25566 25845 I mobile-ffmpeg: 
10-19 12:49:28.765 25566 25845 I mobile-ffmpeg:     Side data:
10-19 12:49:28.765 25566 25845 I mobile-ffmpeg:       
10-19 12:49:28.765 25566 25845 I mobile-ffmpeg: cpb: 
10-19 12:49:28.765 25566 25845 I mobile-ffmpeg: bitrate max/min/avg: 0/0/0 buffer size: 0 
10-19 12:49:28.765 25566 25845 I mobile-ffmpeg: vbv_delay: N/A
10-19 12:49:28.765 25566 25845 I mobile-ffmpeg: 
10-19 12:49:29.020 25566 25845 I mobile-ffmpeg: frame=   26 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A dup=15 drop=0 speed=   0x    

Environment

  • Platform: Android
  • Architecture: ARMv8-A (Samsung s10+)
  • Version: 4.5.1-1.LTS
  • Android Studio version: 4.0
  • Android NDK version: 25.1.8937393

Metadata

Metadata

Assignees

Labels

ffmpeg-bugSomething isn't right in ffmpeg source codefixed-in-v6.0v5.1Affects v5.1 release

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions