I am watching MSDN news, which is made available as a stream (certain times of day only) on this site.
(Note that it is usually not streaming during USA nights...)
They used to have a YouTube channel too, where youtube-dl worked so I could automate the downloads on a Ubuntu 20.04 Server during the night in Sweden (evening shows in USA). Then I could view them in the morning.
But the Youtube channel was taken down a week or so ago so now the only available source is the video player on the home page.
I have found no way to download from this so I have been forced to set up a screen capture on a computer running over night using ffmpeg in a script. Not so good because the computer is blocked for other use and no sound except the playing video may be generated because it gets into the captured video too...
So I wonder if there is a way to actually download the stream data directly from the URL, like youtube-dl can for streams on YouTube?
+ Reply to Thread
Results 1 to 30 of 32
-
Last edited by BosseB; 28th Feb 2021 at 05:49.
-
No, that brings you to the CNN stream!
What I am after is the MSNBC stream, and that has been discontinued on YouTube, it was like the CNN stream for many months after I found this site. But about 2 weeks ago they discontinued the MSNBC stream on YouTube due to complaints from NBC, I guess.
But on the base page I linked to there are two video players, the top one is MSNBC and is the one I want to download from.
The other is CNN and plays the exact same content as the YouTube link on the page does.
When the MSNBC YouTube link was active it worked fine with youtube-dl and I could script getting the nightly (in Europe) evening shows.
Not so anymore, now all there is is this videoplayer page object which plays streamed MSNBC.
What I need is a way to download from the source feeding the player but using for example youtube-dl or ffmpeg directly. -
-
I tried to use youtube-dl, but when I tried to break the download with ctrl-C it resulted in myvideo.part and no mp4 file.
So cannot play it.
I will try streamlink too, but I don't know the call syntax for streamlink and its help does not contain some simple examples...
Off to google.
Maybe streamlink URL outputfile? -
-
You can often just rename the file with .mp4 and it will play. Or:
Code:youtube-dl --hls-use-mpegts --no-part -o output.ts https://hlss.goodgame.ru/hls/183955.m3u8
-
So I tried it and noticed that in the messages flying by on the screen I found this:
Code:[https @ 0x564ab91d10c0] HTTP error 402 Payment Required <=== Hmm, how can this be handled? [hls @ 0x564ab8e12cc0] Failed to open next segment 163187 of playlist 0 [hls @ 0x564ab8e12cc0] Opening 'https://hlss.goodgame.ru/hls/183955-163187.ts' for reading03x [https @ 0x564ab99b40c0] Opening 'https://hlss.goodgame.ru/hls/183955.m3u8' for reading
I only changed the ts extension to mp4 for the output file.
After 5.5 minutes the file is rather big already 151 Mbytes, which is a lot more than my usual downloads.
I normally download at 480p resolution.
But it seems like this stream does not carry any info on available resolutions... -
Why would you change the extension to mp4? It's a transport stream, .TS. As far as I can tell there's only a 720p version of the MSNBC stream. Even in a web browser that's all you can get.
-
The reason I changed it is that I want the file on disk to be compressed, i.e. smaller in size.
AFAIU the downloaders (youtube-dl or ffmpeg) adjusts the compression according to the file type. But I may be wrong...
Recoding it after the download is a time consuming operation. -
If you want to downscale to 480p and re-encode to mp4 you want a command line like:
Code:youtube-dl "https://hlss.goodgame.ru/hls/183955.m3u8" -o - | ffmpeg -i - -vf scale=w=856:h=480 -c:v libx264 -preset veryfast -crf 25 -c:a copy output.mp4
-
Here's how you can download with ffmpeg :
Code:ffmpeg -user_agent "Mozilla" -i https://hlss.goodgame.ru/hls/183955.m3u8 -c copy output.ts
Code:ffmpeg -user_agent "Mozilla" -i https://hlss.goodgame.ru/hls/183955.m3u8 -vf scale=w=856:h=480 -c:v libx264 -preset veryfast -crf 25 -c:a copy output.mp4
Or play the video with ffplay:
Code:ffplay -user_agent "anything" -i https://hlss.goodgame.ru/hls/183955.m3u8
Code:#EXTM3U #EXTINF:0 MSNBC #EXTVLCOPT:http-user-agent=Android https://hlss.goodgame.ru/hls/183955.m3u8
Last edited by jagabo; 28th Feb 2021 at 21:27.
-
Just to clarify so I understand it correctly, if I use this command:
Code:ffmpeg -user_agent "Mozilla" -i https://hlss.goodgame.ru/hls/183955.m3u8 -vf scale=w=856:h=480 -c:v libx264 -preset veryfast -crf 25 -c:a copy output.mp4
If so it is a real boon since the "after the download" conversion takes a long time...
Since I am using Ubuntu for the downloads:
To get the right time span I need to hit q with ffmpeg, but if I script this and put it into an at job how can I send the q into ffmpeg?
Currently when I have used youtube-dl in scripts I set the download time by using the timeout command:
Code:timeout --signal=2 65m youtube-dl.....
Probably youtube-dl sends q to ffmpeg...
I like to have the download+conversion scripted into at jobs so they are not forgotten... -
REPLY TO SELF:
Obviously if one knows the length of the download one just putsCode:-t <length in seconds>
@jagabo:
I am really grateful for your reply, it seems to solve most of my problems! -
Yes.
Be aware that a slow computer might not be able to keep up with a live broadcast. That's why I chose the veryfast preset (fast, ok quality) rather than something slower. To get the best quality (per bitrate) you may want to do a slower re-compression after downloading. -
Just a final detail which I am wondering about:
In the ffmpeg command the resize argument is this:
Code:-vf scale=w=856:h=480
Otherwise the aspect ratio would have to be changed and that might be a harder computational task, or not?
Is there a way to use something like a wildcard for the horizontal so ffmpeg can figure out by itself the proper output width of the resulting video? -
I just picked the nearest mod8 width. You're not going to notice the difference between 854x480 and 856x480. You can use a negative value to specify the nearest mod N that matches the other dimension:
Code:-vf scale=w=-4:h=480
Code:-vf scale=w=640:h=-4
-
Now that I have downloaded a number of videos using the command shown here I have an additional question:
It seems like I am getting a video-audio time difference so lip-sync is bad.
To fix this I can apply an ffmpeg command like this (for a 340 ms difference):
Code:ffmpeg -i input.mp4 -itsoffset -0.34 -i input.mp4 -map 1:v -map 0:a -c copy output.mp4
I am using this capture cmd in my script at the moment:
Code:ffmpeg -user_agent \"Mozilla\" -i $VIDEOURL -vf scale=w=-4:h=480 -c:v libx264 -preset veryfast -crf 25 -c:a copy -t $CAPTURETIME $TARGETFILE
If so what is the correct syntax?Last edited by BosseB; 2nd Mar 2021 at 01:51.
-
Using itsoffset requires that you have two source videos. Opening the stream twice would use twice the bandwidth and you can't be sure the two streams will be synchronized. If you don't mind re-encoding the audio you can use the adelay audio filter:
Code:ffmpeg -y -user_agent "Mozilla" -i https://hlss.goodgame.ru/hls/183955.m3u8 -vf scale=w=-4:h=480 -c:v libx264 -preset veryfast -crf 25 -c:a aac -af adelay=350ms:all=1 -async 1 output.mp4
-
I thought as much given the two sources even if they are one and the same...
So I would probably be better off launching the audio delay from the download script once it has finished downloading.
That would be the more stable solution, I think.
I have noted that the audio resync is pretty quick, only takes a couple of seconds on a downloaded 1 hour video, so it would not be a big problem.
I have a script already that does this so I just have to call it from the download script to make this happen.
Thanks for the information! -
I have now used the commands suggested here to download the video stream to file for a number of time slots (using the at command).
What I have found is that the download itself seems to incur irregular pauses in the resulting file possibly caused by computational overload of the computer.
Since the conversion to ffmpeg and the simultaneous size change might be very computationally intensive I am now looking at the different commands:
1) Capture the video to file in the raw ts format. You already gave that command in the replies above.
Code:ffmpeg -user_agent "Mozilla" -i https://hlss.goodgame.ru/hls/183955.m3u8 -c copy output.ts
2) Convert the data now on disk from ts to mp4, I found this to just convert into compressed mp4 without the change of scale:
Code:ffmpeg -i input.ts -map 0 -c copy output.mp4
3) Convert the data now on disk to mp4 compression AND change of scale:
Code:ffmpeg -i input.ts -vf scale=w=-4:h=480 -c:v libx264 -preset veryfast -crf 25 -c:a copy output.mp4
4) Only compress the video:
Code:ffmpeg -i input.ts -c:v libx264 -preset veryfast -crf 25 -c:a copy output720.mp4
I can speed up the conversion times by not using the Ubuntu server itself but instead run the command in a command window on my Windows main computer with the files still located on the Ubuntu server via a shared folder.
But it still takes a pretty long time to get from the 1280x720 ts file to a 852x480 mp4 file.
In any case it seems like I should download to a ts file so as not to inflict capture losses due to heavy load on the Ubuntu server.
Then I need to launch the conversion process after the download finishes.
Now I just wonder if the download of the next video, which started when the first was done, will be affected by the processing load of the first video's conversion? -
Your computer must be pretty slow. Downloading as a TS file takes almost no CPU time. You can be sure a simultaneous conversion doesn't disturb the downloading of another video by running the conversion at a low priority. I don't know how to do it on Linux but on Windows you can do it with:
Code:start /b /low "title" ffmpeg -i input.ts -vf scale=w=-4:h=480 -c:v libx264 -preset veryfast -crf 25 -c:a copy output.mp4
Last edited by jagabo; 3rd Mar 2021 at 18:38.
-
youtube downloader is https://televzr.com/video-downloader/youtube but just blank black in VCL I tried with youtube updated to latest. Would not work.
-
As it is now I am doing this:
- File store on a Ubuntu 18.04 server running on low-end hardware, available via nfs to the other computers..
- Download videos to a dir on the nfs server executed as 1-hour at jobs on an Ubuntu 20.04 laptop (HP Workstation from 2010).
No conversion done, just store the ts stream.
- Conversion from ts to mp4 format and reduction from 1280x720 to 852x48 done by a batch job on my Windows 10 new HP workstation
The conversion is done at a speed of about 7-8X so it takes 6-8 min to do for each video and the Win10 CPU load raises to about 80% when it is running.
Then the edit is manual on my Win10 computer...
Before I downloaded to ts format and at full resolution I tried the command to download and convert both format and size on the fly but it resulted in audio gaps...
No longer so. -
@jagabo
I'm pretty far away from Your Knowledges about FFmpeg-CommandLines.
I just wonder, why don't You use -preset ultrafast instead of -preset veryfast ?FFmpeg based FFPlay4Laz + FFGrab4Laz - RunFFmpeg. -
Similar Threads
-
Help to download streaming from this site.
By MarcosJeevs in forum Video Streaming DownloadingReplies: 10Last Post: 7th Jan 2021, 03:50 -
How to download streaming video from this site
By ningnong132 in forum Video Streaming DownloadingReplies: 11Last Post: 11th Dec 2020, 07:35 -
HELP with an unknown site (cannot download streaming files)
By vampire5 in forum Video Streaming DownloadingReplies: 6Last Post: 26th May 2020, 09:47 -
Download from rtlmost.hu (Hungarian streaming site)
By HunVideoMan in forum Video Streaming DownloadingReplies: 0Last Post: 3rd Mar 2020, 19:40 -
Download Streaming Site Subtitle
By bentheguitarman in forum SubtitleReplies: 4Last Post: 10th Mar 2019, 11:01