简体   繁体   中英

LIBAV MJPEG encoding and huffman table

I'm trying to create the RTP stream with MJPEG video payload using libav(ffmpeg) Sample code is really simple and it works with MPEG1 I see that encoding in MJPEG works but then when I need to send mjpeg frames RTP senders returns me the error:

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

I see comment in 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;

But how to correct fill huffman tables or init default tables. Are there flags I've to set for encoder? Thanks.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM