Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I capture audio streams with streamripper. It doesn't work on some streams, perhaps because it is 7 years old. Is there a more up-to-date program for this? Preferably one in a Slackware package, but streamripper isn't so I can build.
ffmpeg, mplayer, mpv, curl, wget, python urllib, gstreamer, a web browsers engine, will all capture media streams.
The bigger issue is usually finding the source of the stream. You'll need to learn about web scraping. Or just use the web inspector from your web browser.
If you want more info, then give more info on what you are doing. Are the urls plain in the web pages source? Then you can get them with curl.
Or do scripts on the page have to run to generate virtual links to the media? Then you will need something that will execute those scripts.
Are these streams mp3 files, or HLS segmented playlists, or dash segmented playlists? You'll have to get them a segment at a time and put them together. ffmpeg is great for that. So is curl.
Then there is youtube-dl, yt-dlp. Excellent bits of python.
Code:
yt-dlp --list-extractors
Even if the site isn't listed in the extractor list; If you can scrape the .m3u8 file from the page source, yt-dlp/youtube-dl will often times be able to get the segments from the playlist and use ffmpeg to put them all together.
Those are the transport stream segments. There are 513 of them.
You could download that with curl if you wanted to.
Code:
agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0"
curl -A "$agent" https://ga.video.cdn.pbs.org/videos/hawking/c41f6c7b-\
1884-42a9-a548-afa99063ad63/116618/hd-mezzanine-16x9/hakn0000_90min_me\
zz16x9-16x9-hls-1200k-[00000-00513].ts -o - >> Hocking.ts
You could also use ffmpeg on that .m3u8 playlist
Code:
ffmpeg -i "$pl2" -c:a copy -c:v copy Hocking.mp4
yt-dlp will also get that, once you have the playlist.
Code:
yt-dlp -F "$pl2"
HLS segmented video/audio streams are downloadable to file using simple tools. It's not the special tool that you need. It is the knowledge of how it works.
You all tell me how to download files, not capture streams. I may have the term wrong, but stream means a continuous, infinite, stream of data to me. Before I discovered streamripper I used mplayer, which requires me to schedule a separate task to stop the stream. I do this unattended, scheduled with crontab, on remote computers. streamripper allows me to set a duration, after which it will quit.
You all tell me how to download files, not capture streams. I may have the term wrong, but stream means a continuous, infinite, stream of data to me. Before I discovered streamripper I used mplayer, which requires me to schedule a separate task to stop the stream. I do this unattended, scheduled with crontab, on remote computers. streamripper allows me to set a duration, after which it will quit.
Well, by "capture" you mean downloading it to disk, no?
The process isn't different for (potentially endless) streams.
You just tell curl or wget or ffmpeg to stop after some time.
You all tell me how to download files, not capture streams.
No, I told you how to capture HLS streams. Which is what the majority of html5 audio/video are. Doesn't matter if you are playing a remote mp3 or a hls stream, the data stream still comes to your computer, 1 bit at a time.
These things are exactly the same. You use the same about of bandwidth. With the same results. You get to see the video.
A live stream on utube.
Watch mplayer spit out the segements
Well, by "capture" you mean downloading it to disk, no?
no.
Quote:
Originally Posted by ondoho
The process isn't different for (potentially endless) streams.
You just tell curl or wget or ffmpeg to stop after some time.
That takes a separate task, which, since I do it unattended, requires separate scheduling. Secondly streamripper continues to try to capture a stream for the duration of its assignment. Sometimes there's a glitch in the stream or the connection; streamripper doesn't quit until the time is up.
Quote:
Originally Posted by teckk
No, I told you how to capture HLS streams.
HLS?
Quote:
Originally Posted by teckk
Which is what the majority of html5 audio/video are
I'm not trying to capture the majority.
Quote:
Originally Posted by teckk
A live stream on utube.
Watch mplayer spit out the segements
All of your examples are of fetching finite files which are available in full at the initiation of the download.
Quote:
Originally Posted by teckk
You still haven't given an example.
https://audio.wbhm.org/live.mp3 - I don't see what difference it makes. mplayer will play it or dump the stream to a file (as will curl or wget or whatever), streamripper won't.
I already knew how to do all the things you-all have suggested. streamripper offers features that I want. It's 7 years old. Perhaps someone has written a similar app more recently.
https://audio.wbhm.org/live.mp3 - I don't see what difference it makes. mplayer will play it or dump the stream to a file (as will curl or wget or whatever), streamripper won't.
And mpv can do both at the same time.
Quote:
I already knew how to do all the things you-all have suggested. streamripper offers features that I want. It's 7 years old. Perhaps someone has written a similar app more recently.
So is this all your question is about? Recommendation for apps that can play live streams, and have certain (as yet undisclosed) "features"?
But your question asked about "capturing" them, and I still don't understand what you mean by that, if it's something else than playing and/or downloading them.
We've shown you that a lot of software can do that.
But you say you know all that already.
So what is capturing, and what does streamripper do that these softwares don't?
Once again you are asking an extremely vague question, then abuse LQ to help you clarify your own thoughts.
All of your examples are of fetching finite files which are available in full at the initiation of the download.
No they aren't That utube stream of the space station is a stream. Did you even bother to look at it?
Your example:
Code:
agent="Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/78.0.257670029 Mobile/19A348 Safari/604.1"
curl -LA "$agent" https://audio.wbhm.org/live.mp3 -o live.mp3
#Ctrl+C
ffprobe live.mp3
...
[mp3 @ 0x55dfabef9ec0] Skipping 392 bytes of junk at 0.
[mp3 @ 0x55dfabef9ec0] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'live.mp3':
Duration: 00:00:10.98, start: 0.000000, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
If that streams 24 hours a day, I could wake the machine up at 2am, catch an hour, go back to sleep. Start 2 min early, stop 2 min late. Just to make sure you got everything, allow for clock difference. You can always trim it later with ffmpeg.
Code:
#!/usr/bin/bash
#Wake, record audio stream, return to sleep. Needs rtcwake, curl
agent="Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/78.0.257670029 Mobile/19A348 Safari/604.1"
#Place to keep the recording
cd $HOME/somewhere
#Set wake date/time here, go to sleep
sudo rtcwake -m mem --date "2022-06-13 01:58:00"
#Allow everything to wake up
sleep 10
#Set recording time here
runtime=3720
#Get it
curl -LA "$agent" https://audio.wbhm.org/live.mp3 -o live.mp3 &
#Recording time
sleep "$runtime"
#Kill record
pkill curl
#Return to sleep
sudo systemctl suspend
And...you could stop curl more gracefully than the sledgehammer approach I used.
Please do not hijack other people's threads with unrelated wuestions. You already opened a thread about it yesterday, why don't you continue the discussion there.
Quote:
Originally Posted by Xeratul
it is the nokia banana 8000 series.
For now, I can play mp3 on it in the car. I plug the 3.5mm jack on it.
Ideally, I would a pi zero and play music in the car over the 3.5mm jack, but no idea how to do that. eventually add a TFT Joy it on the pi zero w.
streamripper https://audio.wbhm.org/live.mp3 -a live.mp3 -l 3600
captures an hour, requires no separate process to terminate, continues to try to capture the stream - or would, if it worked on wbhm - for the entire hour - even if the stream or the connection fails temporarily.
The downloading apps' model reads an end to the data as an EOF.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.