Generating a HLS playlist through ffmpeg
I might be able to streamline the requests to cut down on the endpoints. This also will likely take some time if the file is large and could time out, that may be a concern for another day.
This commit is contained in:
24
src/video.rs
Normal file
24
src/video.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use std::process::Command;
|
||||
|
||||
// ffmpeg -i test.mp4 -c:v h264 -flags +cgop -g 30 -hls_time 3 out.m3u8
|
||||
|
||||
pub fn create_playlist(video_path: &str, playlist_file: &str) {
|
||||
let result = Command::new("ffmpeg")
|
||||
.arg("-i")
|
||||
.arg(video_path)
|
||||
.arg("-c:v")
|
||||
.arg("h264")
|
||||
.arg("-flags")
|
||||
.arg("+cgop")
|
||||
.arg("-g")
|
||||
.arg("30")
|
||||
.arg("-hls_time")
|
||||
.arg("5")
|
||||
.arg(playlist_file)
|
||||
.output()
|
||||
.expect("Expected this to work..");
|
||||
|
||||
println!("{:?}", result);
|
||||
println!("Status: {}", String::from_utf8(result.stdout).unwrap())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user