VLC HTTP specs

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
sepi_1982
Blank Cone
Blank Cone
Posts: 22
Joined: 21 Aug 2006 13:02

VLC HTTP specs

Postby sepi_1982 » 16 Nov 2006 13:43

Hello,

i am trying to forward a stream from a java application to VLC via HTTP.

I started a serverSocket on port 1234 and VLC connect via HTTP with the address http://localhost:1234
When the socket is created , i first sent this tags to VLC:
out.write( new String("HTTP/1.0 200 OK").getBytes() );
out.write( new String("Content-type: application/octet-stream").getBytes() );

then i start to read my media file and forward the bytes to VLC. This seems to work with mpg files but it does not work with other formats, for instance .avi,.mp4 ...?

Is there some more configuration tags i should send to VLC player beforehand? is there somewhere a specification for streaming over HTML using VLC?

thanks a lot
sebastien

Rémi Denis-Courmont
Developer
Developer
Posts: 15260
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Postby Rémi Denis-Courmont » 16 Nov 2006 20:16

First, streaming through HTTP sucks, sucked and will always suck because TCP is not at all adapted to real-time streaming. Second, some file formats cannot be streamed (for instance, many AVI files require seeking).
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

sepi_1982
Blank Cone
Blank Cone
Posts: 22
Joined: 21 Aug 2006 13:02

Postby sepi_1982 » 17 Nov 2006 07:59

Hello, thanks for your reply.
What other solution do i have to forward my stream to VLC from a java application?
JVLC could have been a good solution but it seems their Linux support is really limitated and i never managed to run their example on my linux debian machine.

I also tried to handle the media with Java Media Framework, but this technology is old and really is hard to use and always generate wrong format exeception whats so ever.
So the only solution i could thing of so far is to forward the byte via sockets. The VLC connect to my ServerSocket using http://localhost:1234.

What do you mean by "many AVI files require seeking" ?

have a nice day
Sebastien

Rémi Denis-Courmont
Developer
Developer
Posts: 15260
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Postby Rémi Denis-Courmont » 17 Nov 2006 08:49

Streaming should be done on top of UDP, or better yet UDP/RTP. Of course, not all formats allow this. MPEG-TS encapsulation is the safest choice for streaming.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

sepi_1982
Blank Cone
Blank Cone
Posts: 22
Joined: 21 Aug 2006 13:02

Postby sepi_1982 » 17 Nov 2006 09:43

Hello

Thanks for your reply, i will give a try to UDP. Using RTP would bring me back to Java Media framework, i spent months with JMF and did not have successful results.

For streaming more types of file i should first try to transcode the file to MPEG_TS with VLC?

is it possible to transcode and stream a file at the same time vith VLC command line?
regards
sebastien

Rémi Denis-Courmont
Developer
Developer
Posts: 15260
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Postby Rémi Denis-Courmont » 17 Nov 2006 10:04

Sure. Please refer to the streaming howto from the documentation on the official website for this.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

sepi_1982
Blank Cone
Blank Cone
Posts: 22
Joined: 21 Aug 2006 13:02

Postby sepi_1982 » 21 Nov 2006 15:42

Hello,

I have been investigating more HTTP and UDP streaming. When i try to stream file such as wav.mp4 files (sending raw bytes to VLC), i get this kind of errors in the messages output:

main debug: adding playlist item `http://localhost:1234' ( http://localhost:1234 )
main debug: creating new input thread
main debug: waiting for thread completion
main debug: thread 4072 (input) created at priority 1 (input/input.c:261)
main debug: `http://localhost:1234' gives access `http' demux `' path `localhost:1234'
main debug: creating demux: access='http' demux='' path='localhost:1234'
main debug: looking for access_demux module: 0 candidates
main warning: no access_demux module matched "http"
main debug: creating access 'http' path='localhost:1234'
main debug: looking for access2 module: 7 candidates
access_http debug: http: server='localhost' port=1234 file='(null)
main debug: net: connecting to localhost port 1234
main debug: connection in progress
access_http debug: protocol 'HTTP' answer code 200
access_http debug: Content-Type: application/octet-stream
main debug: using access2 module "access_http"
main debug: pre-buffering...
main debug: received first data for our buffer
main error: recv failed (10054)
main error: recv failed (10054)
main debug: pre-buffering done 375220 bytes in 0s - 3612 kbytes/s
main debug: creating demux: access='http' demux='' path='localhost:1234'
main debug: looking for demux2 module: 44 candidates
wav debug: chunk: fcc=`fmt ` size=16
wav debug: format: 0x0001, fourcc: araw, channels: 1, freq: 44100 Hz, bitrate: 86Ko/s, blockalign: 2, bits/samples: 16, extra size: 0
wav debug: found Raw audio audio format
wav debug: chunk: fcc=`data` size=423360
main debug: selecting program id=0
main debug: using demux2 module "wav"
main debug: looking for a subtitle file in C:\Program Files\VideoLAN\VLC\
main debug: looking for decoder module: 27 candidates
araw debug: samplerate:44100Hz channels:1 bits/sample:16
main debug: using decoder module "araw"
main debug: thread 4480 (decoder) created at priority 2 (input/decoder.c:159)
main debug: `http://localhost:1234' successfully opened
main debug: looking for audio output module: 3 candidates
aout_directx debug: OpenAudio
aout_directx debug: found device: Primary Sound Driver
aout_directx debug: found device: C-Media Wave Device
aout_directx debug: device supports 2 channels
aout_directx debug: device supports 1 channel
aout_directx debug: creating DirectSoundThread
main debug: thread 4460 (DirectSound Notification Thread) created at priority 15 (directx.c:372)
aout_directx debug: DirectSoundThread ready
main debug: using audio output module "aout_directx"
main debug: output 's16l' 44100 Hz Stereo/Mono frame=1 samples/4 bytes
main debug: mixer 'fl32' 44100 Hz Stereo/Mono frame=1 samples/8 bytes
main debug: filter(s) 'fl32'->'s16l' 44100 Hz->44100 Hz Stereo/Mono->Stereo/Mono
main debug: looking for audio filter module: 24 candidates
main debug: using audio filter module "float32tos16"
main debug: found a filter for the whole conversion
main debug: looking for audio mixer module: 3 candidates
main debug: using audio mixer module "trivial_mixer"
main debug: input 's16l' 44100 Hz Mono frame=1 samples/2 bytes
main debug: filter(s) 's16l'->'fl32' 44100 Hz->44100 Hz Mono->Stereo/Mono
main debug: looking for audio filter module: 24 candidates
main debug: looking for audio filter module: 24 candidates
main debug: using audio filter module "s16tofloat32"
main debug: looking for audio filter module: 24 candidates
main debug: using audio filter module "trivial_channel_mixer"
main debug: found 2 filters for the whole conversion
main debug: filter(s) 'fl32'->'fl32' 48510 Hz->44100 Hz Stereo/Mono->Stereo/Mono
main debug: looking for audio filter module: 24 candidates
main debug: using audio filter module "bandlimited_resampler"
main debug: found a filter for the whole conversion
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main error: recv failed (10054)
main debug: control type=0
main debug: control: stopping input
main debug: closing input
main debug: removing module "wav"
main debug: removing module "access_http"
main debug: removing module "araw"
main debug: thread times: real 0m1.312500s, kernel 0m0.031250s, user 0m0.000000s
main debug: thread 4480 joined (input/decoder.c:191)
main debug: killing decoder fourcc `araw', 0 PES in FIFO
main debug: removing module "s16tofloat32"
main debug: removing module "trivial_channel_mixer"
main debug: removing module "bandlimited_resampler"
aout_directx debug: closing audio device
aout_directx debug: DirectSoundThread exiting
main debug: thread times: real 0m1.296875s, kernel 0m0.000000s, user 0m0.000000s
main debug: thread 4460 joined (directx.c:598)
main debug: removing module "aout_directx"
main debug: removing module "float32tos16"
main debug: removing module "trivial_mixer"
main debug: thread times: real 0m1.468750s, kernel 0m0.000000s, user 0m0.000000s
main debug: thread 4072 joined (input/input.c:399)


What may go wrong here?
thanks a lot
sebastien

Rémi Denis-Courmont
Developer
Developer
Posts: 15260
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Postby Rémi Denis-Courmont » 21 Nov 2006 15:44

As the error code 10054 says, the remote peer does not accept the stream.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

sepi_1982
Blank Cone
Blank Cone
Posts: 22
Joined: 21 Aug 2006 13:02

Postby sepi_1982 » 22 Nov 2006 09:28

Hi,
yes i found out that also. Why VLC would not accept this stream? Do i need to send further information to VLC beforehand?

I just read byte by byte lets say a mp4 files and send the byte arrays to VLC via UDP or HTTP.
For HTTP i first need to initiate an HTTP connection by sending this:
HTTP/1.0 200 OK
Content-type: application/octet-stream
Cache-Control: no-cache

as i understand if i send to VLC large enough chunck of data, it should be able to find out the type of stream by itself, using some kind of stream analyser?

Sending UDP datagrams to VLC does not work better either.
I was thinking to convert any video to mpeg first, ffmpeg seems a good tool for that.

regards
sebastien

Rémi Denis-Courmont
Developer
Developer
Posts: 15260
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Postby Rémi Denis-Courmont » 22 Nov 2006 11:03

The peer does not accept the stream because you did not tell it to. It's as simple as that.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

sepi_1982
Blank Cone
Blank Cone
Posts: 22
Joined: 21 Aug 2006 13:02

Postby sepi_1982 » 23 Nov 2006 08:04

Terve,
thanks a lot for your help.
Yes, it is obvious that VLC does not accept my stream because i did not tell it to do so. But the fact is that i cannot find a way to configure it so that it may eventually accept the streams.
I try to use the "continuous stream" option in the VLC HTTP settings but it did not help.
For UDP there is not much options to set.
how should i configure VLC or what information should i send to VLC ?
Or What i try to do is not possible?

kiitos paljon
Seb

Rémi Denis-Courmont
Developer
Developer
Posts: 15260
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Postby Rémi Denis-Courmont » 23 Nov 2006 10:13

Open Network stream / UDP.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 16 guests