Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MJPEG support #23

Closed
MichaelAronsen opened this issue May 25, 2016 · 7 comments
Closed

MJPEG support #23

MichaelAronsen opened this issue May 25, 2016 · 7 comments
Labels

Comments

@MichaelAronsen
Copy link

Hi,

Not sure this should be an issue, but rather a question.

But since v4l2 device in the pi now has mjpeg support, would it be possible to simply stream the raw mjpeg stream from v4l2 over rtsp using v4l2rtspserver?

Reason I ask is that mjpeg would allow for higher resolution and less compression.

Regards,
Michael

@mpromonet
Copy link
Owner

Hi,

This works, but the bandwidth is much higher.
I don't undersand why do you think jpeg capture allow higher resolution, the compression is done after capture.

Regards,
Michel.

@MichaelAronsen
Copy link
Author

MichaelAronsen commented May 25, 2016

It allows higher resolution as there is some limit in the pi GPU code that
limits h264 to max 1920x1080, where as mjpeg is not limited.

See this post:
http://www.lewisroberts.com/2015/05/15/raspberry-pi-mjpeg-at-30fps/

@MichaelAronsen
Copy link
Author

How would I enable mjpeg streaming rather than h264?

@mpromonet
Copy link
Owner

using -fJPEG

@prechtl
Copy link

prechtl commented Jun 18, 2016

I am trying to implement this mjpeg encoding as well. I have taken the basic instructions and made the following changes:

I set the original uv4l command using:
sudo uv4l --driver raspicam --auto-video_nr --encoding mjpeg

Then as you suggest, I call the server w/ the -fJPEG option using
./v4l2rtspserver -s -fJPEG

However, when I include the '-fJPEG' option and open my VLC terminal to view the rtsp://:8554/unicast stream, my VLC window just jumps back and forth between two sizes - but no video shows up. Whereas if I eliminate the '-fJPEG' option I get video to show up. Problem is that when I view the 'Codec information' in VLC for this video, it ID's the Codec as: 'H264 - MPEG-4 AVC (part 10) (h264)' So it's unclear to me that this is using mjpeg encoding ... seems tied to H264.

(fyi: I'm interested in avoiding H264 b/c of the parallel question I have asked in this github project where I'm trying to capture full field-of-view video that uses all 2592 x 1944 pixels of the raspberry pi camera)

@mpromonet
Copy link
Owner

mpromonet commented Jun 19, 2016

Hi prechtl,

If you are using uv4l (that is closed source), I guess you should use --encoding jpeg. Generaly I prefer to use the official V4L2 driver bcm2835-v4l2

Using -s option is probably a bad idea, it will read from the V4L2 capture device and send to network in the same thread.

An other point is the RFC2435 encode width and height dividing by 8 and storing as 8bit. Then the maximum is 2040x2040.

But there is many others problem... trying with vlc I got the problem you describe, and with ffplay the size is the half of the capture one.

Regards,
Michel.

@prechtl
Copy link

prechtl commented Jun 23, 2016

I agree - there seem to be many problems. I installed the uv4l drivers hoping it would help - but uv4l seems to add a lot of additional resources.

Can you provide an example command to generate video w/ v4l2 (using 'v4l2-ctl' specifiers, I guess?). For example, to generate video with vlc, you can use a command:
cvlc --no-audio v4l2:///dev/video0 --v4l2-width 1920 --v4l2-height 1440 --v4l2-chroma MJPG

What is the equivalent command that is compatible with your v4l2rtspserver code (using -fJPEG)?

(I am assuming here that your rtsp server takes the place of vlc in transmitting the video data?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants