How to setup HLS and DVR functionality and read it? - html

I want to create an audio stream live with the DVR functionality.
In my player I want to listen live or seek the past stream (few minutes ago).
I use nginx to serve the hls stream.
How to setup the DVR functionality? Do I use a specific module in nginx for live stream and past stream with a param like past.m3u8?seek=timestamp
I'm also looking for a web player in html5 and fallback in flash to read the live stream and can seek the past.m3u8 stream.

I've setup nginx with this config:
location /hls {
# Serve HLS fragments
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
}
I create hls stream with avconv.
avconv -i [input] -vn -sn -c:a libfdk_aac -b:a 64k -hls_time 10 /path/to/hls/playlist.m3u8
To read this stream I use clipr player who permits to seek the stream.

Related

Gstreamer misses H.264

I wanted to try GStreamer to connect to a remote IP camera using RTSP stream.
So I've downloaded and installed the last version.
On Using GStreamer page said: GStreamer also provides playbin, a basic media-playback plugin that automatically takes care of most playback details
So I've tried to connect to the camera using the following command:
gst-launch-1.0 playbin uri=rtsp://192.168.1.2:554/av0_0
Unfortunately I get error:
ERROR: from element
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: Your GStreamer
installation is missing a plug-in. Additional debug info:
../gst/playback/gsturidecodebin.c(988): no_more_pads_full ():
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: no suitable
plugins found: ../gst/playback/gstdecodebin2.c(4679):
gst_decode_bin_expose ():
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0:
no suitable plugins found: Missing decoder: H.264 (Main Profile)
(video/x-h264, stream-format=(string)byte-stream,
alignment=(string)au, level=(string)3.1, profile=(string)main,
width=(int)1280, height=(int)720, framerate=(fraction)0/1,
interlace-mode=(string)progressive, chroma-format=(string)4:2:0,
bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8,
parsed=(boolean)true)
Does it mean that my installation missed decoder for h264? How could it been? I guess that h264 is the most popular codec. Did I do something wrong?
Update:
./gst-inspect-1.0 | grep h264
videoparsersbad: h264parse: H.264 parser
typefindfunctions: video/x-h264: h264, x264, 264
rtp: rtph264pay: RTP H264 payloader
rtp: rtph264depay: RTP H264 depayloader
openh264: openh264enc: OpenH264 video encoder
openh264: openh264dec: OpenH264 video decoder
Have you installed GStreamer MSI with the "Complete" option? If it's installed in Typical mode, then the libav plugins won't be installed. You can change the installation and select the additional feature or do a re-install.
When you install in the Complete mode, you should be able to find avdec_h264. Alternatively, you can select Custom mode and then enable the "GStreamer 1.0 libav wrapper".
$ gst-inspect-1.0.exe libav | grep h264
avdec_h264: libav H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 decoder

linphonec and h264 codec

GUI version of linphone is configured with h264 codec and works well. But linphoneC (command line version), which is in the folder with linphone, in response to the command "vcodec list" returns only "0: VP8 (90000) enabled" and not work with h264. How to configure linphoneC to work with h264? Thank you!

FFmpeg Converted files not working on firefox

When i convert a file with ffmpeg and play the video in firefox i get this error :
"VIDEOJS:" "ERROR:" "(CODE:3 MEDIA_ERR_DECODE)" "The video playback was aborted due to a corruption problem or because the video used features your browser did not support." Object { code: 3, message: "The video playback was aborted due to a corruption problem or because the video used features your browser did not support." }
In other browsers it's working perfect.
This is my ffmpeg convert command:
ffmpeg -i {input} -b 5500k -minrate 5500k -maxrate 5500k -bufsize 5500k -ab 384k -vcodec libx264 -acodec aac -strict -2 -ac 2 -ar 96000 -s 1280x720 -y {output}
Can someone tell me why the videos won't play in firefox?

How can I watch my video from a sdp file?

I'm using ffmpeg to create a streaming. It works fine. I have a server and with ffplay I can watch my stream.
My only (big) constraint is real time.
I have to embed it into an HTML page accessible from mobile devices.
I tried with HTML5 video tag but I can't include sdp files into it.
With ffmpeg I create a stream from my webcam. I have also created the sdp file but in HTML5 doesn't work.
The code is here:
ffmpeg server:
sudo ffmpeg -re -f video4linux2 -i /dev/video0 -fflags no buffer rtp://224.10.20.30:20000
file.sdp
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 224.10.20.30
t=0 0
a=tool:libavformat 55.7.100
m=video 20000 RTP/AVP 96
b=AS:200
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1
ffplay: (It works)
ffplay file.sdp
How can I view the stream in a browser?

Saving security camera stream

I've an axis M1011 camera and i want to continuosly save the flow of the camera and divide it in multiple file?
Than register it to a database mysql (i think only the information of the file).
How it is possible to do it?
I saw ffmpeg but i think i would lose some frame between the various connection.
One simple script is this: this would save a video every minute, the fps = 1.
The video are saved in the directory in year/month/day/hour/... With a path created as it is, i don't know if it is useful to store the path in the database.
b=.avi;
while true; do
path=`date +%Y/%m/%d/%k/`;
file=`date +%k:%M-%d_%m_%Y`;
mkdir -p $path;
e=$file$b;
echo $e;
ffmpeg -r 1 -t "00:01:00" -f mjpeg -i http://address/mjpg/video.mjpg? streamprofile=lowprofile $path$e &
sleep 60;
i=`expr $i + 1`;
done