Skip to main content
Post Undeleted by Saeid Honardan

I am trying to add image overlay on video using "mobile-ffmpeg-full-gpl:4.4" library but faced 'Error when evaluating the expression 'between(t' for enable'following error.

Error when evaluating the expression 'between(t' for enable

`class ImageFilter {

class ImageFilter {

    static String getFilter(String input, String output, ArrayList<ExtraTL> listImage, int order){
        String filter="";
        for (int i=0; i<listImage.size(); i++){
            ImageHolder image = listImage.get(i).imageHolder;
            int index = i+order;
            String in = i==0?input:"[out"+index+"]";
            String out = i==listImage.size()-1?output:"[out"+(index+1)+"];";
            filter += prepareImage(image, index);
            filter += addImage(in, out, image, index);
        }
        return filter;
    }

    private static String prepareImage(ImageHolder image, int index){
        return "["+index+":v]scale="+image.width+":"
                    +image.height+",rotate="+image.rotate+":c=none:ow=rotw("+image.rotate
                    +"):oh=roth("+image.rotate+")[ov"+index+"];";
    }

    private static String addImage(String input, String output, ImageHolder image, int index){
        return input+"[ov"+index+"]overlay="+image.x
                +":"+image.y+":enable=between(t,"+image.startInTimeLineSec +","
                +image.endInTimeLineSec +")"+output;
    }`

How can I resolve this error? Thanks...

I am trying to add image overlay on video using "mobile-ffmpeg-full-gpl:4.4" library but faced 'Error when evaluating the expression 'between(t' for enable' error.

`class ImageFilter {

static String getFilter(String input, String output, ArrayList<ExtraTL> listImage, int order){
    String filter="";
    for (int i=0; i<listImage.size(); i++){
        ImageHolder image = listImage.get(i).imageHolder;
        int index = i+order;
        String in = i==0?input:"[out"+index+"]";
        String out = i==listImage.size()-1?output:"[out"+(index+1)+"];";
        filter += prepareImage(image, index);
        filter += addImage(in, out, image, index);
    }
    return filter;
}

private static String prepareImage(ImageHolder image, int index){
    return "["+index+":v]scale="+image.width+":"
                +image.height+",rotate="+image.rotate+":c=none:ow=rotw("+image.rotate
                +"):oh=roth("+image.rotate+")[ov"+index+"];";
}

private static String addImage(String input, String output, ImageHolder image, int index){
    return input+"[ov"+index+"]overlay="+image.x
            +":"+image.y+":enable=between(t,"+image.startInTimeLineSec +","
            +image.endInTimeLineSec +")"+output;
}`

How can I resolve this error? Thanks...

I am trying to add image overlay on video using "mobile-ffmpeg-full-gpl:4.4" library but faced following error

Error when evaluating the expression 'between(t' for enable

class ImageFilter {

    static String getFilter(String input, String output, ArrayList<ExtraTL> listImage, int order){
        String filter="";
        for (int i=0; i<listImage.size(); i++){
            ImageHolder image = listImage.get(i).imageHolder;
            int index = i+order;
            String in = i==0?input:"[out"+index+"]";
            String out = i==listImage.size()-1?output:"[out"+(index+1)+"];";
            filter += prepareImage(image, index);
            filter += addImage(in, out, image, index);
        }
        return filter;
    }

    private static String prepareImage(ImageHolder image, int index){
        return "["+index+":v]scale="+image.width+":"
                    +image.height+",rotate="+image.rotate+":c=none:ow=rotw("+image.rotate
                    +"):oh=roth("+image.rotate+")[ov"+index+"];";
    }

    private static String addImage(String input, String output, ImageHolder image, int index){
        return input+"[ov"+index+"]overlay="+image.x
                +":"+image.y+":enable=between(t,"+image.startInTimeLineSec +","
                +image.endInTimeLineSec +")"+output;
    }

How can I resolve this error?

Post Deleted by Saeid Honardan
deleted 228 characters in body
Source Link
2021-03-05 10:06:13.212 18957-19112/com.hecorat.azplugin2 E/mobile-ffmpeg: [overlay @ 0xdfa96880] [Eval @ 0xc3f5eb70] Missing ')' or too many args in 'between(t'

2021-03-03 17:26:32.167 11664-11830/com.hecorat.azplugin2 E/mobile-ffmpeg: [overlay @ 0xdc5f3b80] Error when evaluating the expression "between(t" for enable'

2021-03-05 10:06:13.212 18957-19112/com.hecorat.azplugin2 E/mobile-ffmpeg: [AVFilterGraph @ 0xc74469c0] Error initializing filter 'overlay'

2021-03-05 10:06:13.212 18957-19112/com.hecorat.azplugin2 E/mobile-ffmpeg: [AVFilterGraph @ 0xc74469c0]  with args '333.33334:333.33334:enable=between(t'
2021-03-05 10:06:13.212 18957-19112/com.hecorat.azplugin2 E/mobile-ffmpeg: [overlay @ 0xdfa96880] [Eval @ 0xc3f5eb70] Missing ')' or too many args in 'between(t'

2021-03-03 17:26:32.167 11664-11830/com.hecorat.azplugin2 E/mobile-ffmpeg: [overlay @ 0xdc5f3b80] Error when evaluating the expression "between(t" for enable'

2021-03-05 10:06:13.212 18957-19112/com.hecorat.azplugin2 E/mobile-ffmpeg: [AVFilterGraph @ 0xc74469c0] Error initializing filter 'overlay'

2021-03-05 10:06:13.212 18957-19112/com.hecorat.azplugin2 E/mobile-ffmpeg: [AVFilterGraph @ 0xc74469c0]  with args '333.33334:333.33334:enable=between(t'
 E/mobile-ffmpeg: [overlay @ 0xdfa96880] [Eval @ 0xc3f5eb70] Missing ')' or too many args in 'between(t'

 E/mobile-ffmpeg: [overlay @ 0xdc5f3b80] Error when evaluating the expression "between(t" for enable'

 E/mobile-ffmpeg: [AVFilterGraph @ 0xc74469c0] Error initializing filter 'overlay'

 E/mobile-ffmpeg: [AVFilterGraph @ 0xc74469c0]  with args '333.33334:333.33334:enable=between(t'
Source Link

Image overlay on video between two times using mobile-ffmpeg android

I am trying to add image overlay on video using "mobile-ffmpeg-full-gpl:4.4" library but faced 'Error when evaluating the expression 'between(t' for enable' error.

I have a class that create overlay filter for adding image:

`class ImageFilter {

static String getFilter(String input, String output, ArrayList<ExtraTL> listImage, int order){
    String filter="";
    for (int i=0; i<listImage.size(); i++){
        ImageHolder image = listImage.get(i).imageHolder;
        int index = i+order;
        String in = i==0?input:"[out"+index+"]";
        String out = i==listImage.size()-1?output:"[out"+(index+1)+"];";
        filter += prepareImage(image, index);
        filter += addImage(in, out, image, index);
    }
    return filter;
}

private static String prepareImage(ImageHolder image, int index){
    return "["+index+":v]scale="+image.width+":"
                +image.height+",rotate="+image.rotate+":c=none:ow=rotw("+image.rotate
                +"):oh=roth("+image.rotate+")[ov"+index+"];";
}

private static String addImage(String input, String output, ImageHolder image, int index){
    return input+"[ov"+index+"]overlay="+image.x
            +":"+image.y+":enable=between(t,"+image.startInTimeLineSec +","
            +image.endInTimeLineSec +")"+output;
}`

FFMPEG Command used:

-loop 1 -i /storage/emulated/0/OP_Video_Editor/.temp/background.png -ss 0.0 -t 21.18 -i /storage/emulated/0/OP_Video_Editor/.temp/1614097633623.mp4 -i /storage/emulated/0/OP_Video_Editor/.resource/sticker_i02.png -filter_complex [1:v]crop=640:360:0:0[crop];[crop]scale=1280:720[v_scale];color=black:1280x720,fps=30[bgr0];[bgr0][0:v]overlay[bgr];[bgr][v_scale]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:shortest=1[v1];[1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=1.0[a1];[v1][a1]concat=n=1:v=1:a=1[v][a];[a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=1.0[a0];[a0]amix=inputs=1:duration=longest:dropout_transition=1[outAudio];[2:v]scale=333:333,rotate=-0.0:c=none:ow=rotw(-0.0):oh=roth(-0.0)[ov2];[v][ov2]overlay=333.33334:333.33334:enable=between(t,0.0,10.0)[inText] -map [inText] -map [outAudio] -format yuva420p -preset ultrafast -video_track_timescale 90k -b:v 2000k -c:v libx264 -bufsize 64k -c:a aac -bsf aac_adtstoasc -strict -2 -y /storage/emulated/0/videoExport/videoplayback_22_21_28_18_44_10.mp4 

Also my log when I run program is:

2021-03-05 10:06:13.212 18957-19112/com.hecorat.azplugin2 E/mobile-ffmpeg: [overlay @ 0xdfa96880] [Eval @ 0xc3f5eb70] Missing ')' or too many args in 'between(t'

2021-03-03 17:26:32.167 11664-11830/com.hecorat.azplugin2 E/mobile-ffmpeg: [overlay @ 0xdc5f3b80] Error when evaluating the expression "between(t" for enable'

2021-03-05 10:06:13.212 18957-19112/com.hecorat.azplugin2 E/mobile-ffmpeg: [AVFilterGraph @ 0xc74469c0] Error initializing filter 'overlay'

2021-03-05 10:06:13.212 18957-19112/com.hecorat.azplugin2 E/mobile-ffmpeg: [AVFilterGraph @ 0xc74469c0]  with args '333.33334:333.33334:enable=between(t'

How can I resolve this error? Thanks...