package FFMPEG;
import Common.JsonObject;
import java.io.IOException;
import java.nio.file.Path;
@VideoStreamDirectory(manifestExtension = "m3u8")
public class HLSStream extends VideoStream
{
public HLSStream()
{
super("live");
}
@Override
public Process createStream(Path dir) throws IOException
{
return new ProcessBuilder(
/**"raspivid",
"-n",
"-w", "720",
"-h", "405",
"-fps", "25",
"-vf",
"-t", "86400000",
"-b", "1800000",
"-ih",
"-o", "-",
"|",**/
"ffmpeg",
"-y", // Overwrite output files without asking
"-f", "v4l2", // Input format
"-video_size", "1280x720", // Input video size
"-framerate", "25", // Input framerate
"-i", "/dev/video0", // Input framerate
"-vcodec", "h264_omx", // Encoding codec
"-keyint_min", "0", // Allow every frame to be a key frame
"-g", "100", // But at most every 100 frames will be a key frame
"-map", "0:v", // Map input stream 0 to the video of this stream
"-b:v", "1000k",
"-hls_time", this.getSegmentLengthMilli().toString(), // set time of each segment
//"-hls_list_size", "0", // keep all files in playlist
"-f", "hls", // format hls
dir.resolve(this.getManifest()).toString() // playlist file
).inheritIO().start();
}
@Override
public Integer getSegmentLengthMilli()
{
return 4000;
}
}