bravobit / FFmpeg-Android

FFMpeg/FFprobe compiled for Android
https://bravobit.nl/
MIT License
739 stars 175 forks source link

interrupting the merge video process without any explicit errors #77

Open torindev opened 5 years ago

torindev commented 5 years ago

Commands: ffmpeg_concat_videos_cmds.txt

Error: ffmpeg_error.txt

I might have thought this something wrong with my input files, but this is floating issue, and happens in 50% cases +-

observation: if I reduce amount of input files, let's say, to 27-28, this issue is disappear. If I increase amount of files - issue has the same behavior.

I don't understand why it's happens absolutely random... Parametres doesn't changing every iteration, input data always the same.

regarding attached files, as for me, everything looks fine, except last part:

frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
Brianvdb commented 5 years ago

Can you reproduce this on a PC too?

torindev commented 5 years ago

Can you reproduce this on a PC too?

I can't try, sorry. I think this is some ffmpeg limitation, but I don't found confirmation about this.

By the way, I solved this issue. I just split the sequence into pieces. For example, if I have 50 videos, first I merge 20, then another 20, and then last 10 videos. After this I have 3 videos and I can merge it.

Not clear, but it's works.

singhmeenu commented 5 years ago

I am trying to merge three small size of video. Its worked fine but for 64 bit I am using your project as a library module and getting error. Please help me

Commands: [-i, /storage/emulated/0/Reverse Video/.VideoPartsReverse/reverse_video0.mp4, -i, /storage/emulated/0/Reverse Video/.VideoPartsReverse/reverse_video1.mp4, -i, /storage/emulated/0/Reverse Video/.VideoPartsReverse/reverse_video2.mp4, -filter_complex, [0:v0] [0:a0] [1:v1] [1:a1] [2:v2] [2:a2] concat=n=3:v=1:a=1 [v] [a], -map, [v], -map, [a], /storage/emulated/0/Reverse Video/reverse_video_1564122871080.mp4]

Failed with output : ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 4.9.x (GCC) 20150123 (prerelease) configuration: --prefix=/home/test/ffmpeg-binary-android/build_scripts/build_dir --target-os=linux --arch=arm --cross-prefix=/home/test/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --enable-cross-compile --sysroot=/home/test/android-ndk-r15c/platforms/android-21/arch-arm/ --pkg-config=/usr/bin/pkg-config --pkg-config-flags=--static --enable-pic --enable-small --enable-gpl --enable-nonfree --disable-shared --enable-static --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-libmp3lame --enable-libx264 --enable-bsf=aac_adtstoasc --enable-openssl --enable-libfreetype --enable-libfontconfig --enable-pthreads --enable-zlib --disable-doc libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0xf71d7000] moov atom not found /storage/emulated/0/Reverse Video/.VideoPartsReverse/reverse_video0.mp4: Invalid data found when processing input

symphonyrecords commented 5 years ago

@singhmeenu

edit your commands to this:

[-i, /storage/emulated/0/Reverse Video/.VideoPartsReverse/reverse_video0.mp4, -i, /storage/emulated/0/Reverse Video/.VideoPartsReverse/reverse_video1.mp4, -i, /storage/emulated/0/Reverse Video/.VideoPartsReverse/reverse_video2.mp4, -filter_complex, [0:v:0] [0:a:0] [1:v:0] [1:a:0] [2:v:0] [2:a:0] concat=n=3:v=1:a=1 [v] [a], -map, [v], -map, [a], /storage/emulated/0/Reverse Video/reverse_video_1564122871080.mp4]

singhmeenu commented 4 years ago

@symphonyrecords thanks but still getting same error.

symphonyrecords commented 4 years ago

@singhmeenu I've just executed this code with success. if you run this code and still got error, then you may want to check your inputs. maybe testing with some other media files.

    final List<String> commandList = new LinkedList<>();
    commandList.add("-y");
    commandList.add("-i");
    commandList.add("/storage/emulated/0/MajidHoseinpoor-Video139_part_1.mp4");
    commandList.add("-i");
    commandList.add("/storage/emulated/0/MajidHoseinpoor-Video139_part_2.mp4");
    commandList.add("-i");
    commandList.add("/storage/emulated/0/MajidHoseinpoor-Video139_part_3.mp4");
    commandList.add("-filter_complex");
    commandList.add("[0:v:0][0:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1[outv][outa]");
    commandList.add("-map");
    commandList.add("[outv]");
    commandList.add("-map");
    commandList.add("[outa]");
    String output = Methods.getExternalStorageDirectory(this) + File.separator + "merged.mp4";
    commandList.add(output);
    FFmpeg.getInstance(this).execute(commandList.toArray(new String[0]), new ExecuteBinaryResponseHandler(){
        @Override
        public void onSuccess(String message) {
            super.onSuccess(message);
            SRToast.toastShort("DONE");
        }
        @Override
        public void onProgress(String message) {
            super.onProgress(message);
        }
        @Override
        public void onFailure(String message) {
            super.onFailure(message);
            SRToast.toastShort("FAILED");
        }
        @Override
        public void onStart() {
            super.onStart();
        }
        @Override
        public void onFinish() {
            super.onFinish();
        }
    });