How to convert I420 frames to BGRA format with gst-launch-1.0?

随声附和 提交于 2019-12-12 03:33:20

问题


I had a raw video file named video.i420 based on I420 format. And I tried to convert it into BGRA format using gst-launch-1.0:

gst-launch-1.0 filesrc location=video.i420 ! videoparse width=1920 height=816 format=2 framerate=24/1 ! videoconvert ! videoparse format=12 ! filesink location=video.bgra

But the output file video.bgra sized only 48 bytes larger than the source file.

Then I played the video.bgra with the followed command:

gst-launch-1.0 filesrc location=video.bgra ! videoparse width=1920 height=816 format=2 framerate=24/1 ! videoconvert ! autovideosink

and it's the same as playing the source file.

What's wrong with the pipeline I created for format conversion? And why didn't it convert as I expect?


回答1:


How about this:

gst-launch-1.0 filesrc location=video.i420 ! videoparse width=1920 height=816 format=i420 framerate=24/1 ! videoconvert ! video/x-raw, format=bgra ! filesink location=video.bgra

I have changed the magic numbers to human readable formats. Just for readability, it should work with numbers as well.

Aside from that. What is required is to tell videoconvert a definitive video format. I think the videoparser just parses data, but does not enforce specific caps on its predecessor element.



来源:https://stackoverflow.com/questions/38951754/how-to-convert-i420-frames-to-bgra-format-with-gst-launch-1-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!