Output a jpeg instead of a movie

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.
MortenKjarulff
Blank Cone
Blank Cone
Posts: 41
Joined: 14 Jun 2009 14:12

Output a jpeg instead of a movie

Postby MortenKjarulff » 01 Dec 2009 11:50

Hi,

I run this vlm conf to stream a webcam:

Code: Select all

new chl0 broadcast enabled setup chl0 input dshow:// setup chl0 option dshow-vdev="Logitech QuickCam Chat " setup chl0 output #transcode{vcodec=FLV1,acodec=mp3,channels=2,samplerate=44100,width=320,height=240,fps=1,sfilter=mosaic:marq{marquee=%Y%m%d-%H%M%S,position=8}}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:80/cam0.flv} control chl0 play
With this I can view the live stream at http://localhost/cam0.flv, works fine.

Question: Can I somehow modify the conf so I also see a still picture at http://localhost/cam0.jpg? The picture should be the most recent frame, so when I press F5 in the browse, I should see a new picture.

/Morten

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

Re: Output a jpeg instead of a movie

Postby VLC_help » 01 Dec 2009 16:11

Not easily AFAIK because sout doesn't have JPEG output module. You can store images to harddrive and link them to another http server.

MortenKjarulff
Blank Cone
Blank Cone
Posts: 41
Joined: 14 Jun 2009 14:12

Re: Output a jpeg instead of a movie

Postby MortenKjarulff » 01 Dec 2009 16:29

Ok. Currently I run a vlm conf that stream 2 cams, and then run 2 more instances of vlc to save snapshots of the 2 stream (see viewtopic.php?f=2&t=60841), is this the way to do it?

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: Output a jpeg instead of a movie

Postby erwan10 » 01 Dec 2009 22:06

Question: Can I somehow modify the conf so I also see a still picture at http://localhost/cam0.jpg? The picture should be the most recent frame, so when I press F5 in the browse, I should see a new picture.
I found a solution to your question for Linux (should also work on Windows with some changes in the scripts) :

I kept away from vlm that cannot detect vout correctly. I used the following scripts :
vlc \
--verbose 2 \
--intf rc \
--rc-host 127.0.0.1:1234 \
--snapshot-path /tmp/snapshot.png \
--vout dummy \
--sout '#duplicate{dst=display,dst={transcode{vcodec=FLV1,acodec=mp3,channels=2
,samplerate=44100,width=320,height=240,fps=1,sfilter=mosaic:marq{marquee=%Y%m%d-
%H%M%S,position=8}}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8080/cam0.fl
v}}' \
v4l2:///dev/video0
This script launches vlc with a similar stream as yours, plus a local display on a dummy vout. This dummy vout allows you to issue snapshot commands as you like.
#!/bin/bash

nc -q 0 127.0.0.1 1234 <<EOF
snapshot
EOF
This second script is a shell script to issue snapshot commands. This script can be used as a CGI program within a web server. The --snapshot-path in the first script must refer to the physical location of your http://localhost/cam0.jpg file.
You can then use F5 to update the site with a still image in real time.


Erwan10

MortenKjarulff
Blank Cone
Blank Cone
Posts: 41
Joined: 14 Jun 2009 14:12

Re: Output a jpeg instead of a movie

Postby MortenKjarulff » 02 Dec 2009 10:32

Thank you.

