Description
The library causes crash on Android 10 OnePlus 7
Expected behavior
That it doesn't crash and run the FFMPEG command
Current behavior
It crashes
Screenshots
If applicable, add screenshots to help explain your problem.
Logs
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
2020-01-18 16:58:33.275 ? A/DEBUG: Abort message: 'FORTIFY: %n not allowed on Android'
2020-01-18 16:58:33.275 ? A/DEBUG: x0 0000000000000000 x1 000000000000077b x2 0000000000000006 x3 0000007fdf5c09d0
2020-01-18 16:58:33.275 ? A/DEBUG: x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 0000000000000018
2020-01-18 16:58:33.275 ? A/DEBUG: x8 00000000000000f0 x9 a7ce324f22b551d4 x10 0000000000000001 x11 0000000000000000
2020-01-18 16:58:33.275 ? A/DEBUG: x12 fffffff0fffffbdf x13 000000005e22ebe0 x14 003a5adf995511f7 x15 0000a869332996be
2020-01-18 16:58:33.275 ? A/DEBUG: x16 0000007c734ef738 x17 0000007c734cdbe0 x18 199999999999999a x19 000000000000077b
2020-01-18 16:58:33.275 ? A/DEBUG: x20 000000000000077b x21 00000000ffffffff x22 00000000ffffffff x23 0000007fdf5c1594
2020-01-18 16:58:33.275 ? A/DEBUG: x24 0000007fdf5c0db0 x25 000000000000001d x26 000000000000006e x27 0000000000000000
2020-01-18 16:58:33.275 ? A/DEBUG: x28 0000007c756f2188 x29 0000007fdf5c0a70
2020-01-18 16:58:33.275 ? A/DEBUG: sp 0000007fdf5c09b0 lr 0000007c7347f404 pc 0000007c7347f430
2020-01-18 16:58:33.276 ? A/DEBUG: backtrace:
2020-01-18 16:58:33.276 ? A/DEBUG: #00 pc 0000000000073430 /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: a2584ee8458a61d422edf24b4cd23b78)
2020-01-18 16:58:33.276 ? A/DEBUG: #01 pc 00000000000b4b00 /apex/com.android.runtime/lib64/bionic/libc.so (__fortify_fatal(char const*, ...)+120) (BuildId: a2584ee8458a61d422edf24b4cd23b78)
2020-01-18 16:58:33.276 ? A/DEBUG: #02 pc 00000000000b40b4 /apex/com.android.runtime/lib64/bionic/libc.so (__vfprintf+10956) (BuildId: a2584ee8458a61d422edf24b4cd23b78)
2020-01-18 16:58:33.276 ? A/DEBUG: #03 pc 00000000000d189c /apex/com.android.runtime/lib64/bionic/libc.so (snprintf+232) (BuildId: a2584ee8458a61d422edf24b4cd23b78)
2020-01-18 16:58:33.276 ? A/DEBUG: #04 pc 0000000000201f18 /data/app/tech.trolls.memerAdmin-g7BDeo9_r7MEcWEx7IDoqw==/lib/arm64/libavformat.so
Environment

