[Libav-user] Adding alpha channel to h264 encoder

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] Adding alpha channel to h264 encoder

Davood Falahati
Dear community,

I have a opevCV Mat frame, call it mask. I decode frames into AVFrame, convert AVFrame to openCV Mat and encode them into AVPacket again.

Now, I want to add an alpha channel to my resulting video. Can you help me with that?

- FYI, I tried to add alpha channel to openCV Mat and convert it to AVFrame. But it fades whole the video and it mars the color distribution.

Best
Davood Falahati
______________________________________________________


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Adding alpha channel to h264 encoder

Michael IV
As far as I know h264 doesn't support alpha.  But  VP8 does. 

On Sep 12, 2017 2:06 PM, "Davood Falahati" <[hidden email]> wrote:
Dear community,

I have a opevCV Mat frame, call it mask. I decode frames into AVFrame, convert AVFrame to openCV Mat and encode them into AVPacket again.

Now, I want to add an alpha channel to my resulting video. Can you help me with that?

- FYI, I tried to add alpha channel to openCV Mat and convert it to AVFrame. But it fades whole the video and it mars the color distribution.

Best
Davood Falahati
______________________________________________________


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Adding alpha channel to h264 encoder

Davood Falahati
Dear Michael,

Thanks for your reply. I changed the codec to qrtle and I found that there is an alpha channel added. My problem, however, exists. I translate opencv Mat with alpha plane to AVFrame. But in the resultin video I don't see the added alpha plane.

best,

______________________________________________________

Tel: +98 (913) 126-0265

On Tue, Sep 12, 2017 at 8:24 PM, Michael IV <[hidden email]> wrote:
As far as I know h264 doesn't support alpha.  But  VP8 does. 

On Sep 12, 2017 2:06 PM, "Davood Falahati" <[hidden email]> wrote:
Dear community,

I have a opevCV Mat frame, call it mask. I decode frames into AVFrame, convert AVFrame to openCV Mat and encode them into AVPacket again.

Now, I want to add an alpha channel to my resulting video. Can you help me with that?

- FYI, I tried to add alpha channel to openCV Mat and convert it to AVFrame. But it fades whole the video and it mars the color distribution.

Best
Davood Falahati
______________________________________________________


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Adding alpha channel to h264 encoder

Andy Shaules


On Sep 15, 2017 9:49 AM, "Davood Falahati" <[hidden email]> wrote:
Dear Michael,

Thanks for your reply. I changed the codec to qrtle and I found that there is an alpha channel added. My problem, however, exists. I translate opencv Mat with alpha plane to AVFrame. But in the resultin video I don't see the added alpha plane.

best,

______________________________________________________

Tel: <a href="tel:+98%20913%20126%200265" value="+989131260265" target="_blank">+98 (913) 126-0265

On Tue, Sep 12, 2017 at 8:24 PM, Michael IV <[hidden email]> wrote:
As far as I know h264 doesn't support alpha.  But  VP8 does. 

On Sep 12, 2017 2:06 PM, "Davood Falahati" <[hidden email]> wrote:
Dear community,

I have a opevCV Mat frame, call it mask. I decode frames into AVFrame, convert AVFrame to openCV Mat and encode them into AVPacket again.

Now, I want to add an alpha channel to my resulting video. Can you help me with that?

- FYI, I tried to add alpha channel to openCV Mat and convert it to AVFrame. But it fades whole the video and it mars the color distribution.

Best
Davood Falahati
______________________________________________________


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

hello. i would recommend writing your own pixel routine to composit the layers. its a good chance what does work in the libs is developed around a different use case. formats matter of course so one may want to go through the highest bits per pix such as 32 for the blend if its detailed and involves greenscreen types, but fidelity might be a thing and sometimes the warmth of the transform to rgba and back is undesired.

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Adding alpha channel to h264 encoder

Carl Eugen Hoyos-2
In reply to this post by Davood Falahati
2017-09-12 13:00 GMT+02:00 Davood Falahati <[hidden email]>:

> Now, I want to add an alpha channel to my resulting video.

Transparency in H.264 exists, an example is the file
alphaconformanceG.264 in alphaconformanceG.zip, but
libx264 (and no other h264 encoder I know) does not support
encoding such files and libavcodec (and no decoder I know)
does not support decoding the transparency layer.

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user