tanersener / react-native-ffmpeg

FFmpeg for react-native. Not maintained anymore. Superseded by FFmpegKit.
GNU General Public License v3.0
401 stars 52 forks source link

not able to merge two videos recorded from front camera and back camera #179

Closed sahilshah668 closed 4 years ago

sahilshah668 commented 4 years ago

Description I'm trying to record video using react-native-camera first half is recorded using front camera and second half is recorded using rare camera, now i want to merge two videos recorded but the thing is i'm not able to do so

Expected behavior merging gets successfull

Current behavior not able to merge the videos

Screenshots If applicable, add screenshots to help explain your problem.

Logs [Sat Jun 20 2020 11:48:23.384] LOG configuration: --cross-prefix=aarch64-linux-android- --sysroot=/files/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android24-clang --cxx=aarch64-linux-android24-clang++ --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disa [Sat Jun 20 2020 11:48:23.386] LOG libavutil 56. 38.100 / 56. 38.100

[Sat Jun 20 2020 11:48:23.388] LOG libavcodec 58. 65.102 / 58. 65.102

[Sat Jun 20 2020 11:48:23.390] LOG libavformat 58. 35.101 / 58. 35.101

[Sat Jun 20 2020 11:48:23.392] LOG libavdevice 58. 9.103 / 58. 9.103

[Sat Jun 20 2020 11:48:23.393] LOG libavfilter 7. 70.101 / 7. 70.101

[Sat Jun 20 2020 11:48:23.395] LOG libswscale 5. 6.100 / 5. 6.100

[Sat Jun 20 2020 11:48:23.397] LOG libswresample 3. 6.100 / 3. 6.100

[Sat Jun 20 2020 11:48:23.517] LOG Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:///data/user/0/com.dashdub/cache/Camera/d0af7dc4-a84e-445c-ac0d-7e0ae3c85118.mp4':

[Sat Jun 20 2020 11:48:23.522] LOG Metadata:

[Sat Jun 20 2020 11:48:23.524] LOG major_brand : [Sat Jun 20 2020 11:48:23.526] LOG mp42 [Sat Jun 20 2020 11:48:23.528] LOG

[Sat Jun 20 2020 11:48:23.530] LOG minor_version : [Sat Jun 20 2020 11:48:23.532] LOG 0 [Sat Jun 20 2020 11:48:23.534] LOG

[Sat Jun 20 2020 11:48:23.536] LOG compatible_brands: [Sat Jun 20 2020 11:48:23.539] LOG isommp42 [Sat Jun 20 2020 11:48:23.542] LOG

[Sat Jun 20 2020 11:48:23.544] LOG creation_time : [Sat Jun 20 2020 11:48:23.547] LOG 2020-06-20T06:18:09.000000Z [Sat Jun 20 2020 11:48:23.548] LOG

[Sat Jun 20 2020 11:48:23.550] LOG com.android.version: [Sat Jun 20 2020 11:48:23.579] LOG 10 [Sat Jun 20 2020 11:48:23.581] LOG

[Sat Jun 20 2020 11:48:23.583] LOG Duration: [Sat Jun 20 2020 11:48:23.591] LOG 00:00:05.78 [Sat Jun 20 2020 11:48:23.596] LOG , start: [Sat Jun 20 2020 11:48:23.597] LOG 0.000000 [Sat Jun 20 2020 11:48:23.599] LOG , bitrate: [Sat Jun 20 2020 11:48:23.601] LOG 20831 kb/s [Sat Jun 20 2020 11:48:23.603] LOG

[Sat Jun 20 2020 11:48:23.605] LOG Stream #0:0 [Sat Jun 20 2020 11:48:23.606] LOG (eng) [Sat Jun 20 2020 11:48:23.608] LOG : Video: h264 (avc1 / 0x31637661), yuvj420p(pc, bt470bg/bt470bg/smpte170m), 1920x1080, 20184 kb/s [Sat Jun 20 2020 11:48:23.610] LOG , SAR 1:1 DAR 16:9 [Sat Jun 20 2020 11:48:23.611] LOG , [Sat Jun 20 2020 11:48:23.613] LOG 16.96 fps, [Sat Jun 20 2020 11:48:23.614] LOG 90k tbr, [Sat Jun 20 2020 11:48:23.616] LOG 90k tbn, [Sat Jun 20 2020 11:48:23.618] LOG 180k tbc [Sat Jun 20 2020 11:48:23.639] LOG (default) [Sat Jun 20 2020 11:48:23.642] LOG

[Sat Jun 20 2020 11:48:23.646] LOG Metadata:

[Sat Jun 20 2020 11:48:23.648] LOG rotate : [Sat Jun 20 2020 11:48:23.649] LOG 270 [Sat Jun 20 2020 11:48:23.651] LOG

[Sat Jun 20 2020 11:48:23.663] LOG creation_time : [Sat Jun 20 2020 11:48:23.665] LOG 2020-06-20T06:18:09.000000Z [Sat Jun 20 2020 11:48:23.667] LOG

