[FFmpeg-user] Can ffmpeg record video from this kind of URL?

Bo Berglund bo.berglund at gmail.com
Thu Sep 2 22:08:43 EEST 2021


On Thu, 2 Sep 2021 11:38:06 +0300, Anatoly <anatoly at kazanfieldhockey.ru> wrote:

>> I have now cereated a script, which updates the URL-file with the
>> current items for the given URL.
>Actually, you may do all in one script like this
>#!/bin/sh
>msnurl="https://www.livenewsmag.com/msnbc-news-live-stream/"
>recdate=`date "+%Y%m%d-%H%M"`
>m3u8url=`curl "https://www.livenewsmag.com/msnbc-news-live-stream/" |
>grep -o -e "https://.\+m3u8" | head -n 1`
>ffmpeg -referer $msnurl -i $m3u8url -c copy "msnbc-${recdate}.mp4"
>

I have designed my script so it writes the page URL and m3u8-URL into the
url-file read by my main download script.
This main script does a number of other things too, like reformatting the video
to a fixed resolution and quality.
In order to secure the validity of the m3u8 I have set up a cron job that runs
the script a few ninutes before the download script starts. So it uses a fresh
version of the URL....

It happens a bit too often that one source goes bad but I have found 3 stream
pages with the same type of data so I can change one argument to my script to
switch the main URL (all 3 are present in the script), but right now that only
works if I detect that a problem has arisen and edit the crontab entry..


-- 
Bo Berglund
Developer in Sweden



More information about the ffmpeg-user mailing list