【发布时间】:2015-06-01 20:56:48
【问题描述】:
我正在尝试使用 gstreamer vaapi 编码器将 UYVY 颜色空间中的 RAW 流编码为 H264。
源管道:
gst-launch-1.0 -e videotestsrc ! video/x-raw, format=UYVY , framerate=60/1, width=1920, height=1080 ! filesink location=raw.yuv
编码器管道:
gst-launch-1.0 -v filesrc location=raw.yuv ! videoparse format=uyvy width=1920 height=1080 framerate=60 ! vaapiencode_h264 tune=high-compression ! mpegtsmux ! filesink location=final.ts
如果我尝试将其编码为 I420,则管道可以正常工作:
gst-launch-1.0 -v filesrc location=raw.yuv ! videoparse format=i420 width=1920 height=1080 framerate=60 ! vaapiencode_h264 tune=high-compression ! mpegtsmux ! filesink location=final.ts
检查时:
gst-inspect-1.0 vaapiencode_h264
我意识到 UYVY 没有在 video/x-raw(memory:VASurface) 功能下列出,但它在 video/x-raw 下列出。
video/x-raw(memory:VASurface)
format: { ENCODED, NV12, I420, YV12 }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
interlace-mode: progressive
video/x-raw
format: { I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }
我还尝试使用 videoconvert 将 UYVY 颜色空间转换为 I420,但无济于事。
是否可以使用 gstreamer 将 UYVY 编码为 h264?
【问题讨论】:
-
您的 videoconvert 管道是什么?它应该起作用了。做一个单一的管道工作吗?使用 videotestsrc 并直接链接到编码器?
-
videoconvert 管道:gst-launch-1.0 -v filesrc location=raw.yuv blocksize=1920000 !视频/x-raw,格式=UYVY,宽度=1920,高度=1080,帧率=15/1!视频转换!视频/x-raw,格式=I420,宽度=1920,高度=1080,帧率=15/1! vaapiencode_h264 tune=高压缩! mpegtsmux! filesink location=final.ts 错误:/GstPipeline:pipeline0/GstVideoConvert:videoconvert0:内部 GStreamer 错误:代码未实现。请在bugzilla.gnome.org/enter_bug.cgi?product=GStreamer 提交错误。
-
此外,单个管道也会失败。使用的管道:gst-launch-1.0 -e videotestsrc !视频/x-raw,格式=UYVY,帧率=60/1,宽度=1920,高度=1080! vaapiencode_h264 tune=高压缩! mpegtsmux! filesink location=final.ts 错误:错误:来自元素 /GstPipeline:pipeline0/GstVaapiEncodeH264:vaapiencodeh264-0:GStreamer 错误:协商问题。