Closed foxtailmega closed 4 years ago
i see fribidi as default shaper and not harfbuzz. fribidi works for simple languages, but as soon as languages become complex like thai, arabic, chinese, indian languages, then it doesn't render the text correctly. Please help in enabling harfbuzz in flutter-ffmpeg
This issue has to be analysed in the parent project, mobile-ffmpeg. I know that harfbuzz
is disabled there but not sure if it is possible to enable it.
so is there any way to enable harfbuzz complex shaper in mobile-ffmpeg ? Because currently its rendering it incorrect with fribidi simple shaper. Its very much needed now.
You can try to build mobile-ffmpeg
yourself by enabling it here.
sure, let me try to build it myself and i will reply here how it goes.
I tried building parent project mobile-ffmpeg by changing some parameters
Here in this line android-freetype.sh. I changed it to --with-harfbuzz \
Also i changed here in this line android-libass.sh. I changed it to --enable-harfbuzz \
Now before making these changes, it used to build fully without any issues.
But after making these changes, build fails at fontconfig
fox@foxy:~/Desktop/expanded/mobile-ffmpeg$ ./android.sh --lts --disable-arm-v7a-neon --disable-arm64-v8a --disable-x86 --disable-x86-64 --full
Building mobile-ffmpeg LTS library for Android
Architectures: arm-v7a
Libraries: android-zlib, android-media-codec, fontconfig, freetype, fribidi, gmp, gnutls, lame, libass, libiconv, libtheora, libvorbis, libvpx, libwebp, libxml2, opencore-amr, shine, speex, wavpack, kvazaar, libilbc, opus, snappy, soxr, libaom, chromaprint, twolame, sdl, tesseract, openh264
Building arm-v7a platform on API level 16
fribidi: ok
gmp: ok
libiconv: ok
libvpx: ok
libxml2: ok
opencore-amr: ok
shine: ok
speex: ok
wavpack: ok
kvazaar: ok
libilbc: ok
opus: ok
snappy: ok
soxr: ok
libaom: ok
chromaprint: ok
sdl: ok
openh264: ok
giflib: ok
jpeg: ok
libogg: ok
libpng: ok
libuuid: ok
nettle: ok
tiff: ok
expat: ok
libsndfile: ok
freetype: ok
gnutls: ok
lame: ok
libvorbis: ok
libwebp: ok
twolame: ok
leptonica: ok
fontconfig: failed
HERE IS THE COMPLETE build.log
build.log
I did install libharfbuzz-dev
There is a misunderstanding there.
For example, to enable support for libwebp
, mobile-ffmpeg
builds libwebp
as you can see from the output. It does not install libwebp
using brew/apt/yum install libwebp-dev
. Installing libharfbuzz in that way will never work.
Well which of the below suggested step should i follow to enable harfbuzz library in ffmpeg ?
====================== suggestion 1============================
->
okay so first should i add harfbuzz library just like other library has been added to src
folder
->
and then in build
directory i should make android-harfbuzz.sh
and add all flags and config parameters there just like other libraries
->
and then in android.sh
i should declare that library and also change the parameters in android-libass.sh(--enable-harfbuzz ) and android-freetype.sh(--with-harfbuzz )
->
and run it so it builds using android-ndk ?
or
====================== suggestion 2============================
should i just change the parameters in android-libass.sh(--enable-harfbuzz \)
and android-freetype.sh(--with-harfbuzz \)
and just let it build ?
1)
i did build harfbuzz
but because there is a circle dependency
between harfbuzz
and freetype
, so
-> i first build freetype
normally without harfbuzz
and then
-> i build harfbuzz
with freetype
and fontconfig
, and it builds successfully,
But next i need to build again freetype with that previously built harfbuzz so as to incorporate harfbuzz into freetype, thats what is not working currently, and until harfbuzz support is not there in freetype, no use of enabling libass with harfbuzz support.
I need to sort out that circle dependency though.
Still i would like to test the generated aar android archive.
How do i test that mobile-ffmpeg.aar in flutter ? How do i add that to flutter ?
clone flutter_ffmpeg
, remove existing mobile-ffmpeg
dependency from build.gradle
file and add the dependency for your new .aar
file.
I had some rendering issue of subtitle when i tried to hardcode thai srt subtitle on video. For single tone in thai, it renders correctly but with double tone thai characters, which should be either two characters above or below, doesn't render correctly.
I asked this question to ffmpeg-user mailing list, and there, i figured out that other people had same issue and libass along with harfbuzz needs to be enabled in ffmpeg in order to render the text correctly. Now libass is available in flutter-ffmpeg but harfbuzz needs to be enabled too. Please help.