phiola icon indicating copy to clipboard operation
phiola copied to clipboard

Can't connect to Webradio

Open Ducke1001 opened this issue 1 year ago • 45 comments

First of all, thank you for your great work. I tried an example from the description but it fails.

phiola http://server/stream -tee "@artist - @title.mp3"

The following command line was entered in the Windows console:

phiola http://mp3channels.webradio.de/chillout -tee "@artist - @title.mp3"

and it ends with an error message

09:49:32.005 #11020 WARN   http-client: *1: connect: (10049) Die angeforderte Adresse ist in diesem Kontext ungültig

I tried with several addresses. With the same result. But the adresses are valid. Is this an error in the command or in the program?

Ducke1001 avatar May 13 '24 11:05 Ducke1001

Hi! There are several problems with phiola:

  • it requires a port number to be specified in address
  • it doesn't support http redirections
  • it creates incorrect file names from server's meta data in this case

I'll fix the issues in the next release, thank you for bringing this up!

For now you can use this command:

phiola http://s2-webradio.webradio.de:80/chillout -tee "@counter.mp3"

stsaz avatar May 13 '24 15:05 stsaz

It looks like Phiola is trying to overwrite the file every new tag from the stream. I keep getting new files with your command. If I enter "@artist - @title.mp3" for "@counter.mp3", then the title is created correctly the first time, after that there are only error messages. For example

ERROR  file-write: *3: fffile_open: El Profesor - Bella Ciao (HUGEL Vocal Radio Cut).mp3: (80) Die Datei ist vorhanden

And later a file with the command parameter is created

ERROR  file-write: *6: fffile_open: @artist - @title.mp3: (80) Die Datei ist vorhanden

Ducke1001 avatar May 17 '24 06:05 Ducke1001

Fixed in 2.1-beta2. Now this command:

phiola http://mp3channels.webradio.de/chillout -tee "@artist - @title.mp3"

should work correctly.

It looks like Phiola is trying to overwrite the file every new tag from the stream.

Yes, now phiola will create new files only if the tags have been really changed (and not just sent out by server).

stsaz avatar May 18 '24 04:05 stsaz

Wow, you're fast. With the example address it works great now, thank you very much. I just tried other addresses. Unfortunately, many of my list don't work yet. For example:

http://mdr-284320-0.cast.mdr.de/mdr/284320/0/mp3/high/stream.mp3

brings the error message

#5520 ERROR  http-client: resource unavailable: 401 Unauthorized

or

http://radiorecord.hostingradio.ru/chil96.aacp

brings

 #8504 ERROR  file-write: *3: fffile_open: GEORG LEVIN - When I'm With You.mp3: (80) Die Datei ist vorhanden
 #8504 ERROR  file-write: *4: fffile_open: @artist - @title.mp3: (80) Die Datei ist vorhanden

like the first time.

Ducke1001 avatar May 18 '24 07:05 Ducke1001

401 Unauthorized

Got it, thanks! There's one more thing to fix.

fffile_open: GEORG LEVIN - When I'm With You.mp3: (80) Die Datei ist vorhanden

This is OK, because phiola won't overwrite your files without your permission. In general, I don't think you need to overwite any files in this case. Either use something like @counter. @artist - @title.mp3 to make all file names unique, or just ignore these errors. If you really want to overwite the files, use -force key, but be careful.

stsaz avatar May 18 '24 12:05 stsaz

The command with this adress fails

phiola http://radiorecord.hostingradio.ru/chil96.aacp -tee "@artist - @title.mp3"
#1 "MAPPS/JOSH RUBIN - Secrets" "http://radiorecord.hostingradio.ru/chil96.aacp" 0MB 0:00.000 (0 samples) 0kbps HE-AAC int16 44100Hz stereo

