I want to live stream with HTTP Live Streaming
, but I have problem with libx264
or maybe something other.
My hardware and software environment:
- Macbook Pro
- VirtualBox with Ubuntu 16.04
Nginx
andFFmpeg
(in Ubuntu)
I am able to stream a static video file (in Ubuntu with Nginx and FFmpeg).
The FFmpeg
command is as following:
$ffmpeg -i /my/sample/video.mp4 -codec:v libx264 -f hls /output/file.m3u8
But when it comes to webcam (live streaming), Mac OS Safari fails to open the stream. I used the following command:
$ffmpeg -i /dev/video0 -codec:v libx264 -f hls /output/file.m3u8
I guess it's the problem of libx264
because when I use mpeg2video
encoder, Mac OS Safari indeed can play the stream:
$ffmpeg -i /dev/video0 -codec:v mpeg2video -f hls /output/file.m3u8
I know there is a library called video4linux2
, should I use video4linux2 for capturing my webcam? But I don't know the appropriate FFmpeg
command for HTTP Live Streaming (I tried FFserver but there is error something like cannot rename hls
)
anyone shed some light on my problem?