Android Question Library PndFFmpegKit error

cb56

Member
Licensed User
Longtime User
Hello,

I try to convert a video file with this library but with a "MKV" file my activity is interrupted and I cannot see any messages in the log.

With "mp4" or "avi" files it works fine.

Is there a way to understand what the error is?

Thank you
B4X:
FFmpegCommand = "-i X.mkv -vcodec libx264 -qscale 0 X_converted.mp4"'

FFmpegKit.ExecuteAsync(FFmpegCommand)
 

DonManfred

Expert
Licensed User
Longtime User
Check the unfiltered log. There must be an error if your activity interupt.
 
Upvote 0

cb56

Member
Licensed User
Longtime User
This is my log, then activity killed name is "PlayVideo" (cb56 Package)
 

Attachments

  • log.zip
    53.7 KB · Views: 216
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
This code work fine on my device:
B4X:
Dim InputFile As String = File.Combine(File.DirInternal, "samsung-uhd-dubai.mkv")
Dim OutputFilePath As String = File.Combine(File.DirInternal, "2.mp4")
Dim FFmpegCommand As String = "-i " & InputFile & " -vcodec libx264 -vf scale=1280:720 " & OutputFilePath

This code is WRONG:
B4X:
FFmpegCommand = "-i X.mkv -vcodec libx264 -qscale 0 X_converted.mp4"'
X.mkv and X_converted.mp4 cannot be used like you use it in FFmpegCommand, please check example app or use proper code like in my examples in this post.

You can also use -qscale 30 as -qscale 0 will create extremely large file.
This code also work fine on my device:
B4X:
Dim InputFile As String = File.Combine(File.DirInternal, "samsung-uhd-dubai.mkv")
Dim OutputFilePath As String = File.Combine(File.DirInternal, "2.mp4")
Dim FFmpegCommand As String = "-i " & InputFile & " -vcodec libx264 -qscale 30 " & OutputFilePath
 
Upvote 0

cb56

Member
Licensed User
Longtime User
This code is WRONG:
B4X:
FFmpegCommand = "-i X.mkv -vcodec libx264 -qscale 0 X_converted.mp4"'
X.mkv and X_converted.mp4 cannot be used like you use it in FFmpegCommand, please check example app or use proper code like in my examples in this post.

I know, sorry it was only an example :-(

My code was:

B4X:
FFmpegCommand:-i "/storage/emulated/0/@Temp4/20220210_095456.mp4" -vcodec libx264 -qscale 0 "/storage/emulated/0/@Temp4/20220210_095456_cv_fsp.mp4"



B4X:
 -vcodec libx264 -vf scale=1280:720
Works fine

But if I omit "vf scale=1280:720" the Activity is killed..mybe Out of memory problem?
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
I will just repeat my answer:
Use -qscale 30 or -qscale 50 as -qscale 0 will create extremely large file depend of video size and length, file can easy reach 100GB.
You force using -qscale 0 but you do not understand what that command do. There is all kind of limits in Android system, you break some of them, for example is not possible to write file over 4GB on SD card.

You can see crash with unfiltered logs as crash is not in library but system kill your app.

EDIT:
You can also try to start app in Release mode.
 
Upvote 0
Top