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.
You can set the huffman option to 0, i.e:
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