Here is a better formatted version of the logs
Can you share the command you're trying to execute?
Thanks for replying @tanersener ... Here's the command.
-f lavfi -i color=c=#FFFFFF:s=700x507:d=0.5 -ss 0 -i https://memeops.s3.ap-south-1.amazonaws.com/templates/video_214.mp4 -ss 0 -i /storage/emulated/0/Android/data/tech.trolls.memerAdmin/files/meme/text_1memer2.png -f lavfi -i anullsrc=channel_layout=mono:sample_rate=48000 -y -filter_complex [1:v]scale=668:389[1v_v];[1v_v]rotate=angle=0:fillcolor=none:out_w=rotw(0):out_h=roth(0)[1v_2];[0][1v_2]overlay=enable='between(t,0,100000)':x=16:y=102[x];[2:v]scale=668:54[2v_v];[2v_v]rotate=angle=0:fillcolor=none:out_w=rotw(0):out_h=roth(0)[2v_2];[x][2v_2]overlay=enable='between(t,0,100000)':x=16:y=16[xx];[3:a]atrim=0:0[1a_start];[1:a]atrim=0:100000[1a_trim];[1a_start][1a_trim]concat=n=2:v=0:a=1[1a_toBeMixed];[1a_toBeMixed]amix=inputs=1:duration=longest[out_a] -map [xx] -map [out_a]? -vcodec libx264 -pix_fmt yuv420p -crf 20 -strict -2 -movflags +faststart /storage/emulated/0/1579519220954Memes.mp4
However, it works perfectly on devices below Android 10. Crashes on Android 10. For now, I am avoiding running it on Android 10 but I'll have to come up with a solution real soon. Thank you so much for helping.
Just an idea here try adding this to your manifest
android:requestLegacyExternalStorage="true"
That will test if it is scoped storage that is causing the problem.
I was having issues with libvlc and scoped storage in android 10 until i added that to my manifest.
4.3.1 lts full gpl works on my galaxy s10+ with android 10.
I think this issue is caused by ffmpeg, not by mobile-ffmpeg.
Newer LTS versions 4.2.2.LTS and 4.3.1.LTS doesn't have this issue. Can you try using one of these two?
@stooged I already have this line in the manifest but I am not getting permission related issues with the executable so this won't help. Thank you so much for your help though. 馃憤
@tanersener , I'll try it with these versions and then update this thread. 馃憤
@tanersener .. Just tried it. Now using version 4.2.2.LTS as you suggested. Working like magic!
Can't thank you enough buddy! Keep up the good work! :D
my app crass with this if video length > 20 Sec else video length small then work fine
public static class pgBarAsync extends ProgressBarAsync {
@Override
protected Void doInBackground(Void... voids) {
super.doInBackground();
try {
final String font = "drawtext=fontfile='" + download_folder+"/text.ttf':text='@user" + item.fb_id+ "':fontsize=16:fontcolor=white:x=10:y=40:enable='lte(t,3)',drawtext=fontfile='" + download_folder+"/text.ttf':text='@user"+ item.fb_id+"':fontsize=16:fontcolor=white:x=w-tw-10:y=h-th-10:enable='gte(t,3)'";
MediaPlayer mpl = MediaPlayer.create(getApplicationContext(), Uri.parse(ts_folder +"/"+item.video_id+"no_watermark"+".mp4"));
int videoLength = (mpl.getDuration()/1000);
Log.d("duration", "::>"+videoLength);
//ffmpeg -y -i '255871.mov' -qscale:v 0 -qscale:a 0 -vf '[in] transpose=1 [out];movie=watermark.mov [bg]; [out][bg] overlay=x=20:y=main_h-60 [out]' output.mp4
//final String font_txt = "drawtext=text='" + "@" + Variables.u_name +"_"+ Variables.u_id.substring(Math.max(0,Variables.u_id.length() - 7)) + "':fontfile=" + download_folder+"/"+"text.otf"+": fontcolor=white: fontsize=24: x=(w-tw)/2: y=(h/PHI)+th box=0:";
//String[] complexCommand = {"-y", "-i", ts_folder +"/"+ item.video_id+"no_watermark"+".mp4", "-i", download_folder+"/"+"logo.gif" , "-filter_complex", "overlay=x10:y=10:format=auto:enable='lte(t,3)'", "overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-25:format=auto:enable='gte(t,3)'", font ,"-c:a", "copy" , "-preset", "ultrafast", "-r", "30" , "-vcodec", "libx264", public_download_folder +"/"+item.video_id+".mp4" };
String[] complexCommand = {"-y", "-i", ts_folder +"/"+ item.video_id+"no_watermark"+".mp4" , "-i", download_folder+"/"+"logo.gif" ,"-filter_complex", "[0:v][1:v]overlay=x=10:y=10:format=auto:enable='lte(t,3)':shortest=1[bg];[bg][1:v]overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-25:format=auto:enable='gte(t,3)':shortest=1,"+font+",format=yuv420p[v]", "-map", "[v]", "-map", "0:a", "-c:a", "copy", "-preset", "ultrafast", "-r", "30", "-t",String.valueOf(videoLength) , "-vcodec", "libx264", public_download_folder +"/"+item.video_id+".mp4"};
//String[] complexCommand = {"-y", "-i", ts_folder +"/"+ item.video_id+"no_watermark"+".mp4", "-qscale:v", "0", "-qscale:a", "0", "-vf", "[in] transpose=1 [out];movie=" +download_folder+"/"+"watermark.mov" + "[bg]; [out][bg] overlay=x=20:y=main_h-60 [out]", font , public_download_folder +"/"+item.video_id+".mp4"};
int rc = 100101;
try
{
rc = FFmpeg.execute(complexCommand);
}catch (Exception e)
{
Log.d("ffmpeg", e.toString());
}
if (rc == RETURN_CODE_SUCCESS) {
// Delete_file_no_watermark(item);
// Scan_file(item);
// Toast.makeText(getApplicationContext(), "Successfully downloaded", Toast.LENGTH_SHORT).show();
} else if (rc == RETURN_CODE_CANCEL) {
// Delete_file_no_watermark(item);
// Scan_file(item);
// Toast.makeText(getApplicationContext(), "Try Again", Toast.LENGTH_SHORT).show();
} else {
// Delete_file_no_watermark(item);
// Scan_file(item);
// Toast.makeText(getApplicationContext(), "Try Again", Toast.LENGTH_SHORT).show();
}
}catch (Exception e)
{
// Toast.makeText(getApplicationContext(), "Try Again", Toast.LENGTH_SHORT).show();
Log.d("FFmpeg","download error");
// Delete_file_no_watermark(item);
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
if(is_waterm_ok)
{
Delete_file_no_watermark(item);
Scan_file(item);
Toast.makeText(getApplicationContext(), "Successfully downloaded", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(getApplicationContext(), "Try Again", Toast.LENGTH_SHORT).show();
Delete_file_no_watermark(item);
Scan_file(item);
}
}
}
I think this issue is caused by
ffmpeg, not bymobile-ffmpeg.Newer LTS versions
4.2.2.LTSand4.3.1.LTSdoesn't have this issue. Can you try using one of these two?
That's a great solution. Using 4.2.2.LTS tag, my FFMpeg is also working in Android API 29 and over. Thanks @tanersener
Most helpful comment
I think this issue is caused by
ffmpeg, not bymobile-ffmpeg.Newer LTS versions
4.2.2.LTSand4.3.1.LTSdoesn't have this issue. Can you try using one of these two?