[Live-devel] Live555 with ffmpeg's MJPEG codec

Silvain Beriault silvain.beriault at larus.com
Mon Jul 14 08:30:03 PDT 2008


Hello,

I am trying to stream real-time video data over RTP using live555 
library with MJPEG format. To to so, I created a derived class of 
JPEGVideoSource. Within the derived class, I have implemented the 
following methods:

a) The doGetNextFrame() method which dequeue an RGB video frame, 
converts it to YUV420 and then perform JPEG video compression.
b) The type() method returns 1 (based on Elphel example)
c) The width() and height() methods returns the frame width and height 
as per JPEG header computed in (a)
d) The qFactor() parameter was determined by scaling the ffmpeg's 
quantizer parameter [0..31] to a jpeg quality factor in the range [0..100].

I am less sure about (d). However, I could observe that when ffmpeg 
quantizer=4, setting qFactor() = 100-(4/31*100) = 87 gives "proper 
color" on the receiving side. However, it is still not right. The 
received video is very jumpy and, typically, the first 100 pixels or so 
appears at the end of each line of video. I wonder what is going wrong.

I know my JPEG encoder/decoder works fine as I did perform the following 
tests:
1) encode -> decode -> display without using live555
2) encode -> save to jpeg file -> open with any image viewer

Also I should add that I am only writing the JPEG payload (not the 623 
words header) to fTo buffer. and therefore I set fFrameSize = size-623

On the receiving end (when I combine live555 with ffmpeg jpeg codec), 
here is the errors returned by ffmpeg decoder:

[mjpeg @ 6BEA47E0]mjpeg_decode_dc: bad vlc: 0:0 (003DBEE0)
[mjpeg @ 6BEA47E0]error dc
[mjpeg @ 6BEA47E0]error y=29 x=34
[mjpeg @ 6BEA47E0]mjpeg_decode_dc: bad vlc: 0:0 (003DBEE0)
[mjpeg @ 6BEA47E0]error dc
[mjpeg @ 6BEA47E0]error y=29 x=35
[mjpeg @ 6BEA47E0]mjpeg_decode_dc: bad vlc: 0:0 (003DBEE0)
[mjpeg @ 6BEA47E0]error dc
[mjpeg @ 6BEA47E0]error y=29 x=34
[mjpeg @ 6BEA47E0]mjpeg_decode_dc: bad vlc: 0:0 (003DBEE0)
[mjpeg @ 6BEA47E0]error dc
[mjpeg @ 6BEA47E0]error y=29 x=34
[mjpeg @ 6BEA47E0]mjpeg_decode_dc: bad vlc: 0:0 (003DBEE0)
[mjpeg @ 6BEA47E0]error dc
[mjpeg @ 6BEA47E0]error y=29 x=34
[mjpeg @ 6BEA47E0]mjpeg_decode_dc: bad vlc: 0:0 (003DBEE0)
[mjpeg @ 6BEA47E0]error dc
[mjpeg @ 6BEA47E0]error y=29 x=35
[mjpeg @ 6BEA47E0]mjpeg_decode_dc: bad vlc: 0:0 (003DBEE0)
[mjpeg @ 6BEA47E0]error dc
[mjpeg @ 6BEA47E0]error y=29 x=37

Any help on that issue would be greatly appreciated
Silvain



More information about the live-devel mailing list