[FFmpeg-user] How to download and transcode video stream to mp4 and save the TS stream to file at the same time?

Srikanth Kotagiri srikanthk at gmail.com
Mon Sep 30 08:06:34 EEST 2024


On Sun, Sep 29, 2024 at 9:19 PM Gyan Doshi <ffmpeg at gyani.pro> wrote:

>
>
> On 2024-09-30 01:29 am, Bo Berglund wrote:
> > I have created a script that downloads Internet video streams (basically
> news
> > programs) and transcodes to mp4 format with a fixed windows size.
> > As soon as the video stream recording ends the mp4 file can be played.
> >
> > I wonder if there is a way to let ffmpeg do two things at the same time:
> > - download as now but save the stream to a TS formatted file and:
> > - transcode to the mp4 format into a different output file
> >
> > This would make it possible to start viewing the downloaded file in TS
> format
> > while the real output file remains unplayable until the download
> finishes and
> > the moov atom gets written.
>
> Three months ago, ffmpeg's mov/mp4 muxer added a movflags called
> `hybrid_fragmented`
>
>  From the doc description,
>
> "
> For recoverability - write the output file as a fragmented file. This
> allows the intermediate file to be read while being written (in
> particular, if the writing process is aborted uncleanly). When writing
> is finished, the file is converted to a regular, non-fragmented file,
> which is more compatible and allows easier and quicker seeking.
>
> If writing is aborted, the intermediate file can manually be remuxed to
> get a regular, non-fragmented file of what had been written into the
> unfinished file.
> "
>
> Regards,
> Gyan
> _______________________________________________
> 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".


That sounds very interesting. Thanks!


More information about the ffmpeg-user mailing list