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

Anatoly anatoly at kazanfieldhockey.ru
Sat Nov 6 04:11:22 EET 2021

On Thu, 04 Nov 2021 01:00:52 +0100
Bo Berglund <bo.berglund at gmail.com> wrote:

> On normal streaming videos youtube-dl closes the video download on
> receiving Ctrl-C and then exits.
> And the interrupted video is fixed so it can be played.
> So I am using a this command structure in my at job to download a
> specific video:
> timeout --signal=2 64m youtube-dl -f hls-175 -o xxx.mp4
> some-youtube-stream-url
> And this causes youtube-dl to run for 64 minutes from when it was
> started and then cleanly close the video and exit.
> Not so with this one site, here youtube-dl will just abort the
> download and the xxx.part file remains and cannot be viewed.
> Is there any possibility to use ffmpeg itself to download from this
> kind of stream and if so what would the argument for the stream be?

This stream comes from "Odnoklassniki" Russian social network,
youtube-dl has support for this.
And youtube-dl anyway will just execute ffmpeg in turn like:
ffmpeg -y -headers <some_http_request_heahers> -i <some_url>
-c copy -f mp4 -bsf:a aac_adtstoasc file:<some_name>.part
So "xxx.part" file is normal mp4 file. If your file manager/player
doesnt know how to open it, being confused by extension, just fix
extension to xxx.mp4 manually. 

On Thu, 4 Nov 2021 12:29:17 +0100
Reino Wijnsma <rwijnsma at xs4all.nl> wrote:

> On 2021-11-04T08:54:40+0100, Bo Berglund <bo.berglund at gmail.com>
> wrote:
> > I assume you mean like this (replace [...] with actual file name):  
> Yes
> > However both commands results in this after the usual ffmpeg (or
> > maybe youtube-dl) output:
> > [https @ 0x55f0277f11c0] HTTP error 403 Forbidden
> > https://vsd79.mycdn.me/hls/1146644400798.m3u8/sig/2d23M3cZ2y0/expires/1636093952300/srcIp/*CHROME*/mid/2125507010206/1146644400798_high/index.m3u8:
> > Server returned 403 Forbidden (access denied)  
> Probably some piece of user-agent code in Youtube-dl that causes
> "CHROME" to appear in the video-url. The Xidel command I posted
> earlier returns "UNKNOWN" instead of "CHROME" (and another host) and
> appears to work.
Yes, with version 2021.04.17 of youtube-dl which I have by hand, it
works like this:
url=`youtube-dl -g -f hls-178 "https://msnbcdailyshows.com/"`
echo "URL IS: $url"
hdrs=`printf "User-Agent: Mozilla/5.0 (Windows NT 10.0; \
Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) \
Chrome/72.0.3626.42 Safari/537.36\r\n\
 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n\ 
 Accept: text/html,application/xhtml+xml,\
 Accept-Encoding: gzip, deflate\r\n\ 
 Accept-Language: en-us,en;q=0.5\r\n"`
echo "HEADERS: $hdrs"
/usr/local/bin/ffmpeg -headers "$hdrs" -i "$url" -c copy msn2.mp4

More information about the ffmpeg-user mailing list