0

I have an ASP.NET Web API.

That API calls a separate API that I do not control to retrieve 7-second clips of continuous footage.

I am attempting to concat these clips together to turn them into a single livestream that I can stream down to a video player on request.

My previous setup involved streaming snapshots into a named pipe stream and using the -f image2jpeg input format to convert it into a stream. However, I don't think this technique works with clips and I haven't been able to find any video equivalent.

All of the assistance I have found online says the same thing about concatenating videos using one of the three methods listed in the top answer of this question: How to concatenate two MP4 files using FFmpeg? But all of the three methods there require that the clips be specified in the parameters of the command. As I am attempting to livestream the footage I do not have access to all of the 7-second clips and the number of clips I will pipe to FFmpeg is indeterminate when creating the FFmpeg command.

Ideally, the solution would allow me to pipe clips into FFmpeg continuously without specifying each one individually, and FFmpeg would concatenate each clip onto the existing video so it can be sent down to any web client. It must also be able to send as much of the video down as it has currently concatenated, rather than waiting for the command to complete fully.

How do I go about concatenating an indeterminate number of videos together into a single stream?

Max Hay
  • 230
  • 2
  • 11
  • *7-second clips of continuous footage* --> what format and codecs? – Gyan Nov 30 '21 at 04:05
  • From FFprobe: Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720, 286 kb/s, 0.99 fps, 1 tbr, 10k tbn, 20k tbc (default) And the format's mp4 – Max Hay Nov 30 '21 at 09:15
  • 1
    Untested but you could remux each MP4 to .ts, cat them to a named pipe. And use `ffmpeg -readrate 1 -f mpegts -c:v h264 -i named_pipe ...` to read – Gyan Nov 30 '21 at 11:32

0 Answers0