[Sat Jun 20 2020 11:48:23.668] LOG handler_name : [Sat Jun 20 2020 11:48:23.670] LOG VideoHandle [Sat Jun 20 2020 11:48:23.671] LOG

[Sat Jun 20 2020 11:48:23.673] LOG Side data:

[Sat Jun 20 2020 11:48:23.675] LOG [Sat Jun 20 2020 11:48:23.677] LOG displaymatrix: rotation of 90.00 degrees [Sat Jun 20 2020 11:48:23.679] LOG

[Sat Jun 20 2020 11:48:23.681] LOG Stream #0:1 [Sat Jun 20 2020 11:48:23.682] LOG (eng) [Sat Jun 20 2020 11:48:23.684] LOG : Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s [Sat Jun 20 2020 11:48:23.704] LOG (default) [Sat Jun 20 2020 11:48:23.706] LOG

[Sat Jun 20 2020 11:48:23.707] LOG Metadata:

[Sat Jun 20 2020 11:48:23.710] LOG creation_time : [Sat Jun 20 2020 11:48:23.712] LOG 2020-06-20T06:18:09.000000Z [Sat Jun 20 2020 11:48:23.715] LOG

[Sat Jun 20 2020 11:48:23.717] LOG handler_name : [Sat Jun 20 2020 11:48:23.731] LOG SoundHandle [Sat Jun 20 2020 11:48:23.733] LOG

[Sat Jun 20 2020 11:48:23.734] LOG Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'file:///data/user/0/com.dashdub/cache/Camera/912280d5-c29e-4409-a36a-2746b4d7654f.mp4':

[Sat Jun 20 2020 11:48:23.741] LOG Metadata:

[Sat Jun 20 2020 11:48:23.744] LOG major_brand : [Sat Jun 20 2020 11:48:23.746] LOG mp42 [Sat Jun 20 2020 11:48:23.748] LOG

[Sat Jun 20 2020 11:48:23.751] LOG minor_version : [Sat Jun 20 2020 11:48:23.753] LOG 0 [Sat Jun 20 2020 11:48:23.766] LOG

[Sat Jun 20 2020 11:48:23.768] LOG compatible_brands: [Sat Jun 20 2020 11:48:23.770] LOG isommp42 [Sat Jun 20 2020 11:48:23.772] LOG

[Sat Jun 20 2020 11:48:23.773] LOG creation_time : [Sat Jun 20 2020 11:48:23.775] LOG 2020-06-20T06:18:21.000000Z [Sat Jun 20 2020 11:48:23.777] LOG

[Sat Jun 20 2020 11:48:23.779] LOG com.android.version: [Sat Jun 20 2020 11:48:23.780] LOG 10 [Sat Jun 20 2020 11:48:23.782] LOG

[Sat Jun 20 2020 11:48:23.784] LOG Duration: [Sat Jun 20 2020 11:48:23.785] LOG 00:00:04.48 [Sat Jun 20 2020 11:48:23.787] LOG , start: [Sat Jun 20 2020 11:48:23.788] LOG 0.000000 [Sat Jun 20 2020 11:48:23.809] LOG , bitrate: [Sat Jun 20 2020 11:48:23.811] LOG 20676 kb/s [Sat Jun 20 2020 11:48:23.813] LOG

[Sat Jun 20 2020 11:48:23.814] LOG Stream #1:0 [Sat Jun 20 2020 11:48:23.816] LOG (eng) [Sat Jun 20 2020 11:48:23.817] LOG : Video: h264 (avc1 / 0x31637661), yuvj420p(pc, bt470bg/bt470bg/smpte170m), 1920x1080, 19884 kb/s [Sat Jun 20 2020 11:48:23.819] LOG , SAR 1:1 DAR 16:9 [Sat Jun 20 2020 11:48:23.820] LOG , [Sat Jun 20 2020 11:48:23.833] LOG 27.72 fps, [Sat Jun 20 2020 11:48:23.835] LOG 30 tbr, [Sat Jun 20 2020 11:48:23.836] LOG 90k tbn, [Sat Jun 20 2020 11:48:23.838] LOG 180k tbc [Sat Jun 20 2020 11:48:23.840] LOG (default) [Sat Jun 20 2020 11:48:23.841] LOG

[Sat Jun 20 2020 11:48:23.843] LOG Metadata:

[Sat Jun 20 2020 11:48:23.845] LOG rotate : [Sat Jun 20 2020 11:48:23.849] LOG 90 [Sat Jun 20 2020 11:48:23.850] LOG

[Sat Jun 20 2020 11:48:23.852] LOG creation_time : [Sat Jun 20 2020 11:48:23.853] LOG 2020-06-20T06:18:21.000000Z [Sat Jun 20 2020 11:48:23.872] LOG

[Sat Jun 20 2020 11:48:23.874] LOG handler_name : [Sat Jun 20 2020 11:48:23.875] LOG VideoHandle [Sat Jun 20 2020 11:48:23.878] LOG

