LIBAV MJPEG编码和霍夫曼表

问题描述 投票:0回答:1

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

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

我在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;

但是如何纠正填充霍夫曼表或init默认表。是否有我要为编码器设置的标志?谢谢。

c++ c video-processing mjpeg libav
1个回答
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 
© www.soinside.com 2019 - 2024. All rights reserved.