- Install H264 Streaming Module Apache Junction
- Apache Video Streaming
- H264 Streaming Viewer From Av Tech
Active2 years, 5 months ago
Hi I am trying to stream video from static html5 pages serve by Windows Apache2. According to Apache guide on
http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Apache-Version2this only for Linux, so I get the mod_h264_streaming.dll from
http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Internet-Information-Services-IIS7-Version2 but when I LoadModule h264_streaming_module modules/mod_h264_streaming.dll in httpd.conf it return
http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Apache-Version2this only for Linux, so I get the mod_h264_streaming.dll from
http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Internet-Information-Services-IIS7-Version2 but when I LoadModule h264_streaming_module modules/mod_h264_streaming.dll in httpd.conf it return
Here is the phase/steps we conducted when we installed and tested h264 and flvx streaming modules in WHM/cPanel based apache 2.2.x running on centos 6.4 64bit.
Any help would be appreciated, thanks in advanced!
TerryTerry
2 Answers
That dll you downloaded is only for IIS not apache
MarioMario
Step by Step1- At first Download Visual Studio 2008 x64 SP1, be sure to install the Visual C++ 2008 x64 SP1 Redistributable Packageit can be downloaded from;
2- Download Apache module mod_h264_streaming from ; https://www.apachehaus.net/modules/mod_h264_streaming/ in the below.Before download Please careful about your apache version.consider it.
3- Extrach files , copy 'mod_h264_streaming.so'
3- If you are using Wamp server go the C:wampbinapacheApache2.4.4modules and drop(add,copy what ever you say) mod_h264_streaming file to the path. If you are not using wamp go to C:/Apache24/modules/ and add mod_h264_streaming.
4- Then Go to httpd.conf (in the C:wampbinapacheApache2.4.4conf path) , open with notepad++ find load modules linejust like ;
When you find the lines add this ;
save and quit. Finally restart the apache server. Module is ready to serve you.
user60783user60783
Not the answer you're looking for? Browse other questions tagged apache2streaminghtml5-videoh.264 or ask your own question.
Active2 months ago
So I got the Raspberry Camera today and got stills working fine.
Capture an image in JPEG format:
Capture a 5-second video in H.264 format:
I do not want to install any extra application as I want to leverage HTML5 that is readily available. Since Chrome/Safari has built-in decoders for H.264 I just want to point my browser to the URL and watch the stream.
How can I achieve this?
Peter Mortensen1,84111 gold badge1212 silver badges1717 bronze badges
Piotr KulaPiotr Kula15.3k55 gold badges5252 silver badges9494 bronze badges
8 Answers
Streaming with HLS
Apple's proprietary method of streaming live video. It is called HTTP Live Streaming (HLS) and is only supported by Apple's technology. Google (Chromium / YouTube) uses its own implementation called dash mpeg and everybody else is either confused or using H.264 encapsulated in MP4.
PROS
- Can stream HD 1080p on LAN to any device that supports
.m3u8
playlists - Uses HTML5 semantics (but it is not standardised format)
- Some support in third-party premium software like jwplayer 6 can be used
CONS
- Has a delay of at least 5 seconds (in this application, but using mirroring from iPhone to AppleTv they achieve 50 ms - 500 ms somehow). So it's not good for remote controlled applications where instant reactions are required, ie robots or helicopters.
- Have to pay for third-party software if you want to broader browser support which may flash.
m3u8
.m3u8
is simply a UTF-8 version of the M3U format. (.m3u files can have various encodings.) Some people claim that renaming a .m3u8 to .m3u will work as expected on all HTML5 browsers. I tried this, and it did not work for me.
The concept behind this streaming is that short segments of files, at least 5 seconds long (in this example - it possible new ways are available to speed it up) are recorded and saved to a proper file. The playlist file is updated with the new file name and the client always polls this playlist and downloads the most recent file. There are some mechanics involved to merge the video seamlessly on the client. This is why other developers do not want to implement this because it requires a a lot of effort and does not comply with HTML5 standards (even though there is no proper HTML5 standard for live streams?? Ehh, sigh).
Installing
You need to compile
ffmpeg
- do not use apt-get install
for FFmpegThis can take up to 5 hours - It has to be version 1.1 or higher which supports segment streaming. You can use this to clone it and compile it.
- Install nginx (engine-x) - nginx was specially designed for embedded devises and is the lightest and fastest PHP-enabled web server available at the moment. (Yes, it is better than bulky Apache)
- Create a directory, for example, live in your www folder,
/usr/share/nginx/www/
Make a Bash script file called something like
video.sh
, apply chmod +x
to it and put paste this in. Change the base folder to where ever your HTTP server lives. I used nginx
, /usr/share/nginx/www/
Create a HTML file that will load the playlist
Support
- iPhone, opens page, but drops into QuickTime. The quality is really amazing!
- Windows Safari, streams fine.
- Macintosh or Windows, QuickTime. Streams fine.
- Android 2.3.5 and did not work, but it was supposed to be supported since 2.1.x
- Windows, Chrome - Nothing
- Windows, Internet Explorer 10 --- Nothing (unsupported video type)
- Windows, VLC media player - Nothing
Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?p=351392&sid=5b9a46f5eea2c7a0887d2efdfa7edade#p351392
Original code: https://github.com/AndyA/psips/blob/master/examples/hls.sh
UV4L MMAL
Thanks to comment from @mpromonet for the update on the Linux-Projects V4L2 driver that now implements MMAL very efficiently - but it is still a work in progress.
Follow these instructions to install the linux-project repository and install the UV4L driver with extras. Then install the server and mjpeg. If you want, you can experiment with the others too.
After you install everything, you can access the HTTP server on port 8080. You should also check the
/etc/uv4l/conf
file and set if you want mjpeg or H.264 as it makes a difference, but you can adjust a few settings via the built-in web server.HTML 5
Install H264 Streaming Module Apache Junction
This is what we were all waiting for (called WebRTC) and thanks to the new driver it works great (on a Raspberry Pi 2).
First, follow these steps, http://www.linux-projects.org/modules/sections/index.php?op=viewarticle&artid=14:
Then on your Raspberry Pi 2 install this the WebRTC (for a Raspberry Pi 1, read the linked site for other options)
Restart all the drivers and go to
Apache Video Streaming
You now have low-latency, high-quality video streaming direct into a modern browser like Chrome or Firefox. (Maybe Safari, but I can't check because they don't do Winblows any more and Internet Explorer... eh)
MJPEG
By default, it uses
mjpeg
at 1080p, and it's very sluggish. I tweaked it to 800x600 framesize and using something like iSpy to process video. For security, I get about 10 fps on a crisp video. It is way better than the 3 fps at 640x480 before this driver. It works on iPhone with Safari, Android Chrome and almost everything else.http://raspberrypi:8080/stream/video.mjpeg
This also means that
motion
should (I still need to test and compare) work a lot better now. Make sure to set the configuration to use v4l2_palette 8
or v4l2_palette 2
H.264
This has now been fixed for 'streaming', and we don't have to go to great lengths to watch H.264 video through VLC media player. The stream is sill RAW H.264, so you need to demux it or transcode/ encapsualte if you need it to work somewhere else. You should tweak the
bitrate=xxxxxx
in the configuration file if you are streaming over Wi-Fi.In VLC media player, you must tell it that you want to use the H.264 demuxer. So if you're using the GUI, then make sure to add the argument
:demux=264
. From command line, vlc http.../video.h264 --demux h264
. Otherwise, you will just see a blank screen even though the camera LED is turned on.http://raspberrypi:8080/stream/video.h264
Voila! HD streaming with roughly 500 ms lag (with tweaking, down to 200 ms). It is definitely much easier than using the old methods. Quality and FPS is superb, but you can't embed this in HTML5 without transcodding to MP4 or WebM. I hope this will be implemented as it will truly make this a great standalone server.
RTSP/RTMP/RTP
HLS
Not supported/implemented
video4linux
driver availabe yet. This means that we can't use ffserver to stream data using /dev/video0
or simlar like a USB webcam.That is why it is so difficult to find proper live streaming for HTML5 browsers.
- Here is a article for streaming almost live (<0.5s) video using
Gstreamer
(not HTML5) - And here you can use VLC media player and embed it into a webpage using
<OBJECT ...
:) (delayed)
15.3k55 gold badges5252 silver badges9494 bronze badges
Streaming with MJPEG
U4VL
A kernel interface with a build in HTTP(S) server.
Raspberry Pi Cam Web interface
A nice project by silvanmelchior that deploys a web server, dvr like, multi target streaming server. Needs more information
Legacy method
Streaming with mjpg is supported by almost all browsers, including Internet Explorer 6. A lot of cameras used before H.264 used hardware mjpg, which essentially dumped JPEG files as fast as possible into a folder while mjpg read the file into a buffer and deleted them. Some devices could achieve up to 25 fps and even if you had a bad connection you would get at least 1 fps.
Support for mjpg was dropped in HD cameras because the JPEG file just got too large to stream over the Internet and H.264 is a much faster and better quality protocol.
H264 Streaming Viewer From Av Tech
Since we have no way to broadcast H.264 using the camera module nativly this seems like a viable fallback...
It is pretty much instant, but don't expect to get more than 1.5 fps. This is down to
raspistill
being extremely SLOOOW! Using the time-lapse function set to 100 ms which should give us 10 fps does not work because raspistill
just chokes up and has serious performance issues within itself.- Change
/tmp
to use RAM for speed/etc/default/tmpfs
- changeRAMTMP=yes
(This is an effort to increase fps, but raspistill just cannot keep with its self.) - Reboot
- apt-get install git
- apt-get install libjpeg8-dev
- apt-get install libv4l-dev
- apt-get install imagemagick
- cd
/usr/src
, mkdir mjpg-streamer, cd mjpg-streamer ... git clone https://github.com/engine12/mjpg-streamer.git
make USE_LIBV4L2=true clean all
- OPTIONAL If you have errors
sudo ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
sudo ln -s /usr/include/lib4l2.h /usr/include/linux/lib4l2.h
- Inside the makefile, comment out all the plugins except for input_file and output_http and do make again. I had a lot of issues here.
- Copy the binary,
mjpg_streamer
and its pluginsinput_*.so
andoutput_*.so
to/usr/local/bin
. Otherwise, run it direct from the src directory. - Optional end
mkdir /tmp/stream
raspistill -w 640 -h 480 -q 5 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 &
LD_LIBRARY_PATH=./ ./mjpg_streamer -i 'input_file.so -f /tmp/stream' -o 'output_http.so -w ./www'
(run this where the binary and plugins are)- Goto
http://<IP-address>:8080
- Here are a few option, enjoy 'live' streaming the old fashioned way ... supported by most browsers - modern, old and experimental.
I struggled to compile it for about for 5 hours... sigh, but I think I will use this as I can access the stream from any phone and any browser. I just have to wait till we get better drivers... Another year or two. :(
No matter what quality I try, I get no faster or no slower than 1 fps using stream. I used 720p and 1080p and only image quality gets better, but fps is no difference on LAN. I suppose smaller settings will help with WAN/3G or other radio transmissions.
raspistill writes the image to a single file. This could be a bottleneck. It writes the file, mjpg strreamer reads it and deletes it causing a blocking I/O, so raspistill cannot write to the file.
The only thing I can think of is using raspivid piped into FFmpeg that will create JPEG files for us - I need to try this and possibly it's much faster than usign raspistill. I managed to get 25 fps at a shocking quality, and it was delayed about 10 seconds... Tweaking the settings got me about 3 fps, but 100% CPU. No hardware is being used to process the video stream...
I was also reading and found that we can use
%d
in the raspistill output file name. I wonder if that will boost the fps. Also JPG encoding is hardware accelerated in raspistill, so I am really struggling to figure out why it's so slow...I got a staggering 2 FPS using
%d
in the filename. For some reason, writing the JPEG file is horribly slow from raspistill. Sigh.As of 2017 (or perhaps earlier)
raspivid
is no longer the preferred method, with the Pi devs recommending people use V4L2 instead.So this method allows you to stream H264 via RTP using V4L2 instead of
raspivid
. I noticed this method results in fewer dropouts and allows a higher bitrate:This script multicasts the video, and it can be viewed on another machine on the LAN with a command like this:
-sync ext
causes the video to be played as fast as possible so it will run in real time, as opposed to running it at a fixed framerate and lagging if the Pi is capturing frames faster than this. There's still some lag with this method, but no worse than the other raspivid
methods.(Tip: if you're plugged into a router or switch that supports IGMP, make sure
224.0.0.0/4
is not firewalled on your machine, otherwise when the router asks your PC whether it wants any multicast traffic the PC will never respond and you'll never see any video.)Recording to disk
As I mentioned recording in the comments below, I'll expand on that here. You can use a command like this to record the network stream to disk:
Look at
man strftime
for the meanings of the %
symbols in the filename. The ones in this example use the day number (0=Sunday, 1=Monday, etc.) followed by a T
and then the time. It starts a new file every 15 minutes.Just to be clear, this recording command is meant to be run on a remote PC (not on the Pi itself) although it will probably work on the Pi too (untested).
Since you get a new file every 15 minutes with the day and time in the filename, it means that after one week you'll start to get filenames generated that have already been used, causing the oldest files to get overwritten. In other words, you'll end up with a rolling loop of the previous week's worth of footage. This is ideal for a security camera where you will rarely need to go back more than a week.
As a side note this produces about 500GB worth of files, so you may want to adjust the bitrate, resolution, or overwrite the files sooner (say every 24 hours) if you don't want them taking up so much space.
MalvineousMalvineous
I managed to stream from my Raspberry Pi to a web server with the compiled-in module nginx-rtmp.
To save hassles with
ffmpeg
, I recommend a rolling distribution like Arch Linux Arm.Some notes:
- The hardware-encoded H.264 video stream takes about 300 KB/sec of bandwidth, which if I did my calculations correctly, will take at least 750 GB a month if you wish to stream to your nginx-rtmp httpd or a RTMP service like ustream.
- Audio: If you want audio to accompany your H.264 stream, you need it in AAC. Basically the Raspberry Pi is too slow to encode a USB microphone into AAC on the fly.
So on this basis, I think live streaming from a Raspberry Pi might be OK for a temporary broadcast, but not for an always-on Web cam since it's too bandwidth-hungry. You will not get audio and if you do, it will a mission to sync.
You can record audio more efficiently separately at the same time as recording video. Then later perhaps mux the audio feed in later and convert it to WebM and put it on your httpd as a static file with an HTML video tag. The workflow is pretty awkward, though it's the best I can think of for an efficient broadcast that will work painlessly across browsers.
Peter Mortensen1,84111 gold badge1212 silver badges1717 bronze badges
hendryhendry
UV4L now supports live Audio & Video Streaming with WebRTC and HTML5.
Piotr Kula15.3k55 gold badges5252 silver badges9494 bronze badges
StrunzStrunz
Piotr Kula's answer seems to be on the right track but is outdated for Raspberry stretch.
There are updated instructions for uv4l on Raspberry stretch at
You can tweek the uv4l options via /etc/uv4l/uv4l-raspicam.confand then restart the service with
In my case things didn't work out of the box (if forgot to install the uv4l-server ...). The following comments might help you debug similar problems.
I checked that the server is running with:
and whether it listened with
but there was no entry for uv4l in the list. I had expected one for port 8080
so i tried the command from How to configure UV4L?
But still the server didn't start automatically ...
then showed me the option
so I tried:
but still no server running on port 8080 or elswhere. So it seems i forgot the '--foreground' option which the man page states is necessary:
Now that's a clear hint! There seems to be no server yet - so install it:
and try again:
The server is now available at http://pi:8080 (replace pi with your server's ip or hostname)
After a reboot it worked with out entering another command.
Wolfgang FahlWolfgang Fahl
UV4L now supports live audio & video broadcasting to Jitsi Meet Rooms over the Web. No special configuration is required. It's as easy as filling your name, room and clicking on Start.
prinxisprinxis
protected by Piotr KulaMay 8 '15 at 7:31
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Would you like to answer one of these unanswered questions instead?