[Sat Jun 20 2020 11:48:23.879] LOG Side data:

[Sat Jun 20 2020 11:48:23.881] LOG [Sat Jun 20 2020 11:48:23.882] LOG displaymatrix: rotation of -90.00 degrees [Sat Jun 20 2020 11:48:23.884] LOG

[Sat Jun 20 2020 11:48:23.885] LOG Stream #1:1 [Sat Jun 20 2020 11:48:23.887] LOG (eng) [Sat Jun 20 2020 11:48:23.900] LOG : Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s [Sat Jun 20 2020 11:48:23.902] LOG (default) [Sat Jun 20 2020 11:48:23.903] LOG

[Sat Jun 20 2020 11:48:23.905] LOG Metadata:

[Sat Jun 20 2020 11:48:23.907] LOG creation_time : [Sat Jun 20 2020 11:48:23.909] LOG 2020-06-20T06:18:21.000000Z [Sat Jun 20 2020 11:48:23.910] LOG

[Sat Jun 20 2020 11:48:23.912] LOG handler_name : [Sat Jun 20 2020 11:48:23.913] LOG SoundHandle [Sat Jun 20 2020 11:48:23.915] LOG

[Sat Jun 20 2020 11:48:23.916] LOG Stream mapping:

[Sat Jun 20 2020 11:48:23.918] LOG Stream #0:0 (h264) -> concat:in0:v0 [Sat Jun 20 2020 11:48:23.920] LOG

[Sat Jun 20 2020 11:48:23.939] LOG Stream #0:1 (aac) -> concat:in0:a0 [Sat Jun 20 2020 11:48:23.941] LOG

[Sat Jun 20 2020 11:48:23.943] LOG Stream #1:0 (h264) -> concat:in1:v0 [Sat Jun 20 2020 11:48:23.944] LOG

[Sat Jun 20 2020 11:48:23.946] LOG Stream #1:1 (aac) -> concat:in1:a0 [Sat Jun 20 2020 11:48:23.948] LOG

[Sat Jun 20 2020 11:48:23.949] LOG concat:out:v0 [Sat Jun 20 2020 11:48:23.951] LOG -> Stream #0:0 (mpeg4)

[Sat Jun 20 2020 11:48:23.952] LOG concat:out:a0 [Sat Jun 20 2020 11:48:23.966] LOG -> Stream #0:1 (aac)

[Sat Jun 20 2020 11:48:23.968] LOG Press [q] to stop, [?] for help

[Sat Jun 20 2020 11:48:23.970] LOG frame= 0 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A [Sat Jun 20 2020 11:48:23.975] LOG [graph 0 input from stream 0:0 @ 0x7d68dec480] sws_param option is deprecated and ignored

[Sat Jun 20 2020 11:48:23.977] LOG [graph 0 input from stream 1:0 @ 0x7d68decb40] sws_param option is deprecated and ignored

[Sat Jun 20 2020 11:48:23.979] LOG [swscaler @ 0x73e43c9000] deprecated pixel format used, make sure you did set range correctly

[Sat Jun 20 2020 11:48:23.980] LOG [mp4 @ 0x7d68d75e00] Frame rate very high for a muxer not efficiently supporting it. Please consider specifying a lower framerate, a different muxer or -vsync 2

[Sat Jun 20 2020 11:48:23.982] LOG [mpeg4 @ 0x7d68d23600] timebase 1/1000000 not supported by MPEG 4 standard, the maximum admitted value for the timebase denominator is 65535

[Sat Jun 20 2020 11:48:23.984] LOG Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

[Sat Jun 20 2020 11:48:23.985] LOG Conversion failed!

[Sat Jun 20 2020 11:48:23.987] LOG {"rc": 1}

Environment

Other and after merging video im not able to call setstate it goes inside infinite loop.(this is also one issue)

tanersener commented 4 years ago

Can you please add the command you're using to merge videos?

You have the following warnings in your log. Did you notice them? They're self-explanatory.

Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2

[mpeg4 @ 0x7d68d23600] timebase 1/1000000 not supported by MPEG 4 standard, the maximum admitted value for the timebase denominator is 65535

Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
sahilshah668 commented 4 years ago

yeah i have read that but not able to understand properly command i'm using is -i ${merge_url} -i ${ this.state.video_uri } -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0] concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -y ${ RNFetchBlob.fs.dirs.DocumentDir }/video2.mp4

tanersener commented 4 years ago

How about trying recommendations given there, using -vsync 2 or setting fps?

Also you can try to use one of the GPL licensed packages. Some of your errors are about MPEG-4. GPL licensed packages has x264 encoder which can resolve those errors.

sahilshah668 commented 4 years ago

ok

sahilshah668 commented 4 years ago

and other thing is im not able to update state inside .then of ffmpeg it goes inside infinite loop possible solution i can use..??

tanersener commented 4 years ago

I don't understand what the problem is? .then is called at the end of command execution. Your logs show that it was called before. What has changed?

react-native-ffmpeg-test repository includes a few test applications. Why don't you take a look at them?

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.