How to save stream media info

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

How to save stream media info

Postby MartinT » 02 Jan 2007 11:55

Is there any way, how to save stream media info into txt(xml) file or better directly into id3 tag? If i use VLC to save raw stream, it saves only audio data. The media info is only displaying on status bar. My idea of txt file structure is like this:

00:00:00 Artist1 Song 1
hh:mm:ss Artist2 Song 2
....
....
....
....

The stream is AAC+

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Postby VLC_help » 02 Jan 2007 18:11

The metadata (stream media info) can change during playback so it is little problematic (unless every change causes a new file to be created), but it is quite easy to implement (I am not sure if VLC can write tags).

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Postby MartinT » 02 Jan 2007 18:39

The metadata (stream media info) can change during playback so it is little problematic (unless every change causes a new file to be created), but it is quite easy to implement (I am not sure if VLC can write tags).
I used some software that created new file when the change occured. But there was problem, that sometimes end of one song crossed the beginning of another song and the cut wasn`t ideal. In adittion to reencoding stream by this program i stop using it.
So it is better for me, have one big file and store for example in comment tag playlist with structure that i sketched out above.
So i search funcion, that can store all metadata occured during streaming in (txt) file.
I`m not sure but i think, that metadata aren`t included in audio data. So there must exists reader for it. Have you any suggestions how recognize this data?
Last edited by MartinT on 02 Jan 2007 20:08, edited 2 times in total.

Tappen
Cone that earned his stripes
Cone that earned his stripes
Posts: 150
Joined: 30 Oct 2006 07:55

Postby Tappen » 02 Jan 2007 19:47

I'm actually trying to do this with my C# wrapper for VLC right now. I can tell when the media information changes by hooking changes to the "playlist-current" variable of the playlist, but getting the media information out of VLC is like pulling teeth: unless you want to compile your own build of Vlc and add some C++ code there's no reliable way of getting at the data externally that I can see.

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Postby MartinT » 03 Jan 2007 00:47

I'm not good in C++ programming.

I found partial solution to my problem with competitive player Mplayer.

Code: Select all

mplayer -dumpfile music.aac -dumpstream http://radio.address > playlist.txt
Now i have audio in music.aac file and metadata in playlist.txt file. Now it`s easy to extract with regular expression all songs descriptions.

Now i still search solution how to aad time information.

Tappen
Cone that earned his stripes
Cone that earned his stripes
Posts: 150
Joined: 30 Oct 2006 07:55

Postby Tappen » 03 Jan 2007 06:11

Well I figured out how to add this in C++/C# code, but the answer doesn't help you. I'd add this to the Feature Request forum, as I think it's a pretty good candidate for adding with the new playlist in 0.9.0.

I think there is a way of dumping out the debug messages in VLC which do contain updates to Now Playing meta-data. Is there a way to turn on timestamps for the message window and dump it for future parsing?

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Postby MartinT » 03 Jan 2007 12:59

If i use

Code: Select all

mplayer http://radio.address > playlist.txt

and configure mplayer to display status line the output is like this:

Code: Select all

ICY Info: StreamTitle='aqua - my oh my (h2o club mix)';StreamUrl=''; A: 1.3 (01.3) of 0.0 (unknown) ??,?% 18% A: 1.3 (01.2) of 0.0 (unknown) 1.3% 22% A: 1.3 (01.3) of 0.0 (unknown) 2.0% 22% A: 1.3 (01.3) of 0.0 (unknown) 2.0% 22% A: 1.3 (01.3) of 0.0 (unknown) 2.0% 22% A: 1.3 (01.3) of 0.0 (unknown) 1.9% 22% ...... ..... .... A: 424.0 (07:03.9) of 0.0 (unknown) 1.1% 45% A: 424.0 (07:04.0) of 0.0 (unknown) 1.1% 45% A: 424.0 (07:04.0) of 0.0 (unknown) 1.1% 45% A: 424.0 (07:04.0) of 0.0 (unknown) 1.1% 45% ICY Info: StreamTitle='jam & spoon feat plavka - find me (odyssey to anyoona)';StreamUrl=''; A: 424.0 (07:04.0) of 0.0 (unknown) 1.1% 45% A: 424.0 (07:04.0) of 0.0 (unknown) 1.1% 45% A: 424.1 (07:04.0) of 0.0 (unknown) 1.1% 45% A: 424.1 (07:04.0) of 0.0 (unknown) 1.1% 45% .... .... ....
On console the status line is periodicaly overwriten, because each line starting with "A:" is terminated by /r, but in the playlist file are all this informations on one very long line, which is terminated when the new metadata come. So the file playlist is extremely big. If i filter the output and save only first e.g. 100 charakters of each line. An output would be like this:

Code: Select all

ICY Info: StreamTitle='aqua - my oh my (h2o club mix)';StreamUrl=''; A: 1.3 (01.3) of 0.0 (unknown) ??,?% 18% ICY Info: StreamTitle='jam & spoon feat plavka - find me (odyssey to anyoona)';StreamUrl=''; A: 424.0 (07:04.0) of 0.0 (unknown) 1.1% 45%
You can see that now you get easy approximative start time of each song. I have idea how to make it in Linux, but no idea in Windows.

Another problem is, that when i use

Code: Select all

mplayer -dumpfile music.aac -dumpstream http://radio.address > playlist.txt
then the status line is not displaying. Only "ICY Info:" But this is rather for Mplayer forum.
I don`t know if something like this works in VLC.

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Postby MartinT » 03 Jan 2007 16:49

EDIT: After i installed sed for Windows.

I found solution for Mplayer but only when i play stream and status line is displayed. It look like this :

Code: Select all

mplayer http://radio.address | sed {s/^A:\(.\{20\}\).*$/ICY\1/} | findstr ^ICY > playlist.txt
Now the playlist.txt loks like this:

Code: Select all

ICY Info: StreamTitle='Enigma - Traces Light and Weight';StreamUrl=''; ICY 1.3 (01.2) of 0.0 ICY Info: StreamTitle='Mike Andrews - Song of the Spirits';StreamUrl=''; ICY 77.3 (01:17.3) of
So now i can easy write e.g.

Code: Select all

more playlist.txt | sed {s/^.*StreamTitle..\(.*\)..StreamUrl.*$/\1/} | sed {s/^.*(\(.*\)).*$/\1/} > out.txt
And the out.txt is now:

Code: Select all

Enigma - Traces Light and Weight 01.2 Mike Andrews - Song of the Spirits 01:17.3

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Simple and elegant solution

Postby MartinT » 05 Jan 2007 11:59

The simplest solution to my problem is to use streamripper:

Code: Select all

streamripper http://stream.radio.address -A -a


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 37 guests