Page 1 of 1

change mime and boundary for mjpeg http stream?

Posted: 09 May 2010 09:46
by toninlg
Hi,

Is there a way to change the mime type and boundary for an http streaming of an mjpeg stream in order to make the stream working with firefox?
I've found something like this on the web :

Code: Select all

:sout=#transcode{vcodec=MJPG,vb=400,width=320,height=240}: duplicate{dst=std{access=http{mime=multipart/x-mixed-replace; boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:1234/webcam.mjpg}}
but it doesn't seem to work.

Does anybody have an idea?

Thank you.

Re: change mime and boundary for mjpeg http stream?

Posted: 09 May 2010 10:13
by Rémi Denis-Courmont
You may need to use quotes here. And the correct boundary is "boundary=7b3cc56e5f51db803f790dad720ed50a", not "boundary=--7b3cc56e5f51db803f790dad720ed50a".

Re: change mime and boundary for mjpeg http stream?

Posted: 09 May 2010 11:09
by toninlg
It doesn't work. If I try to read it with an other vlc instance, I have the message :
access_http error: malformed header line: "boundary=7b3cc56e5f51db803f790dad720ed50a"
and with firefox, nothing happens.

Re: change mime and boundary for mjpeg http stream?

Posted: 09 May 2010 18:45
by toninlg
I have tested the playback from an axis camera emulator (http://sourceforge.net/projects/axisemulator/).
It works with Videolan. The Content-Type is: multipart/x-mixed-replace and the boundary=--myboundary.

Code: Select all

main debug: creating access 'http' path='127.0.0.1:80/axis-cgi/mjpg/video.cgi?camera=1&resolution=480x360&fps=25' main debug: looking for access module: 2 candidates access_http debug: http: server='127.0.0.1' port=80 file='/axis-cgi/mjpg/video.cgi?camera=1&resolution=480x360&fps=25 main debug: net: connecting to 127.0.0.1 port 80 main debug: connection: Resource temporarily unavailable qt4 debug: IM: Setting an input qt4 debug: Updating the geometry qt4 debug: Updating the geometry main debug: connection succeeded (socket = 1624) access_http debug: protocol 'HTTP' answer code 200 access_http debug: Server: BaseHTTP/0.3 Python/2.5.1 access_http debug: Content-Type: multipart/x-mixed-replace; boundary=--myboundary main debug: using access module "access_http" main debug: TIMER module_need() : 151.291 ms - Total 151.291 ms / 1 intvls (Avg 151.291 ms) main debug: Using AStream*Stream main debug: pre buffering main debug: received first data after 26 ms main debug: pre-buffering done 1024 bytes in 0s - 37 kbytes/s main debug: looking for stream_filter module: 2 candidates main debug: TIMER module_need() : 0.273 ms - Total 0.273 ms / 1 intvls (Avg 0.273 ms) main debug: looking for stream_filter module: 1 candidate main debug: using stream_filter module "stream_filter_record" main debug: TIMER module_need() : 0.127 ms - Total 0.127 ms / 1 intvls (Avg 0.127 ms) main debug: creating demux: access='http' demux='' path='127.0.0.1:80/axis-cgi/mjpg/video.cgi?camera=1&resolution=480x360&fps=25' main debug: looking for demux module: 50 candidates mjpeg debug: Multipart MIME detected, using separator: myboundary mjpeg debug: discard MIME header: Content-Length: 8988 main debug: selecting program id=0 main debug: using demux module "mjpeg" main debug: TIMER module_need() : 41.716 ms - Total 41.716 ms / 1 intvls (Avg 41.716 ms) main debug: looking for a subtitle file in C:\Program Files\VideoLAN\VLC\ main debug: looking for decoder module: 35 candidates avcodec debug: libavcodec already initialized avcodec debug: using direct rendering avcodec debug: ffmpeg codec (Motion JPEG Video) started main debug: using decoder module "avcodec" main debug: TIMER module_need() : 2.980 ms - Total 2.980 ms / 1 intvls (Avg 2.980 ms) main debug: thread (decoder) created at priority 0 (../.././src/input/decoder.c:315) qt4 debug: Updating the geometry qt4 debug: Updating the geometry qt4 debug: Updating the geometry qt4 debug: Updating the geometry qt4 debug: Updating the geometry main debug: thread started main debug: `http://127.0.0.1:80/axis-cgi/mjpg/video.cgi?camera=1&resolution=480x360&fps=25' successfully opened main debug: Buffering 0% mjpeg debug: discard MIME header: Content-Length: 8341
I would like VLC to output a similar stream.
Thank you for your help.

Re: change mime and boundary for mjpeg http stream?

Posted: 09 May 2010 19:15
by Rémi Denis-Courmont
Just end the URL with .mpjpeg then

Re: change mime and boundary for mjpeg http stream?

Posted: 10 May 2010 00:28
by toninlg
Whatever I try, it doesn't work with Firefox. The boundary is always : 7b3cc56e5f51db803f790dad720ed50a.
I think that the boundary can't be changed :
http://www.videolan.org/developers/vlc/ ... eg_8c.html.
http://trac.videolan.org/vlc/ticket/1188

Re: change mime and boundary for mjpeg http stream?

Posted: 10 May 2010 18:18
by Rémi Denis-Courmont
I fail to see why you would need to change the boundary.

Re: change mime and boundary for mjpeg http stream?

Posted: 10 May 2010 22:55
by toninlg
I have an application that displays mjpeg stream from an axis camera. I want to use this application but with an mjpeg stream coming from an other source. So this alternative stream must have the same properties. The axis camera emulator uses a boundary that is --myboudary and this stream is read by firefox (and by vlc). The stream from vlc isn't read by firefox, I assume that is because of the boundary.

Re: change mime and boundary for mjpeg http stream?

Posted: 11 May 2010 18:00
by Rémi Denis-Courmont
As I already said, the VLC URL must end in .mpjpeg to get the correct HTTP Content-Type header.

Re: change mime and boundary for mjpeg http stream?

Posted: 13 May 2010 23:05
by toninlg
Is there an old version of vlc that supports configuration of header and boundary?

Re: change mime and boundary for mjpeg http stream?

Posted: 15 May 2010 12:23
by Rémi Denis-Courmont
No.

Re: change mime and boundary for mjpeg http stream?

Posted: 16 May 2010 02:26
by toninlg
Ok. So I'll try something more flexible or change the code as I need.

Re: change mime and boundary for mjpeg http stream?

Posted: 01 Jun 2010 10:41
by jansonb
So, did you find a way to do it?

I guess that if the output of VLC is a mpjpg container it should work.

Re: change mime and boundary for mjpeg http stream?

Posted: 22 Oct 2010 15:25
by mralex
Working solution on vlc-1.1.4_2,3 is next for VLM config:

new Cam83 broadcast enabled
setup Cam83 input /home/user/cam83-mjpeg-iphone.mp4 loop
setup Cam83 output '#standard{mux="mpjpeg",access="http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a}",dst="AA.BB.CC.DD:6666/video83.mjpg"}'
setup Cam83 option sout-keep

control Cam83 play