gpt4 book ai didi

c++ - LIBAV MJPEG编码和霍夫曼表

转载 作者:行者123 更新时间:2023-11-28 04:29:57 26 4
gpt4 key购买 nike

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

[rtp @ 000000878ca77aa0] RFC 2435 requires standard Huffman tables for jpeg

我在 libav header 中看到注释:

/**
* 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;

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

最佳答案

您可以将 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 

关于c++ - LIBAV MJPEG编码和霍夫曼表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53207692/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com