As I understand you, I will have to have a page which call the snapshot script and show the image. The snapshot script should be called first, and when the image is loaded, it will be the newly created one, right? (I don't know how to code such a page, but I will ask for help if I go that way).

Next one: I have 2 cameras, the other one is shown at http://localhost/cam1.flv. I have to use port 80 for both stream, and both still pictures, can this be done using your scripts?

In case you don't know, you can use bash to issue the commands over tcp:

Code: Select all

echo snapshot >/dev/tcp/127.0.0.1/1234
/Morten

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: Output a jpeg instead of a movie

Postby erwan10 » 02 Dec 2009 12:05

Actually, I got something running on Windows with wampserver2.0 (Apache2.2) and vlc1.0.3

Here is the bat script :

PATH=D:\tmp\vlc\vlc-1.0.3-win32\vlc-1.0.3;%PATH%
cd D:\tmp\vlc\vlc-1.0.3-win32\vlc-1.0.3

vlc -vv --ignore-config -I rc --rc-host 127.0.0.1:1234 --vout dummy --snapshot-path F:\\MyProjects\\Windows\\VLC\\web\\webcam.png --sout "#duplicate{dst=display,dst={transcode{vcodec=FLV1,acodec=mp3,channels=2,samplerate=44100,width=320,height=240,fps=1,sfilter=mosaic:marq{marquee='%Y%m%d-%H%M%S',position=8}}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8080/webcam.flv}}}" dshow:// :dshow-vdev="Philips ToUcam Pro Camera; Video"
and the web page (written in php) named vlc_webcam.php
<html>
<head>
</head>
<title>Webcam</title>
<body>
<?php

$fp = fsockopen("127.0.0.1", 1234, $errno, $errstr, 8 );
if (!$fp) {
echo "<h1>No Webcam is available</h1>";
echo "error : $errstr ($errno)<br/>";
} else {
$out = "snapshot\r\n";
fwrite($fp, $out);
echo fgets($fp, 128);
fclose($fp);
}
?>

<h1>Webcam (Press F5 or click on image to refresh)</h1>
<a href="vlc_webcam.php"><img src="webcam.png" alt="Webcam"/></a>

</body>
You just need to configure Wampserver to match urls to local paths.

With this config, webcam is both as a video file and a page with a recent still image (F5 or click on video to refresh)

For two webcams, you can use two vlc instances. The only problem may be the 80 port that cannot be addressed by two different vlc servers.If so, you can for instance just stream locally (using udp) and then a third vlc instance that uses vlm and takes as input the outputs of the first two instances.


Erwan10

MortenKjarulff
Blank Cone
Blank Cone
Posts: 41
Joined: 14 Jun 2009 14:12

Re: Output a jpeg instead of a movie

Postby MortenKjarulff » 02 Dec 2009 13:23

Thanks, I will try it some day.

Would you put that on a public webpage? As I see it, it would open up for anyone to send commands to your vlc?

If it is possible, I need everything on port 80, and I have 2 cameras.

Cheers,
Morten
http://www.mortenkjarulff.dk/webcams

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: Output a jpeg instead of a movie

Postby erwan10 » 02 Dec 2009 13:44

Would you put that on a public webpage? As I see it, it would open up for anyone to send commands to your vlc?
No, it doesn't ... php is run on your server (only 127.0.0.1 is used). End users on the public domain won't be able to issue commands for vlc. They even have no means to know that you're using vlc as a backend. All they get from you is a basic html page. (of course, provided that your firewall is properly configured, since port like 1234 in this example must not be seen outside the local server)
If it is possible, I need everything on port 80, and I have 2 cameras.
Well, if apache is already running on port 80, vlc cannot bind to this port at least on the same machine. You need to configure apache or some proxies and redirect some urls to other ports for vlc to use them.

Erwan10

MortenKjarulff
Blank Cone
Blank Cone
Posts: 41
Joined: 14 Jun 2009 14:12

Re: Output a jpeg instead of a movie

Postby MortenKjarulff » 07 Apr 2010 11:53

Hi,

I have this running now:

Code: Select all

$MSET_VLC \ --ignore-config \ --no-qt-privacy-ask \ -I rc --rc-host 127.0.0.1:8091 \ --vout dummy \ --snapshot-path "`cygpath -w -a $MSET_VAR/www/cam1`/%Y%m%d-%H%M%S-cam1.jpg" --snapshot-format jpg \ --sout '#duplicate{dst=display,dst={transcode{vcodec=FLV1,acodec=mp3,width=320,height=240,fps=1,sfilter=mosaic:marq{marquee=%Y%m%d-%H%M%S,position=8}}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/cam1.flv}}}' \ dshow:// :dshow-vdev="Hauppauge WinTV PVR PCI II Capture" :dshow-video-input=3 &
How do I get a timestamp on the snapshots?

/Morten
www.MortenKjarulff.dk/webcams (very unstable)

MortenKjarulff
Blank Cone
Blank Cone
Posts: 41
Joined: 14 Jun 2009 14:12

Re: Output a jpeg instead of a movie

Postby MortenKjarulff » 16 Apr 2010 14:25

changing to this:

Code: Select all

--sout '#transcode{sfilter=mosaic:marq{marquee=%Y%m%d-%H%M%S,position=8}}:duplicate{dst=display,dst={transcode{vcodec=FLV1,acodec=mp3,width=320,height=240,fps=1}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/cam1.flv}}}' \
does not give me a timestamp on the snapshots.

What should I try next?

/Morten

MortenKjarulff
Blank Cone
Blank Cone
Posts: 41
Joined: 14 Jun 2009 14:12

Re: Output a jpeg instead of a movie

Postby MortenKjarulff » 19 Apr 2010 14:00

any?

MortenKjarulff
Blank Cone
Blank Cone
Posts: 41
Joined: 14 Jun 2009 14:12

Re: Output a jpeg instead of a movie

Postby MortenKjarulff » 20 Apr 2010 10:16

Also, no timestamp with this:

Code: Select all

--sub-filter 'marq{marquee=%Y%m%d-%H%M%S,position=8}' \ --sout '#duplicate{dst=display,dst={transcode{vcodec=FLV1,acodec=mp3,width=320,height=240,fps=1}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/cam1.flv}}}' \

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

Re: Output a jpeg instead of a movie

Postby VLC_help » 20 Apr 2010 10:55

AFAIK soverlay is still broken, so burning text to video doesn't work.

MortenKjarulff
Blank Cone
Blank Cone
Posts: 41
Joined: 14 Jun 2009 14:12

Re: Output a jpeg instead of a movie

Postby MortenKjarulff » 20 Apr 2010 11:30

Thanks,

Not totally broken, this:

Code: Select all

--sout '#duplicate{dst=display,dst={transcode{vcodec=FLV1,acodec=mp3,width=320,height=240,fps=1,sfilter=mosaic:marq{marquee=%Y%m%d-%H%M%S,position=8}}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/cam1.flv}}}'
gives me a timestamp on the video, but not on the snapshots.


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: Google [Bot] and 60 guests