B4A Library PndFFmpegKit - FFmpeg Library

FFmpegKit is a wrapper library that allows you to easily run FFmpeg/FFprobe commands in applications. It provides additional features on top of FFmpeg to enable platform specific resources, control how commands are executed and how the results are handled.
Original library: https://github.com/arthenica/ffmpeg-kit

Wrapper is based on v5.1.0 LTS version, supports Android API 16+
Supported Android architectures: arm-v7a, arm-v7a-neon, arm64-v8a, x86, x86-64.
You can use whatever command from FFmpeg, example app is just example how to use this lib/wrapper.
If you find FFmpeg command with quotes " replace quotes " to single quote ', like in variable FFmpegCommand in Video to Gif example.

Useful documentation and commands:




Example app: https://www.dropbox.com/s/z8z0iq9majtaill/FFmpegKitExample.zip?dl=0
Additional download: https://github.com/arthenica/ffmpeg-kit/releases/download/v5.1.LTS/ffmpeg-kit-full-gpl-5.1.LTS.aar
Put file from additional download in Additional library folder together with files from FFmpegKitLibrary.zip
 

Attachments

  • FFmpegKitLibrary.zip
    29.3 KB · Views: 211
Last edited:

asales

Expert
Licensed User
Longtime User
Great work. Thanks!

I saw that the ffmpeg-kit has several packages:

Can I use only the min package or the video package to decrease the final size of the app?

Thanks for your support.
 

asales

Expert
Licensed User
Longtime User
Is there a way to use the filter with (') in ExecuteAsync instead ExecuteWithArgumentsAsync?
(quote: because of this part :force_style='fontsize=70,PrimaryColour=&H00FF99AA' we need to use ExecuteWithArgumentsAsync as ExecuteAsync will remove ' from command)

I try to merge drawtext with subtitles. It works with ExecuteAsync, but I can't use the force_style.
B4X:
FFmpegCommand = "-i " & InputFilePath & " -vf 'drawtext=fontsize=40:text=" & TextOverVideo & ":y=85','subtitles=" & InputSubtitlesPath & "' -acodec copy -y " & OutputFilePath

If I use the same command in ExecuteWithArgumentsAsync, don't works.
B4X:
Dim FFmpegCommandArray() As String = Array As String("-i", InputFilePath, "-vf", "drawtext=fontfile=" & InputFontPath & ":text=" & TextOverVideo & ":fontsize=50:fontcolor=white", "subtitles=" & InputSubtitlesPath, "-acodec", "copy", "-y", OutputFilePath)

Any help are welcome. Thanks.
 

Pendrush

Well-Known Member
Licensed User
Longtime User
This code work:
B4X:
Dim FFmpegCommandArray() As String = Array As String("-i", InputFilePath, "-vf", "drawtext=fontfile=" & InputFontPath & ":text=" & TextOverVideo & ":fontsize=50:fontcolor=white:x=50:y=100", "-acodec", "copy", "-y", OutputFilePath)
 

asales

Expert
Licensed User
Longtime User
Thanks.
I found the problem. I was using the separator to drawtext and subtitle filters in FFmpegCommandArray and this is the problem.
Here is the correct code:
B4X:
Dim FFmpegCommandArray() As String = Array As String("-i", InputFilePath, "-vf", "drawtext=fontfile=" & InputFontPath & ":text=" & TextOverVideo  & ":fontsize=50:fontcolor=white:x=(w-text_w)/2:y=100" & ", subtitles=" & InputSubtitlesPath & ":force_style='fontsize=30,PrimaryColour=&H00FFFFFF,OutlineColour=&HFF000000,Bold=1,Alignment=10'", "-acodec", "copy", "-y", OutputFilePath)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…