[FFmpeg-user] Creating a Simulated HLS Streaming Server with FFmpeg...HOW??
Norm Kaiser
norm_kaiser at hotmail.com
Sun Jul 30 20:19:42 EEST 2023
On July 29, 2023 10:32 PM, Carl Z said:
It's always helpful to post the complete command output to see what's going
on, please run one of the full commands from a shell and post that. Also,
please do not top-post on this mailing list.
How much of the output should I post, considering both instances of ffmpeg do stream and don't produce any error. Should I just let them both run for, say, 30 seconds and then stop them manually and then paste all of the output? It would be quite a bit!
Also,
please do not top-post on this mailing list.
You are definitely right. My mistake.
Done encoding or done playing/streaming?
Both, I suppose? I am using the -re flag, so ffmpeg is encoding at the same rate that the media plays, correct?
I see two possibilities right off-
First is that the second video is added to the playlist -after- the first
has completed (and the player stops because it's hit the end of the list).
My suspicion is that your first suggestion is what's happening -- the first instance of ffmpeg stops writing to the playlist file and before the second instance can get up and cranking, the players (both MPV and VLC) sense that the stream is finished and then just stop. But then why do they just stop, considering I am using omit_endlist? I would expect the player to just go black for a few seconds until the next segment is written to the playlist and then the player would wake up and "Ah! Here's more. I'll continue playing..." But they don't do this. They just stop. Worse, MPV just exits.
If the theory that the second instance of ffmpeg isn't starting up fast enough, how could I possibly correct this? It would seem to present an extremely delicate timing issue.
Second is that the player only reads the playlist at start and never sees that it's been appended to.
So I'm declaring that the stream is an EVENT, not VOD, so shouldn't the player by definition continue attempting to read the M3U8 file until reads an explicit EXT-X-ENDLIST?
You could easily test this manually by pre-encoding the videos and
hand-editing the playlist at different points in the timeline.
Well, I am able to do this using a static M3U8 file. For example, I can just encode several videos really quick by omitting the -re flag. That'll result in a folder full of properly numbered .TS segments. I can then create a really long M3U8 file by hand and the players will play it. The complication is in dynamic M3U8 files, where the old segments that have already played are popped off the top of the list and new ones are added to the bottom. That's what won't work. It's like what you suggested: The second instance of ffmpeg isn't encoding and updating the playlist fast enough.
Thoughts?
Thank you so very much!
Norm
________________________________
From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> on behalf of Carl Zwanzig <cpz at tuunq.com>
Sent: Saturday, July 29, 2023 10:32 PM
To: ffmpeg-user at ffmpeg.org <ffmpeg-user at ffmpeg.org>
Subject: Re: [FFmpeg-user] Creating a Simulated HLS Streaming Server with FFmpeg...HOW??
On 7/29/2023 11:08 AM, Norm Kaiser wrote:
> Good point, gentlemen. Here is ffmpeg command I'm using:
It's always helpful to post the complete command output to see what's going
on, please run one of the full commands from a shell and post that. Also,
please do not top-post on this mailing list.
However....
On 7/28/2023 9:31 PM, Norm Kaiser wrote:
> In other words, call FFmpeg to stream the first video. Let's call it
> video1.mp4. When it's done, call FFmpeg again to stream video2.mp4, and
> so on.
Done encoding or done playing/streaming?
> I'm using HLS and I've signaled FFMpeg to append to the playlist, which
> it appears to be doing correctly. But for some reason, the media player
> (either VLC or MPV) will not play the whole stream. It just plays the
> first file and then stops playing, even though FFmpeg is dutifully
> generating new .TS segment files and updating the M3U8 playlist
> accordingly.
I see two possibilities right off-
First is that the second video is added to the playlist -after- the first
has completed (and the player stops because it's hit the end of the list).
Second is that the player only reads the playlist at start and never sees
that it's been appended to.
You could easily test this manually by pre-encoding the videos and
hand-editing the playlist at different points in the timeline.
What's the timeline of when entries are made on the play list, when videos
start and stop, and when they're encoded?
Later,
z!
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list