0:0013:27:36.976 #3976 INFO   file-write: *2: MAPPS_JOSH RUBIN - Secrets.mp3: written 14KB
13:27:36.976 #3976 ERROR  file-write: *3: fffile_open: MAPPS_JOSH RUBIN - Secrets.mp3: (80) Die Datei ist vorhanden
13:27:36.977 #3976 ERROR  file-write: *4: fffile_open: MAPPS_JOSH RUBIN - Secrets.mp3: (80) Die Datei ist vorhanden
0:01phiola crashed: C:\Users\Dirk\AppData\Local\Temp\phiola-crashdump-6648acc9.txt
phiola v2.1-beta2 (windows-amd64)
Signal:3221225477  Address:0x000002e6af979070  Flags:0  Thread:3976
#0: 0x00007ff6b8ce99cf +99cf D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\phiola.exe [0x00007ff6b8ce0000]
#1: 0x00007ff6b8ce2060 +2060 D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\phiola.exe [0x00007ff6b8ce0000]
#2: 0x00007fffafd2cd9c +15cd9c C:\Windows\System32\KERNELBASE.dll [0x00007fffafbd0000]
#3: 0x00007fffb295907d +a907d C:\Windows\SYSTEM32\ntdll.dll [0x00007fffb28b0000]
#4: 0x00007fffb293f187 +8f187 C:\Windows\SYSTEM32\ntdll.dll [0x00007fffb28b0000]
#5: 0x00007fffb29549ff +a49ff C:\Windows\SYSTEM32\ntdll.dll [0x00007fffb28b0000]
#6: 0x00007fffb28ce466 +1e466 C:\Windows\SYSTEM32\ntdll.dll [0x00007fffb28b0000]
#7: 0x00007fffb29539ee +a39ee C:\Windows\SYSTEM32\ntdll.dll [0x00007fffb28b0000]
#8: 0x00007fff7190f708 +f708 D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\mod\libsoxr-phi.dll [0x00007fff71900000]
#9: 0x00007fff7191fd09 +1fd09 D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\mod\libsoxr-phi.dll [0x00007fff71900000]
#10: 0x00007fff71921306 +21306 D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\mod\libsoxr-phi.dll [0x00007fff71900000]
#11: 0x00007fffa09b31a6 +31a6 D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\mod\soxr.dll [0x00007fffa09b0000]
#12: 0x00007fffaab050c4 +150c4 D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\libphiola.dll [0x00007fffaaaf0000]
#13: 0x00007fffaaaf2681 +2681 D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\libphiola.dll [0x00007fffaaaf0000]
#14: 0x00007fffaaaf6b9e +6b9e D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\libphiola.dll [0x00007fffaaaf0000]
#15: 0x00007ff6b8cf3c97 +13c97 D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\phiola.exe [0x00007ff6b8ce0000]
#16: 0x00007ff6b8ce13ae +13ae D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\phiola.exe [0x00007ff6b8ce0000]
#17: 0x00007ff6b8ce14e6 +14e6 D:\Programmierung\wxbasic\Projects\myMenu\ThirdParty\phiola-2\phiola.exe [0x00007ff6b8ce0000]
#18: 0x00007fffb15e257d +1257d C:\Windows\System32\KERNEL32.DLL [0x00007fffb15d0000]
#19: 0x00007fffb290aa48 +5aa48 C:\Windows\SYSTEM32\ntdll.dll [0x00007fffb28b0000]

Ducke1001 avatar May 18 '24 13:05 Ducke1001

13:27:36.976 #3976 ERROR file-write: *3: fffile_open: MAPPS_JOSH RUBIN - Secrets.mp3: (80) Die Datei ist vorhanden

Oh, this is another issue indeed, and it happens with AAC streams. Will be fixed.


Signal:3221225477  Address:0x000002e6af979070  Flags:0  Thread:3976
...
#8: 0x00007fff7190f708 +f708 ...\phiola-2\mod\libsoxr-phi.dll [0x00007fff71900000]

This one will be more difficult. Does it happen every time you try to play this radio stream? I will try to perform thorough testing of phiola on Windows, there might be a global bug somewhere...


phiola http://radiorecord.hostingradio.ru/chil96.aacp -tee "@artist - @title.mp3"

You should use .aac extension here instead of mp3, because the radio stream is AAC and -tee does not perform any audio conversion - it just saves the data as-is on your disk.

stsaz avatar May 20 '24 16:05 stsaz

Fixed in v2.1-beta3:

(80) Die Datei ist vorhanden

and

401 Unauthorized

stsaz avatar May 25 '24 05:05 stsaz

Thank you for the fix. Most of the time Phiola works well with aac now. But sometimes it still crashes. Unfortunately I can't say in which situation.

φphiola v2.1-beta3 (windows-amd64)
12:13:44.410 #40296 ERROR  file-write: *2: fffile_open: RE TRACT_MARTHA PHILLIPS - Immutable.mp3: (0) Der Vorgang wurde erfolgreich beendet

#1 "RE TRACT/MARTHA PHILLIPS - Immutable" "http://radiorecord.hostingradio.ru/chil96.aacp" 0MB 0:00.000 (0 samples) 0kbps HE-AAC int16 44100Hz stereo

phiola-crashdump-6651b9d8.txt

I'm also having trouble redirecting from another program to hide the Console window. Phiola suddenly requires 11..12% CPU instead of <1% without redirection. What could be the reason?

Ducke1001 avatar May 25 '24 10:05 Ducke1001

Or I get this error while recording:

φphiola v2.1-beta3 (windows-amd64)
16:52:02.812 #17804 ERROR  file-write: *2: fffile_open: deleted\Records\LIAM THOMAS - Against My Skin.aac: (0) Der Vorgang wurde erfolgreich beendet

