【问题标题】:LIBAV MJPEG encoding and huffman tableLIBAV MJPEG 编码和霍夫曼表
【发布时间】:2019-04-11 23:00:37
【问题描述】:

我正在尝试使用 libav(ffmpeg) 创建带有 MJPEG 视频有效负载的 RTP 流 示例代码非常简单,它适用于 MPEG1 我看到 MJPEG 中的编码有效,但是当我需要发送 mjpeg 帧 RTP 发件人向我返回错误:

[rtp @ 000000878ca77aa0] RFC 2435 需要标准 Huffman 表 JPEG

我在 libav 标头中看到注释:

/**
     * some codecs need / can use extradata like Huffman tables.
     * MJPEG: Huffman tables
     * rv10: additional flags
     * MPEG-4: global headers (they can be in the bitstream or here)
     * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
     * than extradata_size to avoid problems if it is read with the bitstream reader.
     * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
     * - encoding: Set/allocated/freed by libavcodec.
     * - decoding: Set/allocated/freed by user.
     */
    uint8_t *extradata;
    int extradata_size;

但是如何更正填充霍夫曼表或初始化默认表。 我必须为编码器设置标志吗? 谢谢。

【问题讨论】:

  • 互联网上应该有包含霍夫曼表的代码。
  • 你能举个例子吗?我找不到任何示例代码。谢谢

标签: c++ c video-processing mjpeg libav


【解决方案1】:

您可以将 huffman 选项设置为 0,即:

ffmpeg -i /dev/video0 -input_format mjpeg -f v4l2 -pix_fmt yuvj420p -vcodec mjpeg -huffman 0 -f rtp "rtp://127.0.0.1:10000" -sdp_file sdp_file 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多