0

I am trying to build a system where I want to stream video from a webcam to a website, I am new to video processing, but so far, I have learned that I need to use FFmpeg lib, an AWS-S3 bucket and hls.js for reading .ts file with the help of .m3u8. I have a few ideas on how I will be implementing I am looking for feedback and best practice to achieve it.

Idea:

A python script running on the system and sending the raw mp4 file to the cloud for processing:

For example: ffmpeg -f dshow -s 640x480 -r 30 -vcodec mjpeg -i video="Integrated Webcam" output2.mp4 this command can be used to generate mp4 file which can be sent to the cloud for processing.

Doubt 1: I think it makes no sense to build an m3u8 file on the system (ffmpeg -i output1.mp4 -c:v libx264 -x264opts keyint=60:no-scenecut profile_720p_.m3u8 not able to find the command that can directly generate m3u8 from webcam) since m3u8 file will keep on updating as .ts files keep on getting generating (I am not sure how the live stream is done using .m3u8, does the client keep on requesting and updating the m3u8 file to know about new ts address). Also, instead of uploading an mp4 file, can I directly upload the ts file and dynamically generate an m3u8 file since this is a live stream, I can use -hls_list_size 2 to limit the .ts

Once the mp4 file is on the cloud I am planning to use ffmpeg -i output1.mp4 -c:v libx264 -x264opts keyint=60:no-scenecut -hls_flags append_list profile_720p_.m3u8 to generate the ts and m3u8 file, like below:

ffmpeg -i output1.mp4 -c:v libx264 -x264opts keyint=60:no-scenecut -hls_flags append_list  profile_720p_.m3u8
ffmpeg -i output2.mp4 -c:v libx264 -x264opts keyint=60:no-scenecut -hls_flags append_list  profile_720p_.m3u8
ffmpeg -i output3.mp4 -c:v libx264 -x264opts keyint=60:no-scenecut -hls_flags append_list  profile_720p_.m3u8

Doubt 2: Even with -hls_flags append_list, I can generate the ts file as continue, but the m3u8 file is only updated for the last command; for example, after running the above command for output1.mp4 m3u8 file will have segments-0.ts to segments-5.ts but after running above command for output2.mp4 m3u8 file only have segments-5.ts to segments-10.ts instead of segments-0.ts to segments-10.ts any way since I am looking for live streaming this won't be a major issue.

I am here looking for help to clarify my doubt related to FFmpeg.

3
  • I suggest an approach using VLC Media Player. It supports video streams and you can redirect it wherever you want.
    – pbies
    Commented Dec 10, 2022 at 17:09
  • @pbies do you have any links for that? Commented Dec 10, 2022 at 17:10
  • videolan.org/vlc
    – pbies
    Commented Dec 10, 2022 at 17:16

0

You must log in to answer this question.

Browse other questions tagged .