#1 "LIAM THOMAS - Against My Skin" "http://radiorecord.hostingradio.ru/chil96.aacp" 0MB 0:00.000 (0 samples) 0kbps HE-AAC int16 44100Hz stereo

0:0016:52:02.948 #17804 ERROR  file-write: *2: fffile_open: @��/: (123) Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch
0:0116:52:03.978 #17804 ERROR  file-write: *2: fffile_open: @��/: (123) Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch
...

Ducke1001 avatar May 25 '24 14:05 Ducke1001

I'm also having trouble redirecting from another program to hide the Console window. Phiola suddenly requires 11..12% CPU instead of <1% without redirection.

Interesting... Can you show the command line so I can try it myself?

(123) Die Syntax für den Dateinamen ...

I saw this once too (corrupted file name), but couldn't catch it with debug logging. Can you run phiola as phiola -Log phi.log -D ... to collect debug logs when this happens next time?

UPDATE: I was able to catch this one! No need for you to collect debug logs here.

stsaz avatar May 25 '24 16:05 stsaz

I'm using the wxBasic Interpreter. It's a fork of wxWidgets cpp library. But due to the slow development, it never really became known. To be honest, I don't know whether it will be developed further. I've been working with it for almost 20 years now.

I have written an internet radio with a database that can be expanded to around 28000 stations and would like to improve the recording function with Phiola. In the short form to test:

Dim webProcess = New wxProcess()
//webprocess.Redirect()

Dim phiolaPath = "D:\\phiola-2\\phiola.exe"
Dim out = "D:\\Records\\"
Dim opt = " -vol 0 -tee " &"\"" &out &"@artist - @title.mp3" &"\"" 

wxExecute(phiolaPath &" " &"http://radiorecord.hostingradio.ru/chil96.aacp" &opt, wxEXEC_ASYNC, webProcess) 

This should also work in wxwidgets and the CPU usage is below 1%. If I activate "webprocess.Redirect()", then the CPU usage is around 12%. The aac stream is not automatically converted to mp3, is it? The saved stream has the ending "mp3", but is aac. Then you would have to get an event or flag when the file is completely saved and a new file is created. Otherwise the conversion will not work.

I'm testing the debugging.

Ducke1001 avatar May 25 '24 17:05 Ducke1001

then the CPU usage is around 12%.

Please open Task Manager and find the process that eats this cpu time. Is it really phiola.exe? If so, please post here what the Command Line column shows.

The aac stream is not automatically converted to mp3, is it?

Currently phiola doesn't support encoding to MP3. I removed it because I think that everyone should use modern and better audio encoders such as Opus, Vorbis and AAC. Do you really need encoding to MP3 for some reason?

Then you would have to get an event or flag when the file is completely saved and a new file is created.

This can be achieved for example by your script if it will read INFO...written xxxKB line in phiola's output.

I'm testing the debugging.

Actually, I've already caught the bug which causes the crashes. I will fix it in the next release.

stsaz avatar May 25 '24 17:05 stsaz

Unfortunately, no error message is displayed when debugging. So it is difficult to see the error. Attached is a saved log where the output was 0 kb. I think this is a case like that. phi.log

Ducke1001 avatar May 25 '24 17:05 Ducke1001

@Ducke1001 Is your project opensource? FYI, I've created the page where you can post the links to your work. Maybe others will find it interesting too. https://github.com/stsaz/phiola/issues/38

stsaz avatar May 26 '24 07:05 stsaz

Please open Task Manager and find the process that eats this cpu time. Is it really phiola.exe? If so, please post here what the Command Line column shows. I use System Informer as task manager. Attached is the screenshot.

Phiola_CPU

Currently phiola doesn't support encoding to MP3. I removed it because I think that everyone should use modern and better audio encoders such as Opus, Vorbis and AAC. Do you really need encoding to MP3 for some reason?

Yes, mp3 is no longer the latest and greatest codec. But I think it is the best known and still the most used. At least for people who aren't that interested in it. That's why I wanted to at least offer a conversion. Therefore the conversion is not necessary. But it would be nice to have.

This can be achieved for example by your script if it will read INFO...written xxxKB line in phiola's output.

Ok, I'll take another look at this.

Is your project opensource? FYI, I've created the page where you can post the links to your work. Maybe others will find it interesting too.

Thanks for your offer. Yes it is opensource. But at the moment I haven't published it yet. There are still some bugs to be fixed, the language to be changed and a description to write.

Ducke1001 avatar May 26 '24 08:05 Ducke1001

Attached is the screenshot.

Thank you! I can reproduce this now, it will be fixed.

stsaz avatar May 26 '24 10:05 stsaz

then the CPU usage is around 12%.

and

But sometimes it still crashes.

Both problems are fixed in v2.1-rc4. Should not crash anymore, or at least not that often :)

stsaz avatar Jun 01 '24 05:06 stsaz

