Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize live broadcast of raspberry pie

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how raspberry pie can achieve live broadcast". The content is easy to understand and clear. I hope it can help you solve your doubts. Next, let the editor lead you to study and learn the article "how raspberry pie achieves live broadcast".

There are two ways to realize live broadcast by raspberry pie.

1. Through the USB camera

two。 Through CSI (raspberry pie camera)

Today, we implement LVB through CSI, but we also introduce the solution of LVB with USB camera.

Mjpg-streamer

Support CSI (official camera of raspberry pie)

Open source project github:mjpg-streamer

Effect picture

Basics: the difference between cmake and make

Realization process

1. Download mjpg-streamer

Wget https://github.com/jacksonliam/mjpg-streamer/archive/master.zip

2.Building & Installation

Sudo install cmake libjpeg8-dev

3. Decompress master.zip

Unzip master.zip

Decompressed directory

Drwxr-xr-x 3 pi pi 4096 Apr 12 05:24 mjpg-streamer-master/

4. Compile and install mjpg_steamer

Cmake points to the directory where CMakeLists.txt is located, such as cmake.. Indicates that CMakeLists.txt is in a directory one level above the current directory. Cmake generates a lot of compiled intermediate files as well as makefile files, so generally a new _ build is created specifically for compilation.

Cd mjpg-streamer-experimentalmkdir _ buildcd _ buildcmake.. makesudo make install

Make compiles the program according to the generated makefile file

Description:

Make is make all, compiled-- compiled only, which files are compiled depends on your Makefile

Make install, compiled and installed (for example, installed in the / usr/bin directory, and then can be used directly. Since only administrators can add files to / usr/bin, sudo is usually added)

5./etc/default/tmpfs:

# mount / tmp as a tmpfs. Defaults to no; set to yes to enable (/ tmp)

# will be part of the root filesystem if disabled). / tmp may also be

# configured to be a separate mount in / etc/fstab.

RAMTMP=yes

6.Reboot

7.raspistill-tl 500-t 999999-vf-w 960-h 720-o / tmp/mjpg/test.jpg-n-Q 50 &

8.mjpg_streamer-I 'input_file.so-f / tmp/mjpg-r'

9. Start mjpg_streamer

Pi@xxxxxx:~/mjpg-streamer-experimental$ mjpg_streamerMJPG Streamer Version.: 2.0o: www-folder-path.: disabled o: HTTP TCP port.: 8080 o: HTTP Listen Address..: (null) o: username:password....: disabled o: commands.: enabledbind: Address already in use

Modify the port number: the default is port 8080, because the configuration file is not found, it is also very helpless! (this is what I understood at the beginning. I think of mjpg_stream as a simple server. In fact, mjpg_stream is a command line program that can change the port number through the mjpg_stream command-p operation.)

Modify the port number through the source code and re-edit the installation

Editor Visual Studio Code

/ mjpg_streamer-experimental/output_http/output_http.c

Int output_init (output_parameter * param, int id) {int i; int port; char * credentials, * www_folder, * hostname = NULL; char nocommands; DBG ("output # d\ n", param- > id); port = htons (8099); credentials = NULL; www_folder = NULL; nocommands = 0; param- > argv [0] = OUTPUT_PLUGIN_NAME; / * show all parameters for DBG purposes * / for (I = 0; I

< param->

Argc; iTunes +) {DBG ("argv [% d] =% s\ n", I, param- > argv [I]);}}

10. Http://:8099/

11. Command line start service

Cd to ~ / mjpg-streamer-master/mjpg-streamer-experimental

Pi@xxxxxx:~/mjpg-streamer-master/mjpg-streamer-experimental$ mjpg_streamer-I "input_raspicam.so"-o "output_http.so-w. / www" MJPG Streamer Version.: 2.0i: fps.: 30i: resolution.: 640x480i: camera parameters.:Sharpness 0, Contrast 0, Brightness 50Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0Exposure Mode 'auto' AWB Mode 'auto', Image Effect' none'Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128Rotation 0, hflip No, vflip NoROI x 0.000000, y 0.000000 W 1.000000 h 1.000000 o: www-folder-path.:. / www/ o: HTTP TCP port.: 8099 o: HTTP Listen Address..: (null) o: username:password....: disabled o: commands.: enabled I: Starting CameraEncoder Buffer Size 81920

Start script mode

Vi live.sh

Script content

Cd ~ / mjpg-streamer-master/mjpg-streamer-experimentalmjpg_streamer-I "input_raspicam.so"-o "output_http.so-w. / www"

Execute script

Sh live.sh

twelve。 The video is very stuttered.

The reason is that mjpg-streamer/mjpg-streamer-experimental/plugins/input_raspicam/input_raspicam.c

Static int fps = 5 per second / 5 frames per second

Modified to fps = 30 per second / 30 frames per second

Static int fps = 30 * static int width = 640 * * static int height = 480 * * static int quality = 85 * static int usestills = 0 * static int wantPreview = 0 * static int wantTimestamp = 0 * static RASPICAM_CAMERA_PARAMETERS c_params

13. Recompile installation

Check step 4 to compile and install mjpg_steamer

14. More fluent

/ etc/default/tmpfs:

# mount / tmp as a tmpfs. Defaults to no; set to yes to enable (/ tmp)

# will be part of the root filesystem if disabled). / tmp may also be

# configured to be a separate mount in / etc/fstab.

RAMTMP=yes

Reboot.

Raspistill-tl 500-t 999999-vf-w 960-h 720-o / tmp/mjpg/test.jpg-n-Q 50 &

Mjpg_streamer-I 'input_file.so-f / tmp/mjpg-r'

Http://:8080/?action=stream

Aptitude-- takes a closer look at installed or available software packages.

Sudo aptitude

Use the raspberry pie official camera to do silky and smooth monitoring!

Raspistill

Support for CSI (raspberry pie camera)

Web page refresh photos, very low very low way, similar to playing slides

["raspistill", "- t", "0.1max 1max 5", "- w", "300", "- h", "500"]

Description:

The red parameter can only be a positive integer, otherwise it will be uncontrollable, causing the process raspistill to occupy the camera all the time. Causes other programs to fail to use the camera.

-t,-- timeout: specified delay when taking pictures and closing. Default is 5s when it is not specified.

Nginx-rtmp-module

Support USB camera, not CSI (official camera of raspberry pie)

Nginx-rtmp-module

Case 1: Nginx has been installed, recompile rtmp-module into Nginx

Reference article: how to upgrade Nginx to the latest stable version

Reference article: nginx dynamic add module installed

Reference article: nginx 1.9.5. / configure: error: invalid option "- with-http_spdy_module"

Case 2: compile rtmp-module and Nginx directly and install Nginx

Problems encountered:

Install FFmpeg

Sudo apt-get install ffmpeg

There is no ffmpeg program in the raspberry pie operating system

Solution the tips in this article:

"you also need libav-tools, which is a ffmpeg branch. A few months ago, Debian replaced ffmpeg with libav-tools."

The above is all the contents of the article "how to make Raspberry Pie Live". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report