This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] Linux/AM5728:通过 gstreamer 进行无损编码的视频流

Guru**** 2539900 points
Other Parts Discussed in Thread: AM5728

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/567710/linux-am5728-lossless-encoding-video-stream-via-gstreamer

器件型号:AM5728

工具/软件:Linux

我正在尝试通过 am5728 EVM 上的 gstreamer-1.0压缩来自摄像头模块的视频流。
我发现、随 Sitara Linux SDK 提供的 Ducati 编解码器有损、但我需要无损视频代码。 我知道 MJPEG 是我需要的
我在 gstreamer 上编写了一个小程序、该程序通过 avenc_MJPEG 对流进行编码、并将其保存为 avi 文件。 但有两个问题:

1.在摄像机模块上录制的视频比实际情况更快。
2.我已经检查了输出 avi 文件,发现 libav 中的 MJPEG 也有损耗(下面附有 Mediainfo 检查)。


我应该怎么做来解决这些问题?

我找到了 avenc_ljpeg、因为我知道它是用于视频的无损 jpeg 编码器、但它在我的流水线中不起作用。 我很奇怪、因为 avenc_MJPEG 几乎是一样的:
有相同的 src 模板、灌电流模板仅不同一种支持格式。
使用 avenc_mJPEG 的工作流水线: gst-launch-1.0 v4l2src num-buffers=100 device=/dev/video1! 视频转换 ! AVENC_MJPEG ! 救世主! 文件链接位置=./mjpeg-test.avi
不能使用 avenc_ljpeg 的流水线:  gst-launch-1.0 v4l2src num-buffers=100 device=/dev/video1! 视频转换 ! 天堂!  救世主! 文件链接位置=./mjpeg-test.avi

我还附上 GST 发布 ljpeg 管道的结果。

e2e.ti.com/.../3582.log.txt
 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您所指的两个编解码器都是软件编解码器(而非 TI 元件)。

    [引用 user="Ilya Kravchuk"]1. 在摄像机模块上录制的视频比实际情况快。[/quot]

    你能不能尝试设置……! 文件链接位置=…… SYNC=true?

    [引用 user="Ilya Kravchuk">无法使用 avenc_ljpeg 的流水线:  gs-launch-1.0 v4l2src num-buffers=100 device=/dev/video1! 视频转换 ! 天堂!  救世主! 文件链接位置=./MJPEG-test.avi[/quot]

    我建议:

    尝试使用 videotestsrc 元素而不是 v4l2src。

    2.set the formats (in caps) before and after video/convert element 元素。

    3.确保 avenc_ljpeg 支持的颜色格式是什么。 您可以通过 GST-CHECK VENC_Ljpeg 检查此问题。

    BR
    玛格丽塔

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我知道此编解码器不是 TI 元件。 我无法使用由 Ducati 插件提供的 TI 编解码器、因为该编解码器有损。
    当我尝试在文件链接中使用 videotestsrc 和 sync-true 或 sync-false 参数进行流水线时、可以确定、视频不会加速:

        gst-launch-1.0 videotestsrc num-buffers=50! 视频转换 ! AVENC_MJPEG ! 救世主! filesink locity=./mjpeg-sync.avi sync =true  

    当我尝试使用 v4l2src 和 sync-true 或 false 执行该操作时、输出视频文件的速度应高于:

        gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=50! 视频转换! AVENC_MJPEG! 救世主! filesink locity=./mjpeg-sync-v4l.avi sync =true

    当我尝试使用 ljpeg 执行此操作 并播放输出文件时、只会出现黑屏。  正如我在 GST 检查中看到的、ljpeg 与 MJPEG 完全相同。 唯一的区别是 ljpeg 可以与 BGR、BGRA、I420、Y444、Y42B src 一起工作、 当 MJPEG 只能与 I420、Y444、Y42B src 一起工作时、其他什么也不能工作。  

    当我尝试在视频转换之前和之后设置电容器时、会抛出错误、因为它在 src 和接收器上设置 BGR 格式、当它与 ljpeg 和 I420链接时、如果它与 MJPEG 链接:

    gst-launch-1.0 videotsrc -v num-buffers=500! capsfilter caps=video/x-raw、format=YUY2! 视频转换! capsfilter caps=video/x-raw、format=I420! 天堂! 救世主! filesink locity=./mjpeg-caps-sync.avi sync =true
    正在将管道设置为暂停...
    管道是 PREROLLING ...
    /GstPipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src:cap ="VIDEO/x-RAW\、\ format\=(string\) YUy2、\ width\=(int\) 320\、\ height\=(int\) 240\、\、\ fraperate\=(trade-bess\) 1)、bti-pixel 比率1 (1)
    /GstPipeline0/GstCapsFilter:capsfilter0.GstPad:src:cap ="VIDEO/x-RAW\、\ format\=(string\) YUy2\、\ width\=(int\) 320\、\ height\=(int\) 240\、\ frame\=(string\) ybers\(by-1)、pixelti-1 (bti-pixelt)、const-mode = 1)、conscyby-1 (pixel 1)
    /GstPipeline0/GstVideoConvert:videoconvert0.GstPad:src:cap ="video/x-raw、\ width\=(int\) 320\、\ height\=(int\) 240\、\ framerate\=(fraction \) 30/1、\像素-宽高比=(interlace =)、Istring = 1) 420 (progressive-traction 1)、intercortcort=(progress\(traction)、interlace 1)、int1)
    /GstPipeline0/GstCapsFilter:capsfilter1.GstPad:src:cap ="video/x-raw、\ width\=(int\) 320\、\ height\=(int\) 240\、\ framerate\=(fraction \) 30\、\ width\=(int\) 320\、\、\(contery-by-by-bace-rati=)、string =(progress-mode = 1)、Istraint-1 (frame=)、frame\(frame\(frame\)/frame\(frame\) bess-st-st-
    /GstPipeline0/GstCapsFilter:capsfilter1.GstPad:SINK:SINK:CAPs ="VIDEO/x-RAW\、\ width\=(int\) 320\、\ height\=(int\) 240\、\帧速率\=(分数\) 30\、\像素高宽=(int\) 420\、字符串1)、帧间比率=(1)、帧速率1)
    /GstPipeline0/GstVideoConvert:videoconvert0.GstPad:SINK:SINK:CAPs ="VIDEO/x-RAW\、\ format\=(string\) y2\、\ width\=(int\) 320\、\ height\=(int\) 240\、\、帧速率\=(frame\=) ybers\=(bace1)、ybers/ybers1 (bers1)/ybers1)
    /GstPipeline0/GstCapsFilter:capsfilter0.GstPad:SINK:SINK:CAPs ="VIDEO/x-RAW\、\ format\=(string\) YUy2、\ width\=(int\) 320\、\ height\=(int\) 240\、\、\ frame\=(strape-1) bacy=(pixel) 1)、bti-rity= 1)、const-mode 1 (pixelt 1)
    错误:来自元素/GstPipeline:流水 线0/GstVideoTestSrc:videotestsrc0:内部数据流错误。
    其他调试信息:
    ./../../../gstreamer-1.6.3/libs/gst/base/gstbasesrc.c (2943):gst_base_src_loop ():/GstPipeline:foopere0/GstVideoTestSrc:videTestsrc0:
    流任务暂停、原因未协商(-4)
    错误:管道不想进行预发布。
    正在将管道设置为 NULL ...
    /GstPipeline0/GstAviMux:aviMux0.GstPad:src:cap = video/x-msvideo
    /GstPipeline:流水线0/GstAviMux:aviMux0.GstPad:src:cap ="NULL"
    /GstPipeline:流水线0/GstCapsFilter:capsfilter1.GstPad:src:cap ="NULL"
    /GstPipeline:流水线0/GstCapsFilter:capsfilter1.GstPad:灌电流:电容="NULL"
    /GstPipeline:流水线0/GstVideoConvert:video.GstPad:src:cap ="NULL"
    /GstPipeline:流水线0/GstVideoConvert:video.GstPad:SINK:CAP ="NULL"
    /GstPipeline:流水线0/GstCapsFilter:capsfilter0.GstPad:src:cap ="NULL"
    /GstPipeline:流水线0/GstCapsFilter:capsfilter0.GstPad:SINK:CAP ="NULL"
    /GstPipeline:流水线0/GstVideoTestSrc:video.GstPad:src:cap ="NULL"
    正在释放管道...


     

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    我建议您在流水线中添加--gst-debug=3。

    BR
    玛格丽塔
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    您是否可以尝试在具有 gstreamer 1.6版本的 PC 上使用 avenc_ljpeg 运行流水线?
    我在装有 gstreamer 1.2版本的 PC 上尝试过,但在 ljpegenc 中似乎不支持格式 I420 (libav :0::在 LJPEG 中不支持颜色空间)。

    BR
    玛格丽塔
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    我修复了加速问题。 板载摄像头帧速率为100/1、我通过视频装饰 GstElement 将其转换为25/1:
    gst-launch-1.0 -v v4l2src device=/dev/video1 num-buffers=573 IO-mode=4! 视频! 视频/x-raw、宽=720、高=576! 视频装饰! 视频/x-raw、帧速率=25/1! 视频转换! capsfilter caps=video/x-raw、format=GRAY8! 救世主! filesink location="/"raW_gray (720*576).avi" sync-true
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    在具有 ljpeg 的 PC 流水线上、结果相同:
    正在将管道设置为暂停...
    管道是 PREROLLING ...
    /GstPipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src:cap = video/x-raw、format=(string) YUY2、width=(int) 320、height=(int) 240、framerate=(fraction) 30/1、 Pixer-Aspi-Ratio =(fraction) 1/1、Interlace-mode=(string) progressive
    /GstPipeline0/GstCapsFilter:capsfilter0.GstPad:src:cap = video/x-raw、format=(string) YUY2、width=(int) 320、height=(int) 240、framerate=(fraction) 30/1、 Pixer-Aspi-Ratio =(fraction) 1/1、Interlace-mode=(string) progressive
    /GstPipeline:流水 线0/GstVideoConvert:videoconvert0.GstPad:src:cap = video/x-raw、width=(int) 320、height=(int) 240、framerate=(fraction) 30/1、pixer-Aspi-Ratiity=(fraction) 1/1、 interlace-mode=(字符串)渐进,format=(字符串)I420
    /GstPipeline:流水线0/GstCapsFilter:capsfilter1.GstPad:src:cap = video/x-raw、width=(int) 320、height=(int) 240、frames=(fraction) 30/1、pixer-Aspi-Ratio =(fraction) 1/1、 interlace-mode=(字符串)渐进,format=(字符串)I420
    /GstPipeline0/avenc_ljpeg:avenc_ljpeg0.GstPad:灌电流:电容=视频/x-raw、width=(int) 320、height=(int) 240、framerate=(fraction) 30/1、像素纵横比=(fraction) 1/1、 interlace-mode=(字符串)渐进,format=(字符串)I420
    /GstPipeline:流水线0/GstCapsFilter:capsfilter1.GstPad:灌电流:电容=视频/x-raw、width=(int) 320、height=(int) 240、framerate=(fraction) 30/1、像素纵横比=(fraction) 1/1、 interlace-mode=(字符串)渐进,format=(字符串)I420
    /GstPipeline0/GstVideoConvert:videoconvert0.GstPad:SINK:Cap = VIDEO/x-RAW、format=(string) YUY2、width=(int) 320、height=(int) 240、framerate=(fraction) 30/1、 Pixer-Aspi-Ratio =(fraction) 1/1、Interlace-mode=(string) progressive
    /GstPipeline0/GstCapsFilter:capsfilter0.GstPad:SINK:CAPs = VIDEO/x-RAW、format=(string) YUY2、width=(int) 320、height=(int) 240、framerate=(fraction) 30/1、 Pixer-Aspi-Ratio =(fraction) 1/1、Interlace-mode=(string) progressive
    错误:从元素/GstPipeline:lipine0/avenc_ljpeg:avenc_ljpeg0:GStreamer 错误:协商问题。
    其他调试信息:
    gstvideoencoder.c (1368):gst_video_encoder_chain ():/GstPipeline:流水线0/avenc_ljpeg:avenc_ljpeg0:
    编码器未初始化
    错误:管道不想进行预发布。
    正在将管道设置为 NULL ...
    /GstPipeline0/avenc_ljpeg:avenc_ljpeg0.GstPad:sink:cap = NULL
    /GstPipeline:流水线0/GstCapsFilter:capsfilter1.GstPad:src:cap = NULL
    /GstPipeline:流水线0/GstCapsFilter:capsfilter1.GstPad:灌电流:电容=空
    /GstPipeline0/GstVideoConvert:video/GstPad:src:cap = NULL
    /GstPipeline0/GstVideoConvert:video/GstPad:sink:cap = NULL
    /GstPipeline:流水线0/GstCapsFilter:capsfilter0.GstPad:src:cap = NULL
    /GstPipeline:流水线0/GstCapsFilter:capsfilter0.GstPad:SINK:CAP = NULL
    /GstPipeline0/GstVideoTestSrc:video.GstPad:src:cap = NULL
    正在释放管道...
    Ilya@Ubuntu:~/视频$ GS-launch-1.0 videotestsrc num-buffers=50! 视频转换! 天堂! 救世主! filesink location=./ljpeg。aviSetting pipeline to paused……
    管道是 PREROLLING ...
    错误:从元素/GstPipeline:lipine0/avenc_ljpeg:avenc_ljpeg0:GStreamer 错误:协商问题。
    其他调试信息:
    gstvideoencoder.c (1368):gst_video_encoder_chain ():/GstPipeline:流水线0/avenc_ljpeg:avenc_ljpeg0:
    编码器未初始化
    错误:管道不想进行预发布。
    正在将管道设置为 NULL ...
    正在释放管道...
    Ilya@Ubuntu:~/视频$ GS
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    ljpeg 编码似乎存在格式问题。
    我在 avenc_mJPEG 中发现了这个问题、对于 avenc_ljpeg、这个问题看起来是一样的。
    lists.freedesktop.org/.../149457.html

    BR
    玛格丽塔
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我还尝试过 huffyuv 编解码器、它在我的 PC 上正常工作、但在板上却产生了非常奇怪的结果:

    gst-launch-1.0 videotestsrc num-buffers=500! 视频转换! 天堂! 救世主! filesink location=./huff.avi sync=true


    相同的流水线、在我的 PC 上使用 gstreamer 1.2.4播放



  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    很抱歉耽误你的时间。 它看起来像是颜色问题。
    我建议您尝试在编码器和设置电容器之后再连接一个视频转换元件。

    在电路板上有版本1.6 gstreamer、在 PC 上有版本1.2、我建议您在带有版本1.6 (而非1.2)的 PC 上尝试。

    BR
    玛格丽塔
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您的回复、但此编解码器已经不适用、因为它没有为灰度图像提供足够的压缩。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    然后、我将关闭此主题。

    BR
    玛格丽塔