-7

enter image description hereI want to add overlay of video (with alpha component) on another video. I need to play and export that as well. I have tried many things ,many tutorials but i am unable to do that.

I have also tried to use FFMPEG but its to complicated to understand in short time.so i tried to use wrapper but i am unable to run that on my device. Is anyone have any idea how to do this ? NOTE : I need to export that as well.

Surjeet Rajput
  • 1,251
  • 17
  • 24

2 Answers2

0

As long as your video has been setup right to be transparent you can add the AVPlayerLayer over the other video and set this overlay video layer compositing filter to screenBlendMode.This is working for me on a current project.

overlayVideoLayer.compositingFilter = "screenBlendMode"
agibson007
  • 4,173
  • 2
  • 19
  • 24
0

I have try with using ffmpeg and its working

Command to Overlay

ffmpeg -y -i /videoloc/video.3gp -i /overlaylocation/Overlay.png -filter_complex [1][0]scale2ref[i][m];[m][i]overlay[v] -preset ultrafast -map [v] -map 0:a? -ac 2 /savevideolocation/file_20180427_125453.mp4

Amjad Khan
  • 1,309
  • 15
  • 32
  • bro i know how to do this with commands but my problem is how to make FFMPEG work in iOS ? I tried using the FFMPEG wrapper for ios but that was not working . Then i tried to understand on my own but that's too complicated. – Surjeet Rajput Apr 27 '18 at 08:28
  • I have use this for the android `https://github.com/WritingMinds/ffmpeg-android-java` – Amjad Khan Apr 27 '18 at 08:51
  • yes this library is awesome but i have't found its iOS alternative. – Surjeet Rajput Apr 27 '18 at 10:48
  • yes this is a way to build complied libraries but i don't how to use them.Like the class and their usage is very complicated. It's very difficult to learn that in short span of time. – Surjeet Rajput Apr 27 '18 at 11:40
  • check this https://stackoverflow.com/questions/35498103/how-to-build-ffmpeg-as-ios-framework – Amjad Khan Apr 27 '18 at 12:00