如何使用gst-launch-1.0将I420帧转换为BGRA格式? [英] How to convert I420 frames to BGRA format with gst-launch-1.0?
问题描述
我有一个基于I420格式的原始视频文件,名为video.i420. 我尝试使用gst-launch-1.0将其转换为BGRA格式:
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
但是输出文件video.bgra的大小仅比源文件大48个字节.
But the output file video.bgra sized only 48 bytes larger than the source file.
然后我使用以下命令播放了video.bgra:
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
与播放源文件相同.
我为格式转换创建的管道出了什么问题?为什么它没有按我的预期转换?
What's wrong with the pipeline I created for format conversion? And why didn't it convert as I expect?
推荐答案
这是怎么回事:
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.
除此之外.需要的是告诉videoconvert
确定的视频格式.我认为videoparser
只是解析数据,但没有对其前任元素强制执行特定的上限.
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.
这篇关于如何使用gst-launch-1.0将I420帧转换为BGRA格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!