6

I am trying to merge two videos together, both have transparency, using the command

ffmpeg.exe -i person2.mov -vf "[in] scale=iw/2:ih/2,fade=out:300:30:alpha=1, pad=2*iw:ih [left]; movie=person2.mov, scale=iw/2:ih/2,fade=out:300:30:alpha=1 [right]; [left][right] overlay=main_w/3:0,fade=out:300:30:alpha=1 [out]" -b:v 768k Output_people.mov

By doing that I get the following output:

http://i263.photobucket.com/albums/ii122/Fernando461/Untitled.png

As you can see, it was possible to get the two videos to be on top of each other. But then, when I try to merge this video (Output_people.mov) with another video, it doesn't have the same transparency. Is it possible to keep transparency in the outcome?

Edit 1:

This is the output I get: https://www.dropbox.com/s/gpid1pptfio31gd/ffmpeg-20130701-193206.log

And by "it doesn't have the same transparecy" I meant that the background is black instead of being transparent, so if I put one video on top of each other, the one in the back is covered by a black part of the one in the front.

Edit 2: Adding -vcodec qtrle to the code worked. Thanks mark4o!

fernandonos
  • 173
  • 1
  • 4
  • 15
  • Please show your complete ffmpeg console output. What do you mean by, "when I try to merge this video (Output_people.mov) with another video, it doesn't have the same transparency"? – llogan Jul 02 '13 at 01:48
  • By "when I try to merge this video (Output_people.mov) with another video, it doesn't have the same transparency", I meant that there is no transparency, instead I only get a black background. – fernandonos Jul 02 '13 at 16:49
  • You should also show your command and the complete console output for when you are "merging" `Output_people.mov` (you can omit `-report`). – llogan Jul 02 '13 at 16:54
  • The command I used to merge the two videos into Output_people.mov is the one I put up there, and the output can be found in https://www.dropbox.com/s/gpid1pptfio31gd/ffmpeg-20130701-193206.log – fernandonos Jul 02 '13 at 17:00
  • I thought you meant you were then merging `Output_people.mov` with additional videos. – llogan Jul 02 '13 at 17:03
  • Oh, I see... I am sorry, my bad... I am, but I am using the same command I put up there, and passing Output_people.mov as the first video. – fernandonos Jul 02 '13 at 18:14
  • 1
    ...and from what I can tell that is where the issue is occurring, so the console output is required. – llogan Jul 02 '13 at 19:15

1 Answers1

8

You did not specify a video codec for the output, so it is using the default video codec for .mov files which is H.264 (libx264 encoder). However H.264 does not support an alpha channel. If you want transparency in your output video you will need to specify an output video codec that supports an alpha channel, such as the one used for your input, i.e. QuickTime Animation RLE (qtrle). To do this, add the option -c:v qtrle before the output file name. Another codec that supports an alpha channel and can be stored in .mov files is png.

You can check the list of encoders supported by your ffmpeg with ffmpeg -encoders. A command like ffmpeg -h encoder=qtrle will list information specific to that encoder, including the supported pixel formats. A pixel format that includes the string argb, rgba, abgr, bgra, gbra, or yuva has an alpha channel.

mark4o
  • 58,919
  • 18
  • 87
  • 102