Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Audio Video merge using ffmpeg- moov atom not found error

I am using below command for merging audio and video-

"-i", videoFileAbsolutePath, "-i", audioFileAbsolutePath, "-c:v", "copy", "-c:a", "aac", "-map", "0:v:0", "-map", "1:a:0", "-shortest", destinationFileAbsolutePath

For few videos I am getting below error-

ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers\n built with gcc 4.8 (GCC)\n 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=\n libavutil 55. 17.103 / 55. 17.103\n libavcodec 57. 24.102 / 57. 24.102\n libavformat 57. 25.100 / 57. 25.100\n libavdevice 57. 0.101 / 57. 0.101\n libavfilter 6. 31.100 / 6. 31.100\n libswscale 4. 0.100 / 4. 0.100\n libswresample 2. 0.101 / 2. 0.101\n libpostproc 54. 0.100 / 54. 0.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/keepvid/Amar_Akbar_Anthony_(HD)_-_Hindi_Full_Movie_-_Amitabh_Bachchan,_Vinod_Khanna,_Rishi_Kapoor,_1080P.mp4':\n Metadata:\n major_brand : dash\n minor_version : 0\n
compatible_brands: iso6avc1mp41\n creation_time : 2018-10-23 19:02:47\n Duration: 02:46:52.04, start: 0.000000, bitrate: 1528 kb/s\n Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 0 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)\n Metadata:\n creation_time : 2018-10-23 19:02:47\n handler_name : VideoHandler\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0xeb62d600] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0xeb62d600] moov atom not found\n/storage/emulated/0/keepvid/Amar_Akbar_Anthony_(HD)_-_Hindi_Full_Movie_-_Amitabh_Bachchan,_Vinod_Khanna,_Rishi_Kapoor,_1080P.m4a: Invalid data found when processing input

I got similar kind of error also while creating watermark-

"-i", videoFileAbsolutePath, "-i", imageFileAbsolutePath, "-filter_complex", "overlay=" + position, dest.getAbsolutePath()

ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers\n built with gcc 4.8 (GCC)\n 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=\n libavutil 55. 17.103 / 55. 17.103\n libavcodec 57. 24.102 / 57. 24.102\n libavformat 57. 25.100 / 57. 25.100\n libavdevice 57. 0.101 / 57. 0.101\n libavfilter 6. 31.100 / 6. 31.100\n libswscale 4. 0.100 / 4. 0.100\n libswresample 2. 0.101 / 2. 0.101\n libpostproc 54. 0.100 / 54. 0.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/WhatsApp Business/Media/WhatsApp Business Video/VID-20190215-WA0016.mp4':\n Metadata:\n major_brand : mp42\n minor_version : 1\n compatible_brands: mp41mp42isom\n creation_time : 2019-02-14 11:53:37\n Duration: 00:00:45.56, start: 0.000000, bitrate: 1444 kb/s\n Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 848x480, 1382 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)\n Metadata:\n creation_time : 2019-02-14 11:53:37\n handler_name : Core Media Video\n Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 59 kb/s (default)\n Metadata:\n creation_time : 2019-02-14 11:53:37\n handler_name : Core Media Audio\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0xf0e30600] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0xf0e30600] moov atom not found\n/storage/emulated/0/Movies/IMG-20190225-WA0030.jpg.mp4: Invalid data found when processing input\n

How can i resolve this error?

like image 401
varmashrivastava Avatar asked Nov 06 '22 21:11

varmashrivastava


1 Answers

If you want to have the same output format as the input format and we assume that the video file does not contain any audio stream, you can adapt the following FFmpeg command to android :

ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a aac -strict experimental output_merged.mp4

And if your one stream is longer than the other, you can add the -shortest option so that FFmpeg will stop encoding once one file ends.

like image 151
asendjasni Avatar answered Nov 11 '22 16:11

asendjasni