The solution to this problem has continued to evade me for the last few days!
Basically I want to control a dynamic playlist of videos on a remote server with a web interface, where I can alter a playlist of videos, seek, skip, etc., directing the resulting single continuous stream to an RTMP server. This has to be done through a command line as I only have access to the server by SSH.
First I tried FFMPEG...
I tried using a self-referencing ffconcat txt file as an input, that I would update on the fly. However, this required monitoring of ffmpeg's debug log for the current video file, so we know what to queue next. Also, there was no way to seek without stopping the stream. When I realised how limited & hacky this solution was, I decided to try something else.
Then I tried outputting an HLS stream from ffmpeg to create temporary video segments and an m3u8 playlist, that I would reference in a separate ffmpeg command that sent the m3u8 file to the RTMP server. After each video in the playlist I would start a new ffmpeg process that would ammend to the m3u8 playlist file. Problem - FFMPEG cannot handle discontinuities! It's a limitation / bug that hasn't been resolved, resulting in the stream freezing at the end of the first video in the playlist.
Then I tried VLC...
I thought I'd found the answer that was staring me in the face the entire time! As I basically need all the functionality of a video player for this project. But after countless tests, I've come to the conclusion that a bug / outdated feature is preventing any decent results. Any attempt to merge 2 or more videos results in a corrupt stream, with bad time codes after any point of merging.
I'm at my wits end!
HOW DO I DO THIS?
[Edit] - is this the correct subforum for this thread? it seems this topic is a bit of an outlier, could an admin maybe consider moving it to general discussion?
+ Reply to Thread
Results 1 to 3 of 3
Last edited by hedgehog90; 27th Feb 2020 at 14:10.
The big Q. is are you trying to emulate what youtube does with its dynamic playlists after you play one video it offers a playlist of similar titles ?
So that's the 'dynamic' bit.
But a playlist is just a list of files which are intended to play in a prescribed (or random) order. All of which, potentially, have different encoding parameters. So there is no way one can merge two or more files to play 'continuously' and seek across more than one file. Seek to the end of one and play the next. Yes. All playlists should do that but not in the way you appear to propose.
So if I have a playlist consisting of 3 files - 1, 2 and 3 - assume I'm playing 1 and then I decide to remove 2 from the playlist, I need the encoder to know to open 3 next.
Similarly, if I'm playing 2 and I move 2 back to the start of the playlist - making the playlist 2, 1, 3 - then it should play 1 next, even if it's already been played.
And by 'seeking' I mean moving the playhead in the current file.
Just think of VLC media player, or any other media player.
The only FFMPEG playlist input that works in this manner is the HLS m3u8 format, but as I stated in my first post, discontinuity tags (ie, going from video 1 in the playlist to video 2) appear to be ignored and this breaks the encode.
Then I thought VLC would do it for me, whereby I could easily alter its playlist, seek, etc. through its HTTP port while encoding, but unfortunately it also falls down at the point of merging 2 videos together in a single encode. For some reason it just can't without being prone to freezing the image or the sound going wildly out of sync. And yes, that's after transcoding the stream to a static, consistent format.
Researching both methods, it is clear that many people encounter these same issues unfortunately and I can find no solution.
All I want essentially is a command line based video player/decoder that I can control remotely (with playlist + seek functionality) to output one continuous stream, piping it into a transcoder for a consistent format, and then sending it to an RTMP server.
Last edited by hedgehog90; 28th Feb 2020 at 06:33.