nadjieb / cpp-mjpeg-streamer Goto Github PK
View Code? Open in Web Editor NEWC++ MJPEG over HTTP Library
License: MIT License
C++ MJPEG over HTTP Library
License: MIT License
Steps:
developer@alex-WorkStation:~/build$ cmake ../cpp-mjpeg-streamer/
-- The CXX compiler identification is GNU 9.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Using the single-header code from /home/developer/cpp-mjpeg-streamer/single_include/
-- Configuring done
-- Generating done
-- Build files have been written to: /home/developer/build
developer@alex-WorkStation:~/build$ make
Scanning dependencies of target doctest_main
[ 14%] Building CXX object test/CMakeFiles/doctest_main.dir/src/unit.cpp.o
[ 14%] Built target doctest_main
Scanning dependencies of target test-streamer
[ 28%] Building CXX object test/CMakeFiles/test-streamer.dir/src/unit-streamer.cpp.o
[ 42%] Linking CXX executable test-streamer
[ 42%] Built target test-streamer
Scanning dependencies of target test-http-message
[ 57%] Building CXX object test/CMakeFiles/test-http-message.dir/src/unit-http-message.cpp.o
/home/developer/cpp-mjpeg-streamer/test/src/unit-http-message.cpp:3:10: fatal error: nadjieb/detail/http_message.hpp: No such file or directory
3 | #include <nadjieb/detail/http_message.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [test/CMakeFiles/test-http-message.dir/build.make:63: test/CMakeFiles/test-http-message.dir/src/unit-http-message.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1043: test/CMakeFiles/test-http-message.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
`/usr/local/include/nadjieb/mjpeg_streamer.hpp: In lambda function:
/usr/local/include/nadjieb/mjpeg_streamer.hpp:286:62: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
::read(new_socket, &buff[0], buff.size());
^
/usr/local/include/nadjieb/mjpeg_streamer.hpp:292:95: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
::write(new_socket, shutdown_res_str.c_str(), shutdown_res_str.size());
^
/usr/local/include/nadjieb/mjpeg_streamer.hpp:304:115: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
::write(new_socket, method_not_allowed_res_str.c_str(), method_not_allowed_res_str.size());
^
/usr/local/include/nadjieb/mjpeg_streamer.hpp:309:83: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
::write(new_socket, init_res_str.c_str(), init_res_str.size());`
Is there any way of extracting real-time HTML video to c++ environment, suppose I have webrtc media which I want to process frame by frame at high-resolution 30fps but the conversion of every frame to base64 using javascript is very computationally expensive and causes too much delay.
@kamalnadjieb
Thanks for your wonderful repo.
I have a question regarding the frame rate.
Is it possible to set the frame rate for the HTTP streaming?
Build with no unit tests does not work
developer@alex-WorkStation:~/build$ rm * -rf
developer@alex-WorkStation:~/build$ cmake -DBUILD_TESTING=OFF ../cpp-mjpeg-streamer/
-- The CXX compiler identification is GNU 9.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Using the single-header code from /home/developer/cpp-mjpeg-streamer/single_include/
-- Configuring done
-- Generating done
-- Build files have been written to: /home/developer/build
developer@alex-WorkStation:~/build$ ls
CMakeCache.txt CMakeFiles cmake_install.cmake Makefile nadjieb_mjpeg_streamerConfig.cmake nadjieb_mjpeg_streamerConfigVersion.cmake nadjieb_mjpeg_streamer.pc nadjieb_mjpeg_streamerTargets.cmake
developer@alex-WorkStation:~/build$ make
developer@alex-WorkStation:~/build$
Make has no effect
Hi, i push 100kb frames every 100ms, and after several hours i can't access stream.
Can you help to resolve it?
Best regards, Viktor.
Hello, Can I send stream from two cameras into same port (8081 for example), but with different paths (publish id) ?
localhost:8081/uid1
localhost:8081/uid2
Thanks for this library, I am successfully using it with a thermal camera !
I have two questions: In the example's main loop,
poll()
with a negative timeout)The goal is to be able to shut down the camera until new clients connects, and wait quietly until then.
I am having video flickering issue in new device(usb 2.0 video capture card) which is connected alternative for frame grabber(epiphan av.io.4k frame grabber). Also, we observed that the issue appears in linux(for virtual display) and with windows(streaming with webcam application) working fine.
Also we are using opencv2/opencv.hpp and cpp-mjpeg-streamer in linux for streaming.
I used opencv capture the frame. But the frame always break.
And opencv returned this to me.
Expected boundary '--' not found, instead found a line of 29 bytes
When I used browser watch the mjpeg. Frame will break sometimes.
Hello,
Could you please explain to me what this error means, and how to resolve it?
if (payload.second.revents != POLLWRNORM) {
throw std::runtime_error("revents != POLLWRNORM\n");
}
//terminate called after throwing an instance of 'std::runtime_error' revents != POLLWRNORM
Many thanks!
-Scott
I would like to include an option to take a snapshot, instead of streaming.
It's possible ?
After connecting more than the maximum number of connections from other users' browsers until access is no longer possible, and then reconnecting (F5) from the existing connected browser, a runtime error with the message "revents != POLLWRNORM\n" occurs.
The location is line 153 of publisher.hpp.
Is there an appropriate solution when excessive connection requests occur from different users?
Goals:
Hi,
Still present bug. After some time stream freezes. I can't access it.
Switched to https://github.com/jacksonliam/mjpg-streamer it works.
Please fix it.
Thank you for the nice library. It is helpful.
How can we serve an index.html from the program?
I tried this but did not work.
MJPEGStreamer streamer;
streamer.start(8080);
streamer.publish("/", "<html><body><h1>Hello</h1></body><html>");
Hello,
Here is the error message:
0x0000007fb55d39bc in __libc_write (fd=, buf=0x7ee001aff0, nbytes=31909)
at ../sysdeps/unix/sysv/linux/write.c:27
27 ../sysdeps/unix/sysv/linux/write.c: No such file or directory.
(gdb) backtrace
#0 0x0000007fb55d39bc in __libc_write (fd=, buf=0x7ee001aff0, nbytes=31909)
at ../sysdeps/unix/sysv/linux/write.c:27
#1 0x000000555559eedc in nadjieb::MJPEGStreamer::worker()::{lambda()#1}::operator()() const (__closure=0x5585902988) at /usr/include/c++/8/bits/basic_string.h:2290
#2 0x0000007fa6d1848c in () at /usr/lib/aarch64-linux-gnu/libstdc++.so.6
#3 0x0000007fb55ca088 in start_thread (arg=0x7fffffc54f) at pthread_create.c:463
#4 0x0000007fa6ae0ffc in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78
Thanks,
-Scott
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.