Merging RGB Channels in FFMPEG

0

I have three grayscale videos, representing the red, green, and blue channels from a video. I extracted them using the extractplanes filter, and sent them through different pipelines.

Now I would like to combine them again. But while extractplanes is working perfectly, mergeplanes is not. My initial attempt was this:

[r][g][b] mergeplanes=0x001020 [output]

This interprets my RGB channels as YUV, which is not what I want. My next attempt was this:

[r][g][b] mergeplanes=0x001020:rgb24 [output]

But according to the error message, Only planar formats with more than one component are supported. (Same for all other RGB and RGBA pixel formats I tried.)

Is there another way to put these channels back together? Or some way to convince mergeplanes to output RGB?

Draconis

Posted 2016-10-14T18:42:38.397

Reputation: 101

Answers

0

As the error message says, mergeplanes can only output in a planar format: that is, all the first-component values together, then all the second-component values together, and so on. FFMPEG's RGB formats are non-planar: they group the values by pixel, not by component. So mergeplanes can't work with them.

However, FFMPEG does support the GBRP (Green-Blue-Red Planar) format. So you can have mergeplanes export to that, then convert to RGB from there. Just change the order of the components.

Draconis

Posted 2016-10-14T18:42:38.397

Reputation: 101