1

I'm trying to use ffmpeg for edit some videos on android... It is working fine but if I try to use drawtext i get error

the command is:

path/ffmpeg -y -i /path/asd.mp4 -map 0 -segment_time 15 -f segment -c:v libx264 -preset veryfast -crf 30 -vf "drawtext=text='test message ':fontfile=/path/arial.ttf:box=1:boxborderw=30:boxcolor=0xE86F67@0.7:fix_bounds=true:fontcolor=0x2A363B:fontsize=32:x=0:y=h" -r 30 -force_key_frames expr:gte(t,n_forced*15) -an /path/temp%03d.mp4

and the error is:

 ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
  built with Android (4691093 based on r316199) clang version 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55536e7d904e0abae47888fc7f) (https://android.googlesource.com/toolchain/llvm 34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn)
 configuration: --prefix=/home/rafa/Desktop/m4/build --target-os=linux --arch=i686 --cpu=i686 --cross-prefix=/home/rafa/Desktop/m4/ndk/toolchain/i686/bin/i686-linux-android- --enable-cross-compile --cc=/home/rafa/Desktop/m4/ndk/toolchain/i686/bin/clang --cxx=/home/rafa/Desktop/m4/ndk/toolchain/i686/bin/clang++ --sysroot=/home/rafa/Desktop/m4/ndk/toolchain/i686/sysroot --pkg-config=/usr/bin/pkg-config --pkg-config-flags=--static --enable-pic --enable-gpl --enable-nonfree --enable-static --disable-shared --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-doc --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libx264 --enable-libfdk-aac --enable-bsf=aac_adtstoasc --enable-librtmp --enable-zlib --enable-libfreetype --enable-openssl --enable-libfontconfig --disable-asm --disable-devices --extra-cflags=-mno-stackrealign
  libavutil      56. 14.100 / 56. 14.100
 libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
     libavfilter     7. 16.100 /  7. 16.100
    libswscale      5.  1.100 /  5.  1.100
     libswresample   3.  1.100 /  3.  1.100
     libpostproc    55.  1.100 / 55.  1.100



   major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     title           : 20180226 174005
     artist          : Rafael Lima
     date            : 2018
     encoder         : Lavf55.49.100
     comment         : https://www.youtube.com/watch?v=bkzc9mLyCyo
   Duration: 00:03:26.94, start: 0.000000, bitrate: 4156 kb/s
     Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 4025 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
     Metadata:
       handler_name    : VideoHandler
     Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
     Metadata:
       handler_name    : SoundHandler
 Automatic encoder selection failed for output stream #0:1. Default encoder for format segment (codec none) is probably disabled. Please choose an encoder manually.
 Error selecting an encoder for stream 0:1

things to considere: 1. I've checked 3 times all the paths are valid 2. I've tested the same command on ffmpeg 4.0 on windows and it works [with the same video] 3. If I remove the drawtext filter it works fine...

I tought it ffmpeg was built without drawtext or with some error so i spent 10 days in order to build it bymyself and guarantee every dependency is ok... but at end i got the same error

does anyone have any idea please

============================== UPDATE

I keep testing and if I remove the quotes from the filter and use a text without spacing it works

ex: drawtext=text='test_message':fontfile=/path/arial.ttf:box=1:boxborderw=30:boxcolor=0xE86F67@0.7:fix_bounds=true:fontcolor=0x2A363B:fontsize=32:x=0:y=h

so I believe there is something related to how android is escapes quotes and simple quotes because i compiled ffmpeg with same parameters and it runs on ubuntu with spaces at the text (just need to use simple quotes)

does anyone know about it?

Rafael Lima
  • 3,079
  • 3
  • 41
  • 105

0 Answers0