I know I can use this ffmpeg to live record this radio stream:
I have vlc here:Code:ffmpeg -i https://ais-sa1.streamon.fm/7079_32k.aac -acodec copy output.aac
C:\Program Files\VideoLAN\VLC\vlc.exe
Could someone give me the exact ffmpeg script to simultaneously download and play with vlc?
I know I can just use vlc to play the stream:
and then press the red record button in vlc, so this would simultaneously play and record (with vlc), but I would like to see if it is possible to use ffmpeg (for the recording) and have ffmpeg bring up vlc and have vlc play the stream.Code:https://ais-sa1.streamon.fm/7079_32k.aac
Note: this radio station is a 32kbps stream, and I don't want to use more than that amount of data to do this (recording and playing).
+ Reply to Thread
Results 1 to 14 of 14
-
Last edited by jimdagys; 28th Dec 2019 at 20:27.
-
Write the ffmpeg output as a transport stream (.TS) and you can play the video while it's downloading:
Wait several second (for the download to start and be flushed to the drive, maybe a minute for audio only downloads) then press Enter to start playing.Code:start /b "ffmpeg" ffmpeg.exe -i "https://ais-sa1.streamon.fm/7079_32k.aac" -c copy output.ts pause vlc output.ts
I didn't think this would work with an aac file (instead of ts) but it does.
Code:start /b "ffmpeg" ffmpeg.exe -i "https://ais-sa1.streamon.fm/7079_32k.aac" -c copy output.aac pause vlc output.aac
Last edited by jagabo; 30th Dec 2019 at 09:37.
-
It sounds stupid,but it's easier to download it through FFMPEG and just open it again in VLC (so 2 sources) (so do what Jagabo wrote and do your method opening with VLC too)
But from your message i understand that the stream is cutting out?
*press the loop button in VLC (if stream cuts out after couple of seconds/minutes),but most likely every time it refreshes your recording stops.
*Add "keep-connection-alive" to ffmpeg console:
-multiple_requests 1 -reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 2 -
Hi ,
My try , can be improved !!!
Process for shutdownCode:@echo on title Enr-Lect if exist %systemdrive%\progra~2\videolan\vlc (set "vlc=%systemdrive%\progra~2\videolan\vlc\vlc.exe") else (set "vlc=%systemdrive%\progra~1\videolan\vlc\vlc.exe") chcp 28591 > nul :ENR start /b "REC" ffmpeg -i "https://ais-sa1.streamon.fm/7079_32k.aac" -c copy -f mpegts output.ts :LECT ping localhost -n 30 >nul start /b "ECOUTE" "%vlc%" output.ts - :Suite "%vlc%" output.ts - goto Suite pause :fin
Window "Enr-Lect" : <Ctrl +C> and click on "X" ( right-top corner )
VLC : click on "X" ( right-top corner )
Cheers .Last edited by aazerty; 30th Dec 2019 at 12:08.
JE SUIS CHARLIE !!! -
streamlink has an option "-r" that both opens the player and writes to a file.
of course, doing this would not be using ffmpeg.Code:streamlink "hlsvariant://https://ais-sa1.streamon.fm/7079_32k.aac/playlist.m3u8" best -r "file.ts"
-
Ponens,
When I use streamlink v0.12.1 and above code, it brings up vlc and plays the radio station, but it doesn't seem to record anything. There is no evidence of recording in the command window, and I couldn't find any recording (from streamlink) on the computer. Of course I could just press the red record button in vlc, but I wanted to have the streamlink/ffmpeg/youtube-dl record and bring up vlc and play the station in vlc.
Jagabo,
I didn't think about just playing the "live" ffmpeg recorded file with vlc. That seems to work, although that seems a little strange to play a file that is still being expanded.
One issue with pressing the red record button on vlc while playing the radio station - I don't know if that is an analogue sound recording or a digital download. With poor internet, there might be some advantage of capturing the sound with command line software, vs sound recording with vlc. -
-
afaik, there is no problem in doing this. That's my preferred method. The file handle(s) of the windows os seem to handle it just fine, even if the stream eventually ends and the file is closed (by whatever program is writing to the file) while the player is still playing it.
-
I was pretty sure ffmpeg could split the output and send to a file and vlc simultaneously. I finally worked it out. Batch file:
Change the path to VLC to match where it is on your system. You can pipe to ffplay.exe instead with:Code:ffmpeg -i "https://ais-sa1.streamon.fm/7079_32k.aac" ^ -c copy output.aac ^ -f wav -acodec pcm_s16le -ac 2 - | "G:\Program Files\videolan\vlc\vlc.exe" -
From those you can see how to pipe to other players.Code:ffmpeg -i "https://ais-sa1.streamon.fm/7079_32k.aac" ^ -c copy output.aac ^ -f wav -acodec pcm_s16le -ac 2 - | "G:\Program Files\ffmpeg\bin\ffplay.exe" - -
Jababo,
Using what you gave:
this brought up vlc and played the radio station and I could see in the command line that it was recording and after quitting ffmpeg, I could see (output.aac) and play the recording. Thank you.Code:ffmpeg -i "https://ais-sa1.streamon.fm/7079_32k.aac" ^ -c copy output.aac ^ -f wav -acodec pcm_s16le -ac 2 - | "C:\Program Files\videolan\vlc\vlc.exe" -
Ponens,
I searched for file.ts on the computer and couldn't find anything. My command window (see below screenshot) does not look like
therain's command window, where you can clearly see recording going on. Could be my Windows 7 ?Last edited by jimdagys; 30th Dec 2019 at 20:41.
-
-
Well, one problem solved, but another mystery started.
I tried this (write ts file to root of c drive):
and thisCode:streamlink "hlsvariant://https://ais-sa1.streamon.fm/7079_32k.aac/playlist.m3u8" best -r "c:/file.ts"
and also right click on command prompt icon and run as admin, and let vlc come up and play the radio station, but in all cases the command window just sits there (like my above screenshot), and there is no recording.Code:streamlink "hlsvariant://https://ais-sa1.streamon.fm/7079_32k.aac/playlist.m3u8" best -r "C:\Users\John\Documents\file.ts"
-
Problem solved. I uninstalled my streamlink v0.12.1 and downloaded and installed the latest streamlink 1.3.0 (November 22, 2019) and then used the script that Ponens gave:
VLC came up and the radio station played, and after about 4 seconds, I see the recording process in the command window. The recorded music file (file.ts) was where expected (c/users/john) and I could play the file no problem.Code:streamlink "hlsvariant://https://ais-sa1.streamon.fm/7079_32k.aac/playlist.m3u8" best -r "file.ts"
Then I changed the recorded file extension to aac (because the radio station stream is aac, as far as I know):
and that also played and recorded fine.Code:streamlink "hlsvariant://https://ais-sa1.streamon.fm/7079_32k.aac/playlist.m3u8" best -r "file.aac"
Thank you for the help.
Similar Threads
-
MPEG 2 Extension for VLC? (VLC can't play its own recordings?!?!)
By gastrof in forum Newbie / General discussionsReplies: 17Last Post: 17th Dec 2018, 00:06 -
VLC cannot play MPEG-2 (.mpg) file (VLC cannot identify the audio or ...)
By Jeppe in forum Software PlayingReplies: 6Last Post: 30th Jan 2018, 20:47 -
Android:i want to play this channel in vlc android application (vlc.apk)
By sam jack in forum Newbie / General discussionsReplies: 5Last Post: 16th Oct 2017, 17:10 -
Playing two videos simultaneously in the same window on VLC?
By 123catty456 in forum Software PlayingReplies: 22Last Post: 3rd Oct 2017, 13:48 -
Play video and translate subtitles simultaneously software
By thcggg in forum SubtitleReplies: 1Last Post: 14th Apr 2015, 18:58



Quote