Both problems are fixed in v2.1-rc4.

Thank you very much. There are no more problems with the redirection now.

Should not crash anymore, or at least not that often :)

But it still happens quite often when playing an aac stream.

Ducke1001 avatar Jun 02 '24 16:06 Ducke1001

But it still happens quite often when playing an aac stream.

Can you post the command line and the latest crashdump along with the last ~200 lines of debug log? Also, when does it happen? Does it crash immediately or after some time?

stsaz avatar Jun 03 '24 06:06 stsaz

Yes, I'll do it. But I'm on vacation right now. I'll have to see when I can get around to it.

Ducke1001 avatar Jun 03 '24 18:06 Ducke1001

Ok, here is the command line: D:\wxBasic\Projects\dsmPlayer\ThirdParty\phiola-2\phiola.exe -vol 0 "http://radiorecord.hostingradio.ru/chil96.aacp"

It is basically the same as before. If so, Phiola crashes immediately after starting. Otherwise it runs stable, I think.

phi.log phiola-crashdump-665f5376.txt

Ducke1001 avatar Jun 04 '24 18:06 Ducke1001

Oh, sorry. The laptop didn't have the latest version. I'll have to try again here.

Ducke1001 avatar Jun 04 '24 18:06 Ducke1001

So, now with the new version and the old command line: phi.log phiola-crashdump-665f5a06.txt

Ducke1001 avatar Jun 04 '24 18:06 Ducke1001

I tried to reproduce this on my side, and it works fine for me.

OK, first of all, the log file and crashdump do not match. How did you obtain the log file? You should exec phiola like this: phiola.exe -D -L phi.log URL

Also, does it crash if you play the .aac file that was recorded with phiola convert URL -copy -o 1.aac from this radio stream? I wonder if this problem is due to aac audio data decoding or it is specific to decoding from aac radio stream.

Also, how many aac radio streams result in this behaviour? Does it happen only for this particular radio station?

stsaz avatar Jun 06 '24 06:06 stsaz

OK, first of all, the log file and crashdump do not match. How did you obtain the log file? You should exec phiola like this: phiola.exe -D -L phi.log URL

Yes, I created the command line like this. I don't know why it doesn't match. It could be that the phiola.log was not recreated but appended. I hadn't deleted it before. There is a small time difference between the two because I shortened the log.

Ok, here are new logs. This time I deleted everything first. phi.log phiola-crashdump-6661eee3.txt

Also, does it crash if you play the .aac file that was recorded with phiola convert URL -copy -o 1.aac from this radio stream? I wonder if this problem is due to aac audio data decoding or it is specific to decoding from aac radio stream.

Hm, strange. When I use your command

phiola convert URL -copy -o 1.aac

I don't notice any crashes and I can play the aac without errors. But with

phiola URL

phiola crashes every few calls.

Also, how many aac radio streams result in this behaviour? Does it happen only for this particular radio station?

I tested it with several aac stations. It's always the same result.

Anything else. Stream addresses like this cause Phiola to crash.

http://streams.bigfm.de/bigfm-dance-128-aac?usid=0-0-H-A-D-30

and with

phiola convert URL -copy -o 1.aac

phiola also crashes if the file already exists.

Edit 1: With the redirection from my program it looked like a crash. But it isn't one. Sorry. The stream address comes from an imported playlist and phiola displays an error message that the syntax is wrong and terminates.

Edit 2: As you said, phiola does not overwrite the file. This can be solved using programming, or can phiola do it with appended numbers, like windows.

Ducke1001 avatar Jun 06 '24 18:06 Ducke1001

Sometimes when I start Phiola with an aac stream under Windows, a WerFault.exe is displayed in the task manager and Phiola is terminated.

Ducke1001 avatar Jun 14 '24 08:06 Ducke1001

Sometimes when I start Phiola with an aac stream under Windows, a WerFault.exe is displayed in the task manager and Phiola is terminated.

WerFault.exe is a Windows component, it's OK if it is started when any other Windows application crashes.

I still haven't been able to reproduce the crash issue you experience. I don't normally use Windows, it requires some special attention... I'll keep you updated on this.

stsaz avatar Jun 15 '24 05:06 stsaz

Hi! I created a new phiola build (with clang and address sanitizer) that I hope can help with the crash issue. It should print some more details in case of failure. Note that I couldn't reproduce the issue on my box.

This is the package: phiola-2.2-test0704-asan-windows-x64.zip built from branch: https://github.com/stsaz/phiola/tree/build-windows-clang

(This version will perform somewhat slower due to the enabled address sanitizer.)

Please test it. If the issue persists, just post here what it prints.

stsaz avatar Jul 04 '24 05:07 stsaz

Many thanks. I will test it.

Ducke1001 avatar Jul 05 '24 16:07 Ducke1001