B4A Library mp4composer (Apply effects on video)

Hi friends ,
This is a (not fully tested) wrap of this project https://github.com/MasayukiSuda/Mp4Composer-android


If it is useful for you, please consider some donation :)

mp4composer
Author:
SMM
Version: 0.01
  • mp4composer
    Fields:
    • POSITION_RIGHT_BOTTOM As java.lang.String
    • POSITION_LEFT_BOTTOM As java.lang.String
    • POSITION_RIGHT_TOP As java.lang.String
    • POSITION_LEFT_TOP As java.lang.String
    Methods:
    • Start As void
    • ApplyGlMonochromeFilter As void
    • IsInitialized As boolean
    • Initialize (ba As anywheresoftware.b4a.BA, EventName As java.lang.String, srcPath As java.lang.String, destPath As java.lang.String) As void
    • ApplyGlVignetteFilter As void
    • setSize (height As int, width As int) As void
    • ApplyGlInvertFilter As void
    • ApplyGlGrayScaleFilter As void
    • ApplyGlToneCurveFilter (input As java.io.InputStream) As void
    • ApplyGlWatermarkFilter (watermark As android.graphics.Bitmap, position As java.lang.String) As void
    • ApplyGlSharpenFilter As void
    • ApplyGlSepiaFilter As void
    • ApplyGlBulgeDistortionFilter As void
    • ApplyGlSphereRefractionFilter As void
    • ApplyGlHazeFilter As void
    • ApplyGlGaussianBlurFilter As void
    • ApplyGlCGAColorspaceFilter As void
    • ApplyGlBoxBlurFilter As void
    • ApplyGlBilateralFilter As void
    Properties:
    • videoBitrate As int [write only]
    • Rotation As int [write only]

  • Fields:
    • clearColor As float[]
    Methods:
    • getHandle (arg0 As java.lang.String) As int
    • draw (arg0 As android.graphics.SurfaceTexture, arg1 As float[], arg2 As float[]) As void
    • onDraw As void
    • setUpSurface As void
    • release As void
    • setClearColor (arg0 As float, arg1 As float, arg2 As float, arg3 As float) As void
    Properties:
    • TextureId As int [read only]


Note : If you choose a right position , ApplyGlWatermarkFilter is not applied properly

my sample
B4X:
#Region  Project Attributes
    #ApplicationLabel: mp4composer
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim composer As mp4composer
    Private busy As Boolean = False
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    
End Sub
Sub activity_click
    
    If busy=False Then
        busy=True
        If File.Exists(File.DirDefaultExternal,"small.mp4")=False Then
            File.Copy(File.DirAssets,"small.mp4",File.DirDefaultExternal,"small.mp4")
        End If
        composer.Initialize("comp",File.Combine(File.DirDefaultExternal,"small.mp4"),File.Combine(File.DirDefaultExternal,"smalledited.mp4"))
        '        composer.Rotation=180
        '        composer.setSize(640 , 640)
        composer.ApplyGlInvertFilter
        composer.ApplyGlWatermarkFilter(LoadBitmap(File.DirAssets,"baicon.png"),composer.POSITION_RIGHT_BOTTOM)
        composer.Start
    End If
    
    
End Sub
Sub comp_onprogress(progress As Int)
    Log(progress&" %")
End Sub
Sub comp_oncompleted
    Log("Completed")
    busy=False
End Sub
Sub comp_oncanceled
    Log("Cancelled")
    busy=False
End Sub
Sub comp_onfailed(err As String)
    busy=False
    Log("error : "&err)
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 

Attachments

  • mp4compose-release.zip
    75.3 KB · Views: 345
Top