[FFmpeg-user] Possible to play video while it is being downloaded using ffmpeg?

Moritz Barsnick barsnick at gmx.net
Wed Mar 22 00:38:04 EET 2023


On Tue, Mar 21, 2023 at 21:38:44 +0100, Bo Berglund wrote:
> I have a script that downloads and re-encodes a live stream into an mp4 video
> file with a set geometry. The script runs on Ubuntu 20.04 server.
>
> Is it possible to play from that file while it is being downloaded, i.e. opening
> it in some way in a video player?

Strictly speaking, you are not downloading, but rather creating.

> I have tried using VLC but nothing happens, probably because I am doinmg
> something wrong.

You're not doing anything wrong - the MP4 format is wrong.

Your problem is due to the nature of the MP4 format. It doesn't hold
any sort of preliminary metadata header to allow playing the file. MP4
may be widespread, but in this sense it's not useful at all.

You could write to a different format such as Matroska/MKV, or MPEG-TS.
The disadvantage being that if your final file needs to be MP4, you
need to remux afterwards.

Also see this suggestion by Gyan:
https://superuser.com/a/1530949

Hilsen,
Moritz


More information about the ffmpeg-user mailing list