[FFmpeg-user] HTML5 live streaming

Andrew Sinclair ajsinclair at gmail.com
Wed May 8 01:16:03 CEST 2013


Hi Hombibi,

Why are you using MJPEG as the codec? Would be an unusual codec to find in
an x264 guide.

If you want to stream low latency HLS from a local capture use something
like this which just grabs the desktop:
ffmpeg -f x11grab -s `xdpyinfo | grep ‘dimensions:’|awk ‘{print $2}’` -r 25
-i :0.0 -pix_fmt yuv420p -vcodec libx264 -acodec libfaac -r 25 -profile:v
baseline -b:v 1500k -x264opts keyint=25 -s 640x360 -map 0 -flags
-global_header -f segment -segment_list index_1500.m3u8 -segment_time 1
-segment_format mpeg_ts -segment_list_type m3u8 -segment_list_flags +live
-segment_list_size 2 segment%05d.ts

A


On 8 May 2013 01:06, Hombibi <hombibi at yahoo.com> wrote:

> Ricardo, this complete working example may help:
>
>
> The html5 page can be served by apache, lighttpd and probably more. It
> needs the file extensions set, but lighttpd and apache have this by
> default. The required HTML 5 page ("html5.html") in its simplest form is :
>
> <!DOCTYPE html>
> <html>
> <head>
>     <title>Live Cam</title>
> </head>
>
> <body>
>     <div id="player">
>         <video autoplay="true" controls="controls" width="640"
> height="480">
>             <source src="http://YourIPAdress/live/mystream.m3u8"
> type="application/x-mpegURL" />
>             Your browser does not support HTML5 streaming!
>         </video>
>     </div>
> </body>
> </html>
>
> Just put it in the root folder of your website (/var/www/ in my case) and
> make a subsequent subdirectory (live), writeable by ffmpeg,  where the hls
> segments and index file can be written)
>
>
> The command for starting ffmpeg, live streaming a webcam in the format
> that can be displayed by an ipad 1below is essentially derived from the
> x264 encoding guide, the hls settings from extensive googeling.
>
>
> ffmpeg -v verbose -f video4linux2 -vcodec mjpeg -s 640x480 -r 10 -i
> /dev/video0 -c:v libx264 -crf 18 -profile:v baseline -maxrate 400k -bufsize
> 1835k -pix_fmt yuv420p -flags -global_header -hls_time 10 -hls_wrap 6
> /var/www/live/mystream.m3u8
>
>
> Point your ios device to http://YourIPAdress/html5.html after 30 seconds
> for the first two .ts files and the index file to be created.
>
> Cheers
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


More information about the ffmpeg-user mailing list