Hello Bo, I'm thinking as I read your question if it would actually be better to use a different transport format. For streaming over the Internet, I use Haivision's SRT protocol. It is integrated in ffmpeg since some time. I don't know if it's suitable for your purposes, it's just an idea. Best regards Toralf
Am Do., 9. Juni 2022 um 18:16 Uhr schrieb Bo Berglund <[email protected] >: > I have a question regarding how to "harden" my video stream downloads so > they do > not get corrupted if a glitch occurs, like Internet loss or something else. > > As it is now my streams download fine if all is working OK but when a > glitch > occurs the download stops and the video file on disk becomes unplayable. > > It happened again yesterday due to a power outage, but has happened before > for > other reasons like fiber connectivity problems etc. > > The remaining file is not viewable and depending on the viewer I can get a > message talking about missing moov something. > > So my download script uses this basic ffmpeg command to download the video: > > CMD="ffmpeg -hide_banner ${MODE} -i \"${M3U8URL}\" -vf scale=w=-4:h=480 > -c:v > libx264 -preset fast -crf 26 -c:a aac -t ${CAPTURETIME} ${TARGETFILE}" > > Where: > MODE="-referer \"${VIDEOURL}\"" > M3U8URL is the stream's m3u8 URL > CAPTURETIME is the time in seconds to download > TARGETFILE is the output mp4 file > > Now I wonder if there is some additional ffmpeg argument that can be added > to > make the output contuinuously "complete" such that it can be played as far > as > the download was done? > > Or if it is impossible given the output file format, is there some other > format > that can be used to harden the download? > > For example, can the download just write to file after reformatting the > size but > in say ts format and another process *simultaneously* read that file and > convert > it to mp4 during download? > > Then at least if the main download stops the "raw" ts file would remain... > Of course given that ts ia about 10x larger on disk than mp4 one has to > manage > this carefully to not fill up the drive.. > > > -- > Bo Berglund > Developer in Sweden > > _______________________________________________ > ffmpeg-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe". > _______________________________________________ ffmpeg-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
