0

I am trying to build a mosaic from multiple videos in an android application using FFmpeg, I have found the wiki on how to do it. The link explains the process well but I am getting this error while processing it:

I/Videokit: start run in main.

register_exit

term_init & parse options.

D/Videokit: ERROR OCCURED

The library that I'm using is WritingMinds, which is FFmpeg for Android compiled with x264, libass, fontconfig, freetype, fribidi and lame (Supports Android 4.1+). Basically, you write a string array of code which is passed to FFmpeg and it runs FFmpeg for you.

Clearly, it is a parsing error but I believe that I have put the command in order. I have tested the files, locations and FFmpeg with other commands like trim, mute audio etc and only mosaic doesn't work. I have tried different options, string manipulations but that didn't work, Furthermore, I've seen OpenGl error if I put a big typo error. Here is the code on the wiki:

    -i 1.avi -i 2.avi -i 3.avi -i 4.avi
    -filter_complex "
        nullsrc=size=640x480 [base];
        [0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];
        [1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];
        [2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];
        [3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright];
        [base][upperleft] overlay=shortest=1 [tmp1];
        [tmp1][upperright] overlay=shortest=1:x=320 [tmp2];
        [tmp2][lowerleft] overlay=shortest=1:y=240 [tmp3];
        [tmp3][lowerright] overlay=shortest=1:x=320:y=240
    "
    -c:v libx264 output.mkv

This is the code which is on the wiki

String[] m =new String[]{"-i",
                DestPath1.toString(),
                "-i",
                DestPath2.toString(),
                "-i",
                DestPath3.toString(),
                "-i",
                DestPath4.toString(),
                "-filter_complex",
                "\"",
                "nullsrc=size=640x480 [base];",
                "[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];",
                "[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];",
                "[2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];",
                "[3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright];",
                "[base][upperleft], overlay=shortest=1", "[tmp1];",
                "[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];",
                "[tmp2][lowerleft] overlay=shortest=1:y=240 [tmp3];",
                "[tmp3][lowerright] overlay=shortest=1:x=320:y=240",
                "\"",
                " -c:v",
                "libx264",
                FinalPath.toString()};
                execFFmpegBinary(m);

This is the string that I send to the FFmpeg.

The expected result would be a video created on the "FinalPath" which is on the external storage. However, I am getting an error message and nothing else. I have a tight deadline so it would be hard for me to switch to another system and learn it, I'm already new to FFmpeg stuff. Any suggestions?

Update: I've implemented error handlers of the library, not just FFmpeg part, and it points reports as ('"nullsrc' is not a filter) . However, I need to put (") into there to run the code and I use it as (\"), which does not solve the problem. Removing them is not an option because the statement after the filter needs the quotation marks.

Update2: Here is the current log:

D/FileLog: Started command : ffmpeg [Ljava.lang.String;@7931693
    FAILED with output : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
      built with gcc 4.8 (GCC)
      configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
      libavutil      55. 17.103 / 55. 17.103
      libavcodec     57. 24.102 / 57. 24.102
      libavformat    57. 25.100 / 57. 25.100
      libavdevice    57.  0.101 / 57.  0.101
      libavfilter     6. 31.100 /  6. 31.100
      libswscale      4.  0.100 /  4.  0.100
      libswresample   2.  0.101 /  2.  0.101
      libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Pictures/appName/Vid1.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.25.101
      Duration: 00:00:45.05, start: 0.033333, bitrate: 694 kb/s
        Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 460x258 [SAR 1:1 DAR 230:129], 562 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Pictures/appName/Vid2.mp4':
      Metadata:
        major_brand     : mp42
        minor_version   : 0
        compatible_brands: isommp42
        creation_time   : 2017-01-15 09:57:32
      Duration: 00:00:40.82, start: 0.000000, bitrate: 352 kb/s
        Stream #1:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 360x360 [SAR 1:1 DAR 1:1], 253 kb/s, 28.90 fps, 29 tbr, 29 tbn, 58 tbc (default)
        Metadata:
          handler_name    : VideoHandler
        Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)
        Metadata:
          creation_time   : 2017-01-15 09:57:32
          handler_name    : IsoMedia File Produced by Google, 5-11-2011
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Pictures/appName/Vid3.mp4':
      Metadata:
        major_brand     : mp42
        minor_version   : 1
        compatible_brands: mp41mp42isom
        creation_time   : 2017-12-15 12:10:56
      Duration: 00:00:47.26, start: 0.000000, bitrate: 775 kb/s
        Stream #2:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 480x480, 706 kb/s, 26.98 fps, 27 tbr, 600 tbn, 1200 tbc (default)
        Metadata:
          creation_time   : 2017-12-15 12:10:56
          handler_name    : Core Media Video
        Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 65 kb/s (default)
        Metadata:
          creation_time   : 2017-12-15 12:10:56
          handler_name    : Core Media Audio
    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Pictures/appName/Vid4.mp4':
      Metadata:
        major_brand     : mp42
        minor_version   : 19529854
        compatible_brands: mp42isom
        creation_time   : 2017-12-17 10:05:07
      Duration: 00:00:14.33, start: 0.000000, bitrate: 803 kb/s
        Stream #3:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 k
D/FileLog: Finished command : ffmpeg [Ljava.lang.String;@7931693
V/FA: Inactivity, disconnecting from the service

0 Answers0