2

背景:

  • 我正在从 Bosch VideoJet x40 网络视频编码器流式传输视频。它最多可读取 4 个模拟摄像机输入并输出 RTP 流。
  • 我正在提供来自旧 VCR(拯救大兵瑞恩!)的测试镜头,使用一根黄色视频复合电缆将其连接到网络编码器的输入。
  • 这些RTP 流作为 H.264 编码视频在 UDP/RTP 数据包上发送。YUV I420 颜色空间中的编码视频数据。

我的 gstreamer 管道读取 RTP 数据包,将它们从 YUV 转换为原始 RGB,然后保存它们。到目前为止,它在这方面工作正常:

gst-launch --gst-debug=2 -vv udpsrc caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" port=33314 ! rtph264depay ! h264parse ! ffdec_h264 ! ffmpegcolorspace ! "video/x-raw-rgb, bpp=(int)24, depth=(int)24, framerate=(fraction)25/1, interlaced=(boolean)false" ! filesink location="privateryan.rgb"

这是该命令的调试输出,该命令大部分正常工作并保存 RAW RGB 视频输出。这个文件在几秒钟后就很大(正如预期的那样),所以如果你运行这个命令要小心:

Setting pipeline to PAUSED ...
/GstPipeline:pipeline0/GstUDPSrc:udpsrc0.GstPad:src: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:src: caps = video/x-h264
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au
/GstPipeline:pipeline0/ffdec_h264:ffdec_h2640.GstPad:sink: caps = video/x-h264, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)704, height=(int)240, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au
/GstPipeline:pipeline0/ffdec_h264:ffdec_h2640.GstPad:sink: caps = video/x-h264, width=(int)704, height=(int)240, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au
/GstPipeline:pipeline0/ffdec_h264:ffdec_h2640.GstPad:src: caps = video/x-raw-yuv, width=(int)704, height=(int)240, framerate=(fraction)25/1, format=(fourcc)I420, interlaced=(boolean)false, pixel-aspect-ratio=(fraction)5/11
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp0.GstPad:src: caps = video/x-raw-rgb, bpp=(int)24, depth=(int)24, framerate=(fraction)25/1, interlaced=(boolean)false, width=(int)704, height=(int)240, pixel-aspect-ratio=(fraction)5/11, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp0.GstPad:sink: caps = video/x-raw-yuv, width=(int)704, height=(int)240, framerate=(fraction)25/1, format=(fourcc)I420, interlaced=(boolean)false, pixel-aspect-ratio=(fraction)5/11
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw-rgb, bpp=(int)24, depth=(int)24, framerate=(fraction)25/1, interlaced=(boolean)false, width=(int)704, height=(int)240, pixel-aspect-ratio=(fraction)5/11, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw-rgb, bpp=(int)24, depth=(int)24, framerate=(fraction)25/1, interlaced=(boolean)false, width=(int)704, height=(int)240, pixel-aspect-ratio=(fraction)5/11, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/x-raw-rgb, bpp=(int)24, depth=(int)24, framerate=(fraction)25/1, interlaced=(boolean)false, width=(int)704, height=(int)240, pixel-aspect-ratio=(fraction)5/11, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321

录制后,我使用 Vooya 原始序列播放器检查文件并播放它们。但是,如果没有告诉 Vooya 视频是隔行扫描的,文件就无法正确播放。

我需要平面封装框架,以后可以提取这些框架用于计算机视觉应用。

在这里您可以看到正在播放的视频,尽管视频格式错误(隔行扫描):

http://i.imgur.com/QDZSWdJ.png

当我将设置更改为所需的设置时,您可以在此处看到视频未播放:

http://i.imgur.com/zSrOvFj.png

因此,我尝试将 deinterlace 插件添加到我的管道中,但没有成功。我可能做错了什么?

这是我的新管道,在文件接收器之前有去隔行:

gst-launch --gst-debug=1 -v udpsrc caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,frame-rate=(fraction)25/1" port=33314 ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! "video/x-raw-rgb, bpp=(int)24, depth=(int)24, framerate=(fraction)25/1, interlaced=(boolean)false" ! deinterlace ! filesink location="privateryan.rgb"
0:00:00.096569700 12969       0x607080 ERROR           GST_PIPELINE ./grammar.y:614:gst_parse_perform_link: could not link ffmpegcsp0 to deinterlace0
WARNING: erroneous pipeline: could not link ffmpegcsp0 to deinterlace0

为什么我的视频在所有这些处理之后仍然出现隔行扫描,关于隔行扫描插件我可能做错了什么?

我认为 VCR 或 B&W 摄像机可能会在其末端交错视频,但我不确定。即使它们是,我也无法改变它,仍然需要去隔行扫描。

谢谢!

4